@rr0/ufoathome 0.3.0 → 0.3.1

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.
@@ -207,7 +207,7 @@ input[type=range] {
207
207
  min-width: 3em;
208
208
  text-align: center;
209
209
  }
210
- `;function dh(i,e="#39ff14"){return{kind:"oval",bounds:i,color:e,angle:0,transparency:0,haloScale:0,selected:!1}}function Wc(i,e,t="#39ff14"){return{kind:"polygon",bounds:i,points:e,color:t,angle:0,transparency:0,haloScale:0,selected:!1}}function fh(i,e="#39ff14"){const{width:t,height:n}=i,s=[{x:.5*t,y:0},{x:.8*t,y:.25*n},{x:t,y:.5*n},{x:.8*t,y:.75*n},{x:.5*t,y:n},{x:.2*t,y:.75*n},{x:0,y:.5*n},{x:.2*t,y:.25*n}];return Wc(i,s,e)}function ph(i,e="#39ff14"){const{width:t,height:n}=i,s=[{x:0,y:0},{x:t,y:n/2},{x:0,y:n}];return Wc(i,s,e)}const mh={oval:dh,saucer:fh,triangle:ph};function _l(i,e){return{...mh[e.presetId](i,e.color),transparency:e.transparency,haloScale:e.haloScale}}function gh(i,e,t){const{bounds:n}=i;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Xc(i,e,t){const n=i.bounds.width,s=i.bounds.height;return{...i,bounds:{x:e-n/2,y:t-s/2,width:n,height:s}}}function Vt(i,e,t){return i+(e-i)*t}function xl(i){const e=/^#([0-9a-f]{6})$/i.exec(i);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function _h(i){return`#${i.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function xh(i,e,t){const n=xl(i),s=xl(e);return!n||!s?t<1?i:e:_h([Vt(n[0],s[0],t),Vt(n[1],s[1],t),Vt(n[2],s[2],t)])}function vh(i,e,t){const n={x:Vt(i.bounds.x,e.bounds.x,t),y:Vt(i.bounds.y,e.bounds.y,t),width:Vt(i.bounds.width,e.bounds.width,t),height:Vt(i.bounds.height,e.bounds.height,t)},s=Vt(i.angle,e.angle,t),r=Vt(i.transparency,e.transparency,t),a=Vt(i.haloScale,e.haloScale,t),o=xh(i.color,e.color,t);return i.kind==="polygon"&&e.kind==="polygon"&&i.points.length===e.points.length?{...i,bounds:n,angle:s,transparency:r,haloScale:a,color:o,points:i.points.map((l,c)=>({x:Vt(l.x,e.points[c].x,t),y:Vt(l.y,e.points[c].y,t)}))}:{...t<1?i:e,bounds:n,angle:s,transparency:r,haloScale:a,color:o}}class Tr{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);if(this.keyframes[n]?.t===e){const s=new Set(t.map(r=>r.sourceId));this.keyframes[n]={t:e,shapes:[...this.keyframes[n].shapes.filter(r=>!s.has(r.sourceId)),...t]}}else this.keyframes.splice(n,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const s=t+n>>>1;this.keyframes[s].t<e?t=s+1:n=s}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t];return n?.t===e?n:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(n=>n.sourceId===t)?.shape}getLatestShapeAt(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const s=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(s)return s.shape}}getInterpolatedShapeAt(e,t){const n=this.findShapeAtOrBefore(e,t);if(n?.t===e)return n.shape;const s=this.findShapeAtOrAfter(e,t);return n?s?vh(n.shape,s.shape,(e-n.t)/(s.t-n.t)):n.shape:s?.shape}findShapeAtOrBefore(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const s=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(s)return{t:this.keyframes[n].t,shape:s.shape}}}findShapeAtOrAfter(e,t){for(let n=this.findInsertIndex(e);n<this.keyframes.length;n++){const s=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(s)return{t:this.keyframes[n].t,shape:s.shape}}}hitTest(e,t,n){const s=this.sourceIds;for(let r=s.length-1;r>=0;r--){const a=this.getInterpolatedShapeAt(e,s[r]);if(a&&gh(a,t,n))return{sourceId:s[r],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const n of t.shapes)e.add(n.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new Tr;for(const n of e.keyframes)t.addKeyframe(n.t,n.shapes);return t}}function Mh(i,e,t){return Math.max(e,Math.min(t,i))}function Sh(i,e,t){const n=((e-i)%360+540)%360-180;return((i+n*t)%360+360)%360}function Yi(i,e,t){return i+(e-i)*t}function yh(i,e,t){return{lat:i.lat===void 0||e.lat===void 0?void 0:Yi(i.lat,e.lat,t),lng:i.lng===void 0||e.lng===void 0?void 0:Yi(i.lng,e.lng,t),elevationM:Yi(i.elevationM,e.elevationM,t),headingDeg:i.headingDeg===void 0||e.headingDeg===void 0?void 0:Sh(i.headingDeg,e.headingDeg,t),pitchDeg:Yi(i.pitchDeg,e.pitchDeg,t),fovDeg:Yi(i.fovDeg,e.fovDeg,t)}}class us{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,pose:t}:this.keyframes.splice(n,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const s=t+n>>>1;this.keyframes[s].t<e?t=s+1:n=s}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(n?.t===e)return n.pose;const s=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?s?yh(n.pose,s.pose,Mh((e-n.t)/(s.t-n.t),0,1)):n.pose:s?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new us;for(const n of e.keyframes)t.addKeyframe(n.t,n.pose);return t}}function ba(i){if(i.year!==void 0)return Date.UTC(i.year,(i.month??1)-1,i.day??1,i.hour??0,i.minute??0,i.second??0)}function Eh(i){if(i.durationSeconds!==void 0)return i.durationSeconds*1e3;const e=i.time?ba(i.time):void 0,t=i.endTime?ba(i.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class Ar{constructor(e,t,n,s,r,a){this.event=e,this.timeline=t,this.observerTrack=n,this.witnessId=s,this.witnessName=r,this.caseId=a}static create(e,t,n){return new Ar({eventType:"sighting",time:e,place:t},new Tr,new us,n)}}const bh=0,Th=0,Ah=60;function wh(i,e){const t=i.observerTrack.getInterpolatedPoseAt(e);if(t)return t;const n=i.event.place?.[0];if(n)return{lat:n.lat,lng:n.lng,elevationM:bh,headingDeg:void 0,pitchDeg:Th,fovDeg:Ah}}class Rh{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const n of this.timeline.sourceIds){const s=this.timeline.getInterpolatedShapeAt(e,n);s&&t.set(n,s)}this.onFrame(e,t)}}const qc=["nw","n","ne","e","se","s","sw","w"],Ch=24,xs=8;function Yc(i,e,t){const n=i.x-e.x,s=i.y-e.y,r=Math.cos(t),a=Math.sin(t);return{x:e.x+n*r-s*a,y:e.y+n*a+s*r}}function ko(i){return{x:i.x+i.width/2,y:i.y+i.height/2}}function Kc(i){const{x:e,y:t,width:n,height:s}=i.bounds,r={nw:{x:e,y:t},n:{x:e+n/2,y:t},ne:{x:e+n,y:t},e:{x:e+n,y:t+s/2},se:{x:e+n,y:t+s},s:{x:e+n/2,y:t+s},sw:{x:e,y:t+s},w:{x:e,y:t+s/2},rotate:{x:e+n/2,y:t-Ch}},a=ko(i.bounds),o={};for(const l of Object.keys(r))o[l]=Yc(r[l],a,i.angle);return o}function Ph(i,e,t=8){const n=Kc(i);for(const s of[...qc,"rotate"])if(Math.hypot(e.x-n[s].x,e.y-n[s].y)<=t)return s}const Ih={nw:{left:!0,top:!0},n:{top:!0},ne:{right:!0,top:!0},e:{right:!0},se:{right:!0,bottom:!0},s:{bottom:!0},sw:{left:!0,bottom:!0},w:{left:!0}};function Dh(i,e,t){if(e==="rotate")throw new Error("resizeShape does not accept the rotate handle");const n=ko(i.bounds),s=Yc(t,n,-i.angle),{x:r,y:a,width:o,height:l}=i.bounds,c=Ih[e];let h=r,d=a,u=r+o,m=a+l;c.left&&(h=Math.min(s.x,u-xs)),c.right&&(u=Math.max(s.x,h+xs)),c.top&&(d=Math.min(s.y,m-xs)),c.bottom&&(m=Math.max(s.y,d+xs));const _={x:h,y:d,width:u-h,height:m-d};if(i.kind==="oval")return{...i,bounds:_};const S=o===0?1:_.width/o,g=l===0?1:_.height/l;return{...i,bounds:_,points:i.points.map(f=>({x:f.x*S,y:f.y*g}))}}function Lh(i,e){const t=ko(i.bounds),n=Math.atan2(e.y-t.y,e.x-t.x)+Math.PI/2;return{...i,angle:n}}const Ta=6,vs=Ta/2,Uh=20;class Nh{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:n,width:s,height:r}=e.bounds,a=s/2,o=r/2;this.ctx.ellipse(t+a,n+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:n,width:s,height:r}=e.bounds;this.ctx.save(),this.ctx.translate(t+s/2,n+r/2),this.ctx.rotate(e.angle),this.ctx.translate(-s/2,-r/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=Uh*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=Kc(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const n of qc){const s=t[n];this.ctx.fillRect(s.x-vs,s.y-vs,Ta,Ta)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,vs+1,vs+1,0,0,2*Math.PI),this.ctx.fill()}}function Fh(i){return{version:1,time:i.event.time,endTime:i.event.endTime,durationSeconds:i.event.durationSeconds,place:i.event.place,witnessId:i.witnessId,witnessName:i.witnessName,caseId:i.caseId,timeline:i.timeline.toJSON(),observerTrack:i.observerTrack.toJSON()}}function Oh(i){return new Ar({eventType:"sighting",time:i.time,endTime:i.endTime,durationSeconds:i.durationSeconds,place:i.place},Tr.fromJSON(i.timeline),i.observerTrack?us.fromJSON(i.observerTrack):new us,i.witnessId,i.witnessName,i.caseId)}function Ho(i,e){for(const t of i){const n=t.toLowerCase().split("-")[0];if(e.includes(n))return n}return"en"}const Bh="modulepreload",zh=function(i,e){return new URL(i,e).href},vl={},ur=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");s=a(t.map(h=>{if(h=zh(h,n),h in vl)return;vl[h]=!0;const d=h.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(!!n)for(let S=o.length-1;S>=0;S--){const g=o[S];if(g.href===h&&(!d||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const _=document.createElement("link");if(_.rel=d?"stylesheet":Bh,d||(_.as="script"),_.crossOrigin="",_.href=h,c&&_.setAttribute("nonce",c),document.head.appendChild(_),d)return new Promise((S,g)=>{_.addEventListener("load",S),_.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},$c=["en","fr"],Gh={en:()=>ur(()=>Promise.resolve().then(()=>Wh),void 0,import.meta.url).then(i=>i.ufoMessages_en),fr:()=>ur(()=>import("./assets/UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(i=>i.ufoMessages_fr)};function kh(i){return Gh[i]()}const Hh={en:()=>ur(()=>Promise.resolve().then(()=>tx),void 0,import.meta.url).then(i=>i.ufoRecorderMessages_en),fr:()=>ur(()=>import("./assets/UfoRecorderMessages_fr-DRl6tTYJ.js"),[],import.meta.url).then(i=>i.ufoRecorderMessages_fr)};function Vh(i){return Hh[i]()}const Zc={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},Wh=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:Zc},Symbol.toStringTag,{value:"Module"}));class Xh extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=Ar.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=Zc;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${hh}</style>${uh}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new Nh(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return Fh(this.currentSighting)}set sightingData(e){this.currentSighting=Oh(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const n=this.playbackState!=="playing";for(const[s,r]of t){const a=n&&s===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...r,selected:!0}:r)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new Rh(this.currentSighting.timeline,(t,n)=>this.onFrame(t,n));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=Ho(navigator.languages,$c);e!=="en"&&this.applyMessages(await kh(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=Eh(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?ba(e.time):void 0;const n=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&n>0?n/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return Ms(e);const t=this.currentSighting.timeline.duration,n=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?Sl(Ml(this.realStartMs+n)):Ms(n)}formatEndOfTimeline(){return this.realDurationMs===void 0?Ms(this.currentSighting.timeline.duration):this.realStartMs!==void 0?Sl(Ml(this.realStartMs+this.realDurationMs)):Ms(this.realDurationMs)}}function Ml(i){const e=new Date(i);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function Sl(i){if(i.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return i.second?`${e(i.hour)}:${e(i.minute??0)}:${e(i.second)}`:`${e(i.hour)}:${e(i.minute??0)}`}function Ms(i){const e=Math.round(i/1e3),t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,"0")}`}const Aa="rr0-ufo";function wr(){customElements.get(Aa)||customElements.define(Aa,Xh)}const qh=`
210
+ `;function dh(i,e="#39ff14"){return{kind:"oval",bounds:i,color:e,angle:0,transparency:0,haloScale:0,selected:!1}}function Wc(i,e,t="#39ff14"){return{kind:"polygon",bounds:i,points:e,color:t,angle:0,transparency:0,haloScale:0,selected:!1}}function fh(i,e="#39ff14"){const{width:t,height:n}=i,s=[{x:.5*t,y:0},{x:.8*t,y:.25*n},{x:t,y:.5*n},{x:.8*t,y:.75*n},{x:.5*t,y:n},{x:.2*t,y:.75*n},{x:0,y:.5*n},{x:.2*t,y:.25*n}];return Wc(i,s,e)}function ph(i,e="#39ff14"){const{width:t,height:n}=i,s=[{x:0,y:0},{x:t,y:n/2},{x:0,y:n}];return Wc(i,s,e)}const mh={oval:dh,saucer:fh,triangle:ph};function _l(i,e){return{...mh[e.presetId](i,e.color),transparency:e.transparency,haloScale:e.haloScale}}function gh(i,e,t){const{bounds:n}=i;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Xc(i,e,t){const n=i.bounds.width,s=i.bounds.height;return{...i,bounds:{x:e-n/2,y:t-s/2,width:n,height:s}}}function Vt(i,e,t){return i+(e-i)*t}function xl(i){const e=/^#([0-9a-f]{6})$/i.exec(i);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function _h(i){return`#${i.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function xh(i,e,t){const n=xl(i),s=xl(e);return!n||!s?t<1?i:e:_h([Vt(n[0],s[0],t),Vt(n[1],s[1],t),Vt(n[2],s[2],t)])}function vh(i,e,t){const n={x:Vt(i.bounds.x,e.bounds.x,t),y:Vt(i.bounds.y,e.bounds.y,t),width:Vt(i.bounds.width,e.bounds.width,t),height:Vt(i.bounds.height,e.bounds.height,t)},s=Vt(i.angle,e.angle,t),r=Vt(i.transparency,e.transparency,t),a=Vt(i.haloScale,e.haloScale,t),o=xh(i.color,e.color,t);return i.kind==="polygon"&&e.kind==="polygon"&&i.points.length===e.points.length?{...i,bounds:n,angle:s,transparency:r,haloScale:a,color:o,points:i.points.map((l,c)=>({x:Vt(l.x,e.points[c].x,t),y:Vt(l.y,e.points[c].y,t)}))}:{...t<1?i:e,bounds:n,angle:s,transparency:r,haloScale:a,color:o}}class Tr{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);if(this.keyframes[n]?.t===e){const s=new Set(t.map(r=>r.sourceId));this.keyframes[n]={t:e,shapes:[...this.keyframes[n].shapes.filter(r=>!s.has(r.sourceId)),...t]}}else this.keyframes.splice(n,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const s=t+n>>>1;this.keyframes[s].t<e?t=s+1:n=s}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t];return n?.t===e?n:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(n=>n.sourceId===t)?.shape}getLatestShapeAt(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const s=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(s)return s.shape}}getInterpolatedShapeAt(e,t){const n=this.findShapeAtOrBefore(e,t);if(n?.t===e)return n.shape;const s=this.findShapeAtOrAfter(e,t);return n?s?vh(n.shape,s.shape,(e-n.t)/(s.t-n.t)):n.shape:s?.shape}findShapeAtOrBefore(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const s=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(s)return{t:this.keyframes[n].t,shape:s.shape}}}findShapeAtOrAfter(e,t){for(let n=this.findInsertIndex(e);n<this.keyframes.length;n++){const s=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(s)return{t:this.keyframes[n].t,shape:s.shape}}}hitTest(e,t,n){const s=this.sourceIds;for(let r=s.length-1;r>=0;r--){const a=this.getInterpolatedShapeAt(e,s[r]);if(a&&gh(a,t,n))return{sourceId:s[r],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const n of t.shapes)e.add(n.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new Tr;for(const n of e.keyframes)t.addKeyframe(n.t,n.shapes);return t}}function Mh(i,e,t){return Math.max(e,Math.min(t,i))}function Sh(i,e,t){const n=((e-i)%360+540)%360-180;return((i+n*t)%360+360)%360}function Yi(i,e,t){return i+(e-i)*t}function yh(i,e,t){return{lat:i.lat===void 0||e.lat===void 0?void 0:Yi(i.lat,e.lat,t),lng:i.lng===void 0||e.lng===void 0?void 0:Yi(i.lng,e.lng,t),elevationM:Yi(i.elevationM,e.elevationM,t),headingDeg:i.headingDeg===void 0||e.headingDeg===void 0?void 0:Sh(i.headingDeg,e.headingDeg,t),pitchDeg:Yi(i.pitchDeg,e.pitchDeg,t),fovDeg:Yi(i.fovDeg,e.fovDeg,t)}}class us{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,pose:t}:this.keyframes.splice(n,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const s=t+n>>>1;this.keyframes[s].t<e?t=s+1:n=s}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(n?.t===e)return n.pose;const s=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?s?yh(n.pose,s.pose,Mh((e-n.t)/(s.t-n.t),0,1)):n.pose:s?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new us;for(const n of e.keyframes)t.addKeyframe(n.t,n.pose);return t}}function ba(i){if(i.year!==void 0)return Date.UTC(i.year,(i.month??1)-1,i.day??1,i.hour??0,i.minute??0,i.second??0)}function Eh(i){if(i.durationSeconds!==void 0)return i.durationSeconds*1e3;const e=i.time?ba(i.time):void 0,t=i.endTime?ba(i.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class Ar{constructor(e,t,n,s,r,a){this.event=e,this.timeline=t,this.observerTrack=n,this.witnessId=s,this.witnessName=r,this.caseId=a}static create(e,t,n){return new Ar({eventType:"sighting",time:e,place:t},new Tr,new us,n)}}const bh=0,Th=0,Ah=60;function wh(i,e){const t=i.observerTrack.getInterpolatedPoseAt(e);if(t)return t;const n=i.event.place?.[0];if(n)return{lat:n.lat,lng:n.lng,elevationM:bh,headingDeg:void 0,pitchDeg:Th,fovDeg:Ah}}class Rh{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const n of this.timeline.sourceIds){const s=this.timeline.getInterpolatedShapeAt(e,n);s&&t.set(n,s)}this.onFrame(e,t)}}const qc=["nw","n","ne","e","se","s","sw","w"],Ch=24,xs=8;function Yc(i,e,t){const n=i.x-e.x,s=i.y-e.y,r=Math.cos(t),a=Math.sin(t);return{x:e.x+n*r-s*a,y:e.y+n*a+s*r}}function ko(i){return{x:i.x+i.width/2,y:i.y+i.height/2}}function Kc(i){const{x:e,y:t,width:n,height:s}=i.bounds,r={nw:{x:e,y:t},n:{x:e+n/2,y:t},ne:{x:e+n,y:t},e:{x:e+n,y:t+s/2},se:{x:e+n,y:t+s},s:{x:e+n/2,y:t+s},sw:{x:e,y:t+s},w:{x:e,y:t+s/2},rotate:{x:e+n/2,y:t-Ch}},a=ko(i.bounds),o={};for(const l of Object.keys(r))o[l]=Yc(r[l],a,i.angle);return o}function Ph(i,e,t=8){const n=Kc(i);for(const s of[...qc,"rotate"])if(Math.hypot(e.x-n[s].x,e.y-n[s].y)<=t)return s}const Ih={nw:{left:!0,top:!0},n:{top:!0},ne:{right:!0,top:!0},e:{right:!0},se:{right:!0,bottom:!0},s:{bottom:!0},sw:{left:!0,bottom:!0},w:{left:!0}};function Dh(i,e,t){if(e==="rotate")throw new Error("resizeShape does not accept the rotate handle");const n=ko(i.bounds),s=Yc(t,n,-i.angle),{x:r,y:a,width:o,height:l}=i.bounds,c=Ih[e];let h=r,d=a,u=r+o,m=a+l;c.left&&(h=Math.min(s.x,u-xs)),c.right&&(u=Math.max(s.x,h+xs)),c.top&&(d=Math.min(s.y,m-xs)),c.bottom&&(m=Math.max(s.y,d+xs));const _={x:h,y:d,width:u-h,height:m-d};if(i.kind==="oval")return{...i,bounds:_};const S=o===0?1:_.width/o,g=l===0?1:_.height/l;return{...i,bounds:_,points:i.points.map(f=>({x:f.x*S,y:f.y*g}))}}function Lh(i,e){const t=ko(i.bounds),n=Math.atan2(e.y-t.y,e.x-t.x)+Math.PI/2;return{...i,angle:n}}const Ta=6,vs=Ta/2,Uh=20;class Nh{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:n,width:s,height:r}=e.bounds,a=s/2,o=r/2;this.ctx.ellipse(t+a,n+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:n,width:s,height:r}=e.bounds;this.ctx.save(),this.ctx.translate(t+s/2,n+r/2),this.ctx.rotate(e.angle),this.ctx.translate(-s/2,-r/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=Uh*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=Kc(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const n of qc){const s=t[n];this.ctx.fillRect(s.x-vs,s.y-vs,Ta,Ta)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,vs+1,vs+1,0,0,2*Math.PI),this.ctx.fill()}}function Fh(i){return{version:1,time:i.event.time,endTime:i.event.endTime,durationSeconds:i.event.durationSeconds,place:i.event.place,witnessId:i.witnessId,witnessName:i.witnessName,caseId:i.caseId,timeline:i.timeline.toJSON(),observerTrack:i.observerTrack.toJSON()}}function Oh(i){return new Ar({eventType:"sighting",time:i.time,endTime:i.endTime,durationSeconds:i.durationSeconds,place:i.place},Tr.fromJSON(i.timeline),i.observerTrack?us.fromJSON(i.observerTrack):new us,i.witnessId,i.witnessName,i.caseId)}function Ho(i,e){for(const t of i){const n=t.toLowerCase().split("-")[0];if(e.includes(n))return n}return"en"}const Bh="modulepreload",zh=function(i,e){return new URL(i,e).href},vl={},ur=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");s=a(t.map(h=>{if(h=zh(h,n),h in vl)return;vl[h]=!0;const d=h.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(!!n)for(let S=o.length-1;S>=0;S--){const g=o[S];if(g.href===h&&(!d||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const _=document.createElement("link");if(_.rel=d?"stylesheet":Bh,d||(_.as="script"),_.crossOrigin="",_.href=h,c&&_.setAttribute("nonce",c),document.head.appendChild(_),d)return new Promise((S,g)=>{_.addEventListener("load",S),_.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},$c=["en","fr"],Gh={en:()=>ur(()=>Promise.resolve().then(()=>Wh),void 0,import.meta.url).then(i=>i.ufoMessages_en),fr:()=>ur(()=>import("./UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(i=>i.ufoMessages_fr)};function kh(i){return Gh[i]()}const Hh={en:()=>ur(()=>Promise.resolve().then(()=>tx),void 0,import.meta.url).then(i=>i.ufoRecorderMessages_en),fr:()=>ur(()=>import("./UfoRecorderMessages_fr-DRl6tTYJ.js"),[],import.meta.url).then(i=>i.ufoRecorderMessages_fr)};function Vh(i){return Hh[i]()}const Zc={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},Wh=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:Zc},Symbol.toStringTag,{value:"Module"}));class Xh extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=Ar.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=Zc;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${hh}</style>${uh}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new Nh(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return Fh(this.currentSighting)}set sightingData(e){this.currentSighting=Oh(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const n=this.playbackState!=="playing";for(const[s,r]of t){const a=n&&s===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...r,selected:!0}:r)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new Rh(this.currentSighting.timeline,(t,n)=>this.onFrame(t,n));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=Ho(navigator.languages,$c);e!=="en"&&this.applyMessages(await kh(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=Eh(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?ba(e.time):void 0;const n=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&n>0?n/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return Ms(e);const t=this.currentSighting.timeline.duration,n=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?Sl(Ml(this.realStartMs+n)):Ms(n)}formatEndOfTimeline(){return this.realDurationMs===void 0?Ms(this.currentSighting.timeline.duration):this.realStartMs!==void 0?Sl(Ml(this.realStartMs+this.realDurationMs)):Ms(this.realDurationMs)}}function Ml(i){const e=new Date(i);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function Sl(i){if(i.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return i.second?`${e(i.hour)}:${e(i.minute??0)}:${e(i.second)}`:`${e(i.hour)}:${e(i.minute??0)}`}function Ms(i){const e=Math.round(i/1e3),t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,"0")}`}const Aa="rr0-ufo";function wr(){customElements.get(Aa)||customElements.define(Aa,Xh)}const qh=`
211
211
  <div class="stage" id="stage">
212
212
  <div class="frame" id="frame">
213
213
  <canvas id="scene-canvas"></canvas>
@@ -4428,4 +4428,4 @@ void main() {
4428
4428
  * @fileoverview Astronomy calculation library for browser scripting and Node.js.
4429
4429
  * @author Don Cross <cosinekitty@gmail.com>
4430
4430
  * @license MIT
4431
- */const Ou=173.1446326846693,ei=14959787069098932e-8,it=.017453292519943295,wc=.26179938779914946,Wn=57.29577951308232,Bu=3.819718634205488,P_=365.24217,Rc=new Date("2000-01-01T12:00:00Z"),Mn=2*Math.PI,zn=3600*(180/Math.PI),Di=484813681109536e-20,zu=10800*60,I_=2*zu,Cc=7292115e-11,D_=zu/Math.PI,L_=-.17-5*Math.log10(D_),Eo=.996647180302104,U_=Eo*Eo,bo=6378.1366,N_=bo/ei,Gu=81.30056,sl=.0002959122082855911,To=2825345909524226e-22,Ao=8459715185680659e-23,wo=1292024916781969e-23,Ro=1524358900784276e-23;function Sr(i){if(i!==!0&&i!==!1)throw console.trace(),`Value is not boolean: ${i}`;return i}function yt(i){if(!Number.isFinite(i))throw console.trace(),`Value is not a finite number: ${i}`;return i}function Pi(i){return i-Math.floor(i)}function F_(i,e){const t=i.x*i.x+i.y*i.y+i.z*i.z;if(Math.abs(t)<1e-8)throw"AngleBetween: first vector is too short.";const n=e.x*e.x+e.y*e.y+e.z*e.z;if(Math.abs(n)<1e-8)throw"AngleBetween: second vector is too short.";const s=(i.x*e.x+i.y*e.y+i.z*e.z)/Math.sqrt(t*n);return s<=-1?180:s>=1?0:Wn*Math.acos(s)}var ye;(function(i){i.Sun="Sun",i.Moon="Moon",i.Mercury="Mercury",i.Venus="Venus",i.Earth="Earth",i.Mars="Mars",i.Jupiter="Jupiter",i.Saturn="Saturn",i.Uranus="Uranus",i.Neptune="Neptune",i.Pluto="Pluto",i.SSB="SSB",i.EMB="EMB",i.Star1="Star1",i.Star2="Star2",i.Star3="Star3",i.Star4="Star4",i.Star5="Star5",i.Star6="Star6",i.Star7="Star7",i.Star8="Star8"})(ye||(ye={}));const O_=[ye.Star1,ye.Star2,ye.Star3,ye.Star4,ye.Star5,ye.Star6,ye.Star7,ye.Star8],B_=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function z_(i){const e=O_.indexOf(i);return e>=0?B_[e]:null}function rl(i){const e=z_(i);return e&&e.dist>0?e:null}var $t;(function(i){i[i.From2000=0]="From2000",i[i.Into2000=1]="Into2000"})($t||($t={}));const bn={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[85831e-11,1.27079125277,161000.6857376741],[57056e-11,2.01374292245,83996.84731811189],[55736e-11,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function G_(i){var e,t,n,s,r,a,o;const l=2e3+(i-14)/P_;return l<-500?(e=(l-1820)/100,-20+32*e*e):l<500?(e=l/100,t=e*e,n=e*t,s=t*t,r=t*n,a=n*n,10583.6-1014.41*e+33.78311*t-5.952053*n-.1798452*s+.022174192*r+.0090316521*a):l<1600?(e=(l-1e3)/100,t=e*e,n=e*t,s=t*t,r=t*n,a=n*n,1574.2-556.01*e+71.23472*t+.319781*n-.8503463*s-.005050998*r+.0083572073*a):l<1700?(e=l-1600,t=e*e,n=e*t,120-.9808*e-.01532*t+n/7129):l<1800?(e=l-1700,t=e*e,n=e*t,s=t*t,8.83+.1603*e-.0059285*t+13336e-8*n-s/1174e3):l<1860?(e=l-1800,t=e*e,n=e*t,s=t*t,r=t*n,a=n*n,o=n*s,13.72-.332447*e+.0068612*t+.0041116*n-37436e-8*s+121272e-10*r-1699e-10*a+875e-12*o):l<1900?(e=l-1860,t=e*e,n=e*t,s=t*t,r=t*n,7.62+.5737*e-.251754*t+.01680668*n-.0004473624*s+r/233174):l<1920?(e=l-1900,t=e*e,n=e*t,s=t*t,-2.79+1.494119*e-.0598939*t+.0061966*n-197e-6*s):l<1941?(e=l-1920,t=e*e,n=e*t,21.2+.84493*e-.0761*t+.0020936*n):l<1961?(e=l-1950,t=e*e,n=e*t,29.07+.407*e-t/233+n/2547):l<1986?(e=l-1975,t=e*e,n=e*t,45.45+1.067*e-t/260-n/718):l<2005?(e=l-2e3,t=e*e,n=e*t,s=t*t,r=t*n,63.86+.3345*e-.060374*t+.0017275*n+651814e-9*s+2373599e-11*r):l<2050?(e=l-2e3,62.92+.32217*e+.005589*e*e):l<2150?(e=(l-1820)/100,-20+32*e*e-.5628*(2150-l)):(e=(l-1820)/100,-20+32*e*e)}let k_=G_;function Pc(i){return i+k_(i)/86400}class Oi{constructor(e){if(e instanceof Oi){this.date=e.date,this.ut=e.ut,this.tt=e.tt;return}const t=1e3*3600*24;if(e instanceof Date&&Number.isFinite(e.getTime())){this.date=e,this.ut=(e.getTime()-Rc.getTime())/t,this.tt=Pc(this.ut);return}if(Number.isFinite(e)){this.date=new Date(Rc.getTime()+e*t),this.ut=e,this.tt=Pc(this.ut);return}throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date."}static FromTerrestrialTime(e){let t=new Oi(e);for(;;){const n=e-t.tt;if(Math.abs(n)<1e-12)return t;t=t.AddDays(n)}}toString(){return this.date.toISOString()}AddDays(e){return new Oi(this.ut+e)}}function Zt(i){return i instanceof Oi?i:new Oi(i)}function H_(i){function e(u){return u%I_*Di}const t=i.tt/36525,n=e(128710479305e-5+t*1295965810481e-4),s=e(335779.526232+t*17395272628478e-4),r=e(107226070369e-5+t*1602961601209e-3),a=e(450160.398036-t*69628905431e-4);let o=Math.sin(a),l=Math.cos(a),c=(-172064161-174666*t)*o+33386*l,h=(92052331+9086*t)*l+15377*o,d=2*(s-r+a);return o=Math.sin(d),l=Math.cos(d),c+=(-13170906-1675*t)*o-13696*l,h+=(5730336-3015*t)*l-4587*o,d=2*(s+a),o=Math.sin(d),l=Math.cos(d),c+=(-2276413-234*t)*o+2796*l,h+=(978459-485*t)*l+1374*o,d=2*a,o=Math.sin(d),l=Math.cos(d),c+=(2074554+207*t)*o-698*l,h+=(-897492+470*t)*l-291*o,o=Math.sin(n),l=Math.cos(n),c+=(1475877-3633*t)*o+11817*l,h+=(73871-184*t)*l-1924*o,{dpsi:-135e-6+c*1e-7,deps:388e-6+h*1e-7}}function ku(i){var e=i.tt/36525,t=((((-434e-10*e-576e-9)*e+.0020034)*e-1831e-7)*e-46.836769)*e+84381.406;return t/3600}var Js;function al(i){if(!Js||Math.abs(Js.tt-i.tt)>1e-6){const e=H_(i),t=ku(i),n=t+e.deps/3600;Js={tt:i.tt,dpsi:e.dpsi,deps:e.deps,ee:e.dpsi*Math.cos(t*it)/15,mobl:t,tobl:n}}return Js}function V_(i,e){const t=i*it,n=Math.cos(t),s=Math.sin(t);return[e[0],e[1]*n-e[2]*s,e[1]*s+e[2]*n]}function W_(i,e){return V_(ku(i),e)}function X_(i){const e=i.tt/36525;function t(we,ve){const Ue=[];let Ie;for(Ie=0;Ie<=ve-we;++Ie)Ue.push(0);return{min:we,array:Ue}}function n(we,ve,Ue,Ie){const De=[];for(let $e=0;$e<=ve-we;++$e)De.push(t(Ue,Ie));return{min:we,array:De}}function s(we,ve,Ue){const Ie=we.array[ve-we.min];return Ie.array[Ue-Ie.min]}function r(we,ve,Ue,Ie){const De=we.array[ve-we.min];De.array[Ue-De.min]=Ie}let a,o,l,c,h,d,u,m,_,S,g,f,A,w,M,T,E,R,x,b,D,C,N,Y=n(-6,6,1,4),K=n(-6,6,1,4);function O(we,ve){return s(Y,we,ve)}function W(we,ve){return s(K,we,ve)}function V(we,ve,Ue){return r(Y,we,ve,Ue)}function Q(we,ve,Ue){return r(K,we,ve,Ue)}function te(we,ve,Ue,Ie,De){De(we*Ue-ve*Ie,ve*Ue+we*Ie)}function ee(we){return Math.sin(Mn*we)}u=e*e,_=0,N=0,g=0,f=3422.7;var se=ee(.19833+.05611*e),ge=ee(.27869+.04508*e),Ve=ee(.16827-.36903*e),st=ee(.34734-5.37261*e),We=ee(.10498-5.37899*e),$=ee(.42681-.41855*e),re=ee(.14943-5.37511*e);for(R=.84*se+.31*ge+14.27*Ve+7.26*st+.28*We+.24*$,x=2.94*se+.31*ge+14.27*Ve+9.34*st+1.12*We+.83*$,b=-6.4*se-1.89*$,D=.21*se+.31*ge+14.27*Ve-88.7*st-15.3*We+.24*$-1.86*re,C=R-b,m=-3332e-9*ee(.59734-5.37261*e)-539e-9*ee(.35498-5.37899*e)-64e-9*ee(.39943-5.37511*e),A=Mn*Pi(.60643382+1336.85522467*e-313e-8*u)+R/zn,w=Mn*Pi(.37489701+1325.55240982*e+2565e-8*u)+x/zn,M=Mn*Pi(.99312619+99.99735956*e-44e-8*u)+b/zn,T=Mn*Pi(.25909118+1342.2278298*e-892e-8*u)+D/zn,E=Mn*Pi(.82736186+1236.85308708*e-397e-8*u)+C/zn,h=1;h<=4;++h){switch(h){case 1:l=w,o=4,c=1.000002208;break;case 2:l=M,o=3,c=.997504612-.002495388*e;break;case 3:l=T,o=4,c=1.000002708+139.978*m;break;case 4:l=E,o=6,c=1;break;default:throw`Internal error: I = ${h}`}for(V(0,h,1),V(1,h,Math.cos(l)*c),Q(0,h,0),Q(1,h,Math.sin(l)*c),d=2;d<=o;++d)te(O(d-1,h),W(d-1,h),O(1,h),W(1,h),(we,ve)=>(V(d,h,we),Q(d,h,ve)));for(d=1;d<=o;++d)V(-d,h,O(d,h)),Q(-d,h,-W(d,h))}function ne(we,ve,Ue,Ie){for(var De={x:1,y:0},$e=[0,we,ve,Ue,Ie],Ze=1;Ze<=4;++Ze)$e[Ze]!==0&&te(De.x,De.y,O($e[Ze],Ze),W($e[Ze],Ze),(ct,ot)=>(De.x=ct,De.y=ot));return De}function G(we,ve,Ue,Ie,De,$e,Ze,ct){var ot=ne(De,$e,Ze,ct);_+=we*ot.y,N+=ve*ot.y,g+=Ue*ot.x,f+=Ie*ot.x}G(13.902,14.06,-.001,.2607,0,0,0,4),G(.403,-4.01,.394,.0023,0,0,0,3),G(2369.912,2373.36,.601,28.2333,0,0,0,2),G(-125.154,-112.79,-.725,-.9781,0,0,0,1),G(1.979,6.98,-.445,.0433,1,0,0,4),G(191.953,192.72,.029,3.0861,1,0,0,2),G(-8.466,-13.51,.455,-.1093,1,0,0,1),G(22639.5,22609.07,.079,186.5398,1,0,0,0),G(18.609,3.59,-.094,.0118,1,0,0,-1),G(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),G(3.215,5.44,.192,-.0386,1,0,0,-3),G(-38.428,-38.64,.001,.6008,1,0,0,-4),G(-.393,-1.43,-.092,.0086,1,0,0,-6),G(-.289,-1.59,.123,-.0053,0,1,0,4),G(-24.42,-25.1,.04,-.3,0,1,0,2),G(18.023,17.93,.007,.1494,0,1,0,1),G(-668.146,-126.98,-1.302,-.3997,0,1,0,0),G(.56,.32,-.001,-.0037,0,1,0,-1),G(-165.145,-165.06,.054,1.9178,0,1,0,-2),G(-1.877,-6.46,-.416,.0339,0,1,0,-4),G(.213,1.02,-.074,.0054,2,0,0,4),G(14.387,14.78,-.017,.2833,2,0,0,2),G(-.586,-1.2,.054,-.01,2,0,0,1),G(769.016,767.96,.107,10.1657,2,0,0,0),G(1.75,2.01,-.018,.0155,2,0,0,-1),G(-211.656,-152.53,5.679,-.3039,2,0,0,-2),G(1.225,.91,-.03,-.0088,2,0,0,-3),G(-30.773,-34.07,-.308,.3722,2,0,0,-4),G(-.57,-1.4,-.074,.0109,2,0,0,-6),G(-2.921,-11.75,.787,-.0484,1,1,0,2),G(1.267,1.52,-.022,.0164,1,1,0,1),G(-109.673,-115.18,.461,-.949,1,1,0,0),G(-205.962,-182.36,2.056,1.4437,1,1,0,-2),G(.233,.36,.012,-.0025,1,1,0,-3),G(-4.391,-9.66,-.471,.0673,1,1,0,-4),G(.283,1.53,-.111,.006,1,-1,0,4),G(14.577,31.7,-1.54,.2302,1,-1,0,2),G(147.687,138.76,.679,1.1528,1,-1,0,0),G(-1.089,.55,.021,0,1,-1,0,-1),G(28.475,23.59,-.443,-.2257,1,-1,0,-2),G(-.276,-.38,-.006,-.0036,1,-1,0,-3),G(.636,2.27,.146,-.0102,1,-1,0,-4),G(-.189,-1.68,.131,-.0028,0,2,0,2),G(-7.486,-.66,-.037,-.0086,0,2,0,0),G(-8.096,-16.35,-.74,.0918,0,2,0,-2),G(-5.741,-.04,0,-9e-4,0,0,2,2),G(.255,0,0,0,0,0,2,1),G(-411.608,-.2,0,-.0124,0,0,2,0),G(.584,.84,0,.0071,0,0,2,-1),G(-55.173,-52.14,0,-.1052,0,0,2,-2),G(.254,.25,0,-.0017,0,0,2,-3),G(.025,-1.67,0,.0031,0,0,2,-4),G(1.06,2.96,-.166,.0243,3,0,0,2),G(36.124,50.64,-1.3,.6215,3,0,0,0),G(-13.193,-16.4,.258,-.1187,3,0,0,-2),G(-1.187,-.74,.042,.0074,3,0,0,-4),G(-.293,-.31,-.002,.0046,3,0,0,-6),G(-.29,-1.45,.116,-.0051,2,1,0,2),G(-7.649,-10.56,.259,-.1038,2,1,0,0),G(-8.627,-7.59,.078,-.0192,2,1,0,-2),G(-2.74,-2.54,.022,.0324,2,1,0,-4),G(1.181,3.32,-.212,.0213,2,-1,0,2),G(9.703,11.67,-.151,.1268,2,-1,0,0),G(-.352,-.37,.001,-.0028,2,-1,0,-1),G(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),G(.36,.2,-.012,-.0043,2,-1,0,-4),G(-1.167,-1.25,.008,-.0106,1,2,0,0),G(-7.412,-6.12,.117,.0484,1,2,0,-2),G(-.311,-.65,-.032,.0044,1,2,0,-4),G(.757,1.82,-.105,.0112,1,-2,0,2),G(2.58,2.32,.027,.0196,1,-2,0,0),G(2.533,2.4,-.014,-.0212,1,-2,0,-2),G(-.344,-.57,-.025,.0036,0,3,0,-2),G(-.992,-.02,0,0,1,0,2,2),G(-45.099,-.02,0,-.001,1,0,2,0),G(-.179,-9.52,0,-.0833,1,0,2,-2),G(-.301,-.33,0,.0014,1,0,2,-4),G(-6.382,-3.37,0,-.0481,1,0,-2,2),G(39.528,85.13,0,-.7136,1,0,-2,0),G(9.366,.71,0,-.0112,1,0,-2,-2),G(.202,.02,0,0,1,0,-2,-4),G(.415,.1,0,.0013,0,1,2,0),G(-2.152,-2.26,0,-.0066,0,1,2,-2),G(-1.44,-1.3,0,.0014,0,1,-2,2),G(.384,-.04,0,0,0,1,-2,-2),G(1.938,3.6,-.145,.0401,4,0,0,0),G(-.952,-1.58,.052,-.013,4,0,0,-2),G(-.551,-.94,.032,-.0097,3,1,0,0),G(-.482,-.57,.005,-.0045,3,1,0,-2),G(.681,.96,-.026,.0115,3,-1,0,0),G(-.297,-.27,.002,-9e-4,2,2,0,-2),G(.254,.21,-.003,0,2,-2,0,-2),G(-.25,-.22,.004,.0014,1,3,0,-2),G(-3.996,0,0,4e-4,2,0,2,0),G(.557,-.75,0,-.009,2,0,2,-2),G(-.459,-.38,0,-.0053,2,0,-2,2),G(-1.298,.74,0,4e-4,2,0,-2,0),G(.538,1.14,0,-.0141,2,0,-2,-2),G(.263,.02,0,0,1,1,2,0),G(.426,.07,0,-6e-4,1,1,-2,-2),G(-.304,.03,0,3e-4,1,-1,2,0),G(-.372,-.19,0,-.0027,1,-1,-2,2),G(.418,0,0,0,0,0,4,0),G(-.33,-.04,0,0,3,0,2,0);function Ce(we,ve,Ue,Ie,De){return we*ne(ve,Ue,Ie,De).y}S=0,S+=Ce(-526.069,0,0,1,-2),S+=Ce(-3.352,0,0,1,-4),S+=Ce(44.297,1,0,1,-2),S+=Ce(-6,1,0,1,-4),S+=Ce(20.599,-1,0,1,0),S+=Ce(-30.598,-1,0,1,-2),S+=Ce(-24.649,-2,0,1,0),S+=Ce(-2,-2,0,1,-2),S+=Ce(-22.571,0,1,1,-2),S+=Ce(10.985,0,-1,1,-2),_+=.82*ee(.7736-62.5512*e)+.31*ee(.0466-125.1025*e)+.35*ee(.5785-25.1042*e)+.66*ee(.4591+1335.8075*e)+.64*ee(.313-91.568*e)+1.14*ee(.148+1331.2898*e)+.21*ee(.5918+1056.5859*e)+.44*ee(.5784+1322.8595*e)+.24*ee(.2275-5.7374*e)+.28*ee(.2965+2.6929*e)+.33*ee(.3132+6.3368*e),a=T+N/zn;let Pe=(1.000002708+139.978*m)*(18518.511+1.189+g)*Math.sin(a)-6.24*Math.sin(3*a)+S;return{geo_eclip_lon:Mn*Pi((A+_/zn)/Mn),geo_eclip_lat:Math.PI/(180*3600)*Pe,distance_au:zn*N_/(.999953253*f)}}function Hu(i,e){return[i.rot[0][0]*e[0]+i.rot[1][0]*e[1]+i.rot[2][0]*e[2],i.rot[0][1]*e[0]+i.rot[1][1]*e[1]+i.rot[2][1]*e[2],i.rot[0][2]*e[0]+i.rot[1][2]*e[1]+i.rot[2][2]*e[2]]}function yr(i,e,t){const n=q_(e,t);return Hu(n,i)}function q_(i,e){const t=i.tt/36525;let n=84381.406,s=((((-951e-10*t+132851e-9)*t-.00114045)*t-1.0790069)*t+5038.481507)*t,r=((((3337e-10*t-467e-9)*t-.00772503)*t+.0512623)*t-.025754)*t+n,a=((((-56e-9*t+170663e-9)*t-.00121197)*t-2.3814292)*t+10.556403)*t;n*=Di,s*=Di,r*=Di,a*=Di;const o=Math.sin(n),l=Math.cos(n),c=Math.sin(-s),h=Math.cos(-s),d=Math.sin(-r),u=Math.cos(-r),m=Math.sin(a),_=Math.cos(a),S=_*h-c*m*u,g=_*c*l+m*u*h*l-o*m*d,f=_*c*o+m*u*h*o+l*m*d,A=-m*h-c*_*u,w=-m*c*l+_*u*h*l-o*_*d,M=-m*c*o+_*u*h*o+l*_*d,T=c*d,E=-d*h*l-o*u,R=-d*h*o+u*l;if(e===$t.Into2000)return new Er([[S,g,f],[A,w,M],[T,E,R]]);if(e===$t.From2000)return new Er([[S,A,T],[g,w,E],[f,M,R]]);throw"Invalid precess direction"}function Y_(i){const e=.779057273264+.00273781191135448*i.ut,t=i.ut%1;let n=360*((e+t)%1);return n<0&&(n+=360),n}let Qs;function Vu(i){if(!Qs||Qs.tt!==i.tt){const e=i.tt/36525;let t=15*al(i).ee;const n=Y_(i);let r=((t+.014506+((((-368e-10*e-29956e-9)*e-44e-8)*e+1.3915817)*e+4612.156534)*e)/3600+n)%360/15;r<0&&(r+=24),Qs={tt:i.tt,st:r}}return Qs.st}function K_(i,e){const t=i.latitude*it,n=Math.sin(t),s=Math.cos(t),r=1/Math.hypot(s,Eo*n),a=U_*r,o=i.height/1e3,l=bo*r+o,c=bo*a+o,h=(15*e+i.longitude)*it,d=Math.sin(h),u=Math.cos(h);return{pos:[l*s*u/ei,l*s*d/ei,c*n/ei],vel:[-Cc*l*s*d*86400/ei,Cc*l*s*u*86400/ei,0]}}function Co(i,e,t){const n=$_(e,t);return Hu(n,i)}function $_(i,e){const t=al(i),n=t.mobl*it,s=t.tobl*it,r=t.dpsi*Di,a=Math.cos(n),o=Math.sin(n),l=Math.cos(s),c=Math.sin(s),h=Math.cos(r),d=Math.sin(r),u=h,m=-d*a,_=-d*o,S=d*l,g=h*a*l+o*c,f=h*o*l-a*c,A=d*c,w=h*a*c-o*l,M=h*o*c+a*l;if(e===$t.From2000)return new Er([[u,S,A],[m,g,w],[_,f,M]]);if(e===$t.Into2000)return new Er([[u,m,_],[S,g,f],[A,w,M]]);throw"Invalid precess direction"}function Wu(i,e,t){return t===$t.Into2000?yr(Co(i,e,t),e,t):Co(yr(i,e,t),e,t)}function Z_(i,e){const t=Vu(i),n=K_(e,t).pos;return Wu(n,i,$t.Into2000)}class gt{constructor(e,t,n,s){this.x=e,this.y=t,this.z=n,this.t=s}Length(){return Math.hypot(this.x,this.y,this.z)}}class Hn{constructor(e,t,n,s,r,a,o){this.x=e,this.y=t,this.z=n,this.vx=s,this.vy=r,this.vz=a,this.t=o}}class J_{constructor(e,t,n){this.lat=yt(e),this.lon=yt(t),this.dist=yt(n)}}class Ic{constructor(e,t,n,s){this.ra=yt(e),this.dec=yt(t),this.dist=yt(n),this.vec=s}}class Er{constructor(e){this.rot=e}}class Q_{constructor(e,t,n,s){this.azimuth=yt(e),this.altitude=yt(t),this.ra=yt(n),this.dec=yt(s)}}class j_{constructor(e,t,n){this.vec=e,this.elat=yt(t),this.elon=yt(n)}}function e1(i,e){return new gt(i[0],i[1],i[2],e)}function t1(i,e){const t=e1(i,e),n=t.x*t.x+t.y*t.y,s=Math.sqrt(n+t.z*t.z);if(n===0){if(t.z===0)throw"Indeterminate sky coordinates";return new Ic(0,t.z<0?-90:90,s,t)}let r=Bu*Math.atan2(t.y,t.x);r<0&&(r+=24);const a=Wn*Math.atan2(i[2],Math.sqrt(n));return new Ic(r,a,s,t)}function _a(i,e){const t=i*it,n=Math.cos(t),s=Math.sin(t);return[n*e[0]+s*e[1],n*e[1]-s*e[0],e[2]]}function Xu(i,e,t,n,s){let r=Zt(i);ol(e),yt(t),yt(n);const a=Math.sin(e.latitude*it),o=Math.cos(e.latitude*it),l=Math.sin(e.longitude*it),c=Math.cos(e.longitude*it),h=Math.sin(n*it),d=Math.cos(n*it),u=Math.sin(t*wc),m=Math.cos(t*wc);let _=[o*c,o*l,a],S=[-a*c,-a*l,o],g=[l,-c,0];const f=-15*Vu(r);let A=_a(f,_),w=_a(f,S),M=_a(f,g),T=[d*m,d*u,h];const E=T[0]*A[0]+T[1]*A[1]+T[2]*A[2],R=T[0]*w[0]+T[1]*w[1]+T[2]*w[2],x=T[0]*M[0]+T[1]*M[1]+T[2]*M[2];let b=Math.hypot(R,x),D;b>0?(D=-Wn*Math.atan2(x,R),D<0&&(D+=360)):D=0;let C=Wn*Math.atan2(b,E),N=t,Y=n;{let K=C,O=E1(s,90-C);if(C-=O,O>0&&C>3e-4){const W=Math.sin(C*it),V=Math.cos(C*it),Q=Math.sin(K*it),te=Math.cos(K*it),ee=[];for(let se=0;se<3;++se)ee.push((T[se]-te*A[se])/Q*W+A[se]*V);b=Math.hypot(ee[0],ee[1]),b>0?(N=Bu*Math.atan2(ee[1],ee[0]),N<0&&(N+=24)):N=0,Y=Wn*Math.atan2(ee[2],b)}}return new Q_(D,90-C,N,Y)}function ol(i){if(!(i instanceof qu))throw`Not an instance of the Observer class: ${i}`;if(yt(i.latitude),yt(i.longitude),yt(i.height),i.latitude<-90||i.latitude>90)throw`Latitude ${i.latitude} is out of range. Must be -90..+90.`;return i}class qu{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,ol(this)}}function n1(i,e,t,n,s){ol(t),Sr(n),Sr(s);const r=Zt(e),a=Z_(r,t),o=zo(i,r,s),l=[o.x-a[0],o.y-a[1],o.z-a[2]],c=Wu(l,r,$t.From2000);return t1(c,r)}function i1(i,e,t){const n=i.x,s=i.y*e+i.z*t,r=-i.y*t+i.z*e,a=Math.hypot(n,s);let o=0;a>0&&(o=Wn*Math.atan2(s,n),o<0&&(o+=360));let l=Wn*Math.atan2(r,a),c=new gt(n,s,r,i.t);return new j_(c,l,o)}function Po(i){const e=al(i.t),t=[i.x,i.y,i.z],n=yr(t,i.t,$t.From2000),[s,r,a]=Co(n,i.t,$t.From2000),o=new gt(s,r,a,i.t),l=e.tobl*it;return i1(o,Math.cos(l),Math.sin(l))}function Vi(i){const e=Zt(i),t=X_(e),n=t.distance_au*Math.cos(t.geo_eclip_lat),s=[n*Math.cos(t.geo_eclip_lon),n*Math.sin(t.geo_eclip_lon),t.distance_au*Math.sin(t.geo_eclip_lat)],r=W_(e,s),a=yr(r,e,$t.Into2000);return new gt(a[0],a[1],a[2],e)}function Yu(i){const e=Zt(i),t=1e-5,n=e.AddDays(-t),s=e.AddDays(+t),r=Vi(n),a=Vi(s);return new Hn((r.x+a.x)/2,(r.y+a.y)/2,(r.z+a.z)/2,(a.x-r.x)/(2*t),(a.y-r.y)/(2*t),(a.z-r.z)/(2*t),e)}function s1(i){const e=Zt(i),t=Yu(e),n=1+Gu;return new Hn(t.x/n,t.y/n,t.z/n,t.vx/n,t.vy/n,t.vz/n,e)}function Bi(i,e,t){let n=1,s=0;for(let r of i){let a=0;for(let[l,c,h]of r)a+=l*Math.cos(c+e*h);let o=n*a;t&&(o%=Mn),s+=o,n*=e}return s}function xa(i,e){let t=1,n=0,s=0,r=0;for(let a of i){let o=0,l=0;for(let[c,h,d]of a){let u=h+e*d;o+=c*d*Math.sin(u),r>0&&(l+=c*Math.cos(u))}s+=r*n*l-t*o,n=t,t*=e,++r}return s}const os=365250,Io=0,Do=1,Lo=2;function Uo(i){return new wt(i[0]+44036e-11*i[1]-190919e-12*i[2],-479966e-12*i[0]+.917482137087*i[1]-.397776982902*i[2],.397776982902*i[1]+.917482137087*i[2])}function Ku(i,e,t){const n=t*Math.cos(e),s=Math.cos(i),r=Math.sin(i);return[n*s,n*r,t*Math.sin(e)]}function cs(i,e){const t=e.tt/os,n=Bi(i[Io],t,!0),s=Bi(i[Do],t,!1),r=Bi(i[Lo],t,!1),a=Ku(n,s,r);return Uo(a).ToAstroVector(e)}function No(i,e){const t=e/os,n=Bi(i[Io],t,!0),s=Bi(i[Do],t,!1),r=Bi(i[Lo],t,!1),a=xa(i[Io],t),o=xa(i[Do],t),l=xa(i[Lo],t),c=Math.cos(n),h=Math.sin(n),d=Math.cos(s),u=Math.sin(s),m=+(l*d*c)-r*u*c*o-r*d*h*a,_=+(l*d*h)-r*u*h*o+r*d*c*a,S=+(l*u)+r*d*o,g=Ku(n,s,r),f=[m/os,_/os,S/os],A=Uo(g),w=Uo(f);return new li(e,A,w)}function js(i,e,t,n){const s=n/(n+sl),r=cs(bn[t],e);i.x+=s*r.x,i.y+=s*r.y,i.z+=s*r.z}function r1(i){const e=new gt(0,0,0,i);return js(e,i,ye.Jupiter,To),js(e,i,ye.Saturn,Ao),js(e,i,ye.Uranus,wo),js(e,i,ye.Neptune,Ro),e}const Fo=51,a1=29200,Li=146,Sn=201,ii=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]];class wt{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new wt(this.x,this.y,this.z)}ToAstroVector(e){return new gt(this.x,this.y,this.z,e)}static zero(){return new wt(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(e){return new wt(this.x+e.x,this.y+e.y,this.z+e.z)}sub(e){return new wt(this.x-e.x,this.y-e.y,this.z-e.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(e){return new wt(e*this.x,e*this.y,e*this.z)}div(e){return new wt(this.x/e,this.y/e,this.z/e)}mean(e){return new wt((this.x+e.x)/2,(this.y+e.y)/2,(this.z+e.z)/2)}neg(){return new wt(-this.x,-this.y,-this.z)}}class li{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new li(this.tt,this.r,this.v)}sub(e){return new li(this.tt,this.r.sub(e.r),this.v.sub(e.v))}}function o1(i){let[e,[t,n,s],[r,a,o]]=i;return new li(e,new wt(t,n,s),new wt(r,a,o))}function er(i,e,t,n){const s=n/(n+sl),r=No(bn[t],e);return i.r.incr(r.r.mul(s)),i.v.incr(r.v.mul(s)),r}function is(i,e,t){const n=t.sub(i),s=n.quadrature();return n.mul(e/(s*Math.sqrt(s)))}class Lr{constructor(e){let t=new li(e,new wt(0,0,0),new wt(0,0,0));this.Jupiter=er(t,e,ye.Jupiter,To),this.Saturn=er(t,e,ye.Saturn,Ao),this.Uranus=er(t,e,ye.Uranus,wo),this.Neptune=er(t,e,ye.Neptune,Ro),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new li(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=is(e,sl,this.Sun.r);return t.incr(is(e,To,this.Jupiter.r)),t.incr(is(e,Ao,this.Saturn.r)),t.incr(is(e,wo,this.Uranus.r)),t.incr(is(e,Ro,this.Neptune.r)),t}}class Ur{constructor(e,t,n,s){this.tt=e,this.r=t,this.v=n,this.a=s}clone(){return new Ur(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}}class $u{constructor(e,t){this.bary=e,this.grav=t}}function br(i,e,t,n){return new wt(e.x+i*(t.x+i*n.x/2),e.y+i*(t.y+i*n.y/2),e.z+i*(t.z+i*n.z/2))}function Dc(i,e,t){return new wt(e.x+i*t.x,e.y+i*t.y,e.z+i*t.z)}function Oo(i,e){const t=i-e.tt,n=new Lr(i),s=br(t,e.r,e.v,e.a),r=n.Acceleration(s).mean(e.a),a=br(t,e.r,e.v,r),o=e.v.add(r.mul(t)),l=n.Acceleration(a),c=new Ur(i,a,o,l);return new $u(n,c)}const l1=[];function Zu(i,e){const t=Math.floor(i);return t<0?0:t>=e?e-1:t}function Bo(i){const e=o1(i),t=new Lr(e.tt),n=e.r.add(t.Sun.r),s=e.v.add(t.Sun.v),r=t.Acceleration(n),a=new Ur(e.tt,n,s,r);return new $u(t,a)}function c1(i,e){const t=ii[0][0];if(e<t||e>ii[Fo-1][0])return null;const n=Zu((e-t)/a1,Fo-1);if(!i[n]){const r=i[n]=[];r[0]=Bo(ii[n]).grav,r[Sn-1]=Bo(ii[n+1]).grav;let a,o=r[0].tt;for(a=1;a<Sn-1;++a)r[a]=Oo(o+=Li,r[a-1]).grav;o=r[Sn-1].tt;var s=[];for(s[Sn-1]=r[Sn-1],a=Sn-2;a>0;--a)s[a]=Oo(o-=Li,s[a+1]).grav;for(a=Sn-2;a>0;--a){const l=a/(Sn-1);r[a].r=r[a].r.mul(1-l).add(s[a].r.mul(l)),r[a].v=r[a].v.mul(1-l).add(s[a].v.mul(l)),r[a].a=r[a].a.mul(1-l).add(s[a].a.mul(l))}}return i[n]}function Lc(i,e,t){let n=Bo(i);const s=Math.ceil((e-n.grav.tt)/t);for(let r=0;r<s;++r)n=Oo(r+1===s?e:n.grav.tt+t,n.grav);return n}function Ju(i,e){let t,n,s;const r=c1(l1,i.tt);if(r){const a=Zu((i.tt-r[0].tt)/Li,Sn-1),o=r[a],l=r[a+1],c=o.a.mean(l.a),h=br(i.tt-o.tt,o.r,o.v,c),d=Dc(i.tt-o.tt,o.v,c),u=br(i.tt-l.tt,l.r,l.v,c),m=Dc(i.tt-l.tt,l.v,c),_=(i.tt-o.tt)/Li;t=h.mul(1-_).add(u.mul(_)),n=d.mul(1-_).add(m.mul(_))}else{let a;i.tt<ii[0][0]?a=Lc(ii[0],i.tt,-Li):a=Lc(ii[Fo-1],i.tt,+Li),t=a.grav.r,n=a.grav.v,s=a.bary}return s||(s=new Lr(i.tt)),t=t.sub(s.Sun.r),n=n.sub(s.Sun.v),new Hn(t.x,t.y,t.z,n.x,n.y,n.z,i)}function si(i,e){var t=Zt(e);if(i in bn)return cs(bn[i],t);if(i===ye.Pluto){const a=Ju(t);return new gt(a.x,a.y,a.z,t)}if(i===ye.Sun)return new gt(0,0,0,t);if(i===ye.Moon){var n=cs(bn.Earth,t),s=Vi(t);return new gt(n.x+s.x,n.y+s.y,n.z+s.z,t)}if(i===ye.EMB){const a=cs(bn.Earth,t),o=Vi(t),l=1+Gu;return new gt(a.x+o.x/l,a.y+o.y/l,a.z+o.z/l,t)}if(i===ye.SSB)return r1(t);const r=rl(i);if(r){const a=new J_(r.dec,15*r.ra,r.dist);return y1(a,t)}throw`HelioVector: Unknown body "${i}"`}function u1(i,e){let t=e,n=0;for(let s=0;s<10;++s){const r=i(t),a=r.Length()/Ou;if(a>1)throw"Object is too distant for light-travel solver.";const o=e.AddDays(-a);if(n=Math.abs(o.tt-t.tt),n<1e-9)return r;t=o}throw`Light-travel time solver did not converge: dt = ${n}`}class h1{constructor(e,t,n,s){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=s}Position(e){this.aberration&&(this.observerPos=si(this.observerBody,e));const t=si(this.targetBody,e);return new gt(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}}function d1(i,e,t,n){Sr(n);const s=Zt(i);if(rl(t)){const o=si(t,s);if(n){const c=p1(e,s),h=new gt(o.x-c.x,o.y-c.y,o.z-c.z,s),d=Ou/h.Length();return new gt(h.x+c.vx/d,h.y+c.vy/d,h.z+c.vz/d,s)}const l=si(e,s);return new gt(o.x-l.x,o.y-l.y,o.z-l.z,s)}let r;n?r=new gt(0,0,0,s):r=si(e,s);const a=new h1(e,t,n,r);return u1(o=>a.Position(o),s)}function zo(i,e,t){Sr(t);const n=Zt(e);switch(i){case ye.Earth:return new gt(0,0,0,n);case ye.Moon:return Vi(n);default:const s=d1(n,ye.Earth,i,t);return s.t=n,s}}function f1(i,e){return new Hn(i.r.x,i.r.y,i.r.z,i.v.x,i.v.y,i.v.z,e)}function p1(i,e){const t=Zt(e);switch(i){case ye.Sun:return new Hn(0,0,0,0,0,0,t);case ye.SSB:const n=new Lr(t.tt);return new Hn(-n.Sun.r.x,-n.Sun.r.y,-n.Sun.r.z,-n.Sun.v.x,-n.Sun.v.y,-n.Sun.v.z,t);case ye.Mercury:case ye.Venus:case ye.Earth:case ye.Mars:case ye.Jupiter:case ye.Saturn:case ye.Uranus:case ye.Neptune:const s=No(bn[i],t.tt);return f1(s,t);case ye.Pluto:return Ju(t);case ye.Moon:case ye.EMB:const r=No(bn.Earth,t.tt),a=i==ye.Moon?Yu(t):s1(t);return new Hn(a.x+r.r.x,a.y+r.r.y,a.z+r.r.z,a.vx+r.v.x,a.vy+r.v.y,a.vz+r.v.z,t);default:if(rl(i)){const o=si(i,t);return new Hn(o.x,o.y,o.z,0,0,0,t)}throw`HelioState: Unsupported body "${i}"`}}function m1(i){for(;i<0;)i+=360;for(;i>=360;)i-=360;return i}function g1(i,e,t){if(i===ye.Earth||e===ye.Earth)throw"The Earth does not have a longitude as seen from itself.";const n=Zt(t),s=zo(i,n,!1),r=Po(s),a=zo(e,n,!1),o=Po(a);return m1(r.elon-o.elon)}function _1(i,e,t,n){let s,r=0,a=0,o=0;switch(i){case ye.Mercury:s=-.6,r=4.98,a=-4.88,o=3.02;break;case ye.Venus:e<163.6?(s=-4.47,r=1.03,a=.57,o=.13):(s=.98,r=-1.02);break;case ye.Mars:s=-1.52,r=1.6;break;case ye.Jupiter:s=-9.4,r=.5;break;case ye.Uranus:s=-7.19,r=.25;break;case ye.Neptune:s=-6.87;break;case ye.Pluto:s=-1,r=4;break;default:throw`VisualMagnitude: unsupported body ${i}`}const l=e/100;let c=s+l*(r+l*(a+l*o));return c+=5*Math.log10(t*n),c}function x1(i,e,t,n,s){const r=Po(n),a=it*28.06,o=it*(169.51+382e-7*s.tt),l=it*r.elat,c=it*r.elon,h=Math.asin(Math.sin(l)*Math.cos(a)-Math.cos(l)*Math.sin(a)*Math.sin(c-o)),d=Math.sin(Math.abs(h));let u=-9+.044*i;return u+=d*(-2.6+1.2*d),u+=5*Math.log10(e*t),{mag:u,ring_tilt:Wn*h}}function v1(i,e,t){let n=i*it,s=n*n,r=s*s,a=-12.717+1.49*Math.abs(n)+.0431*r;const o=385000.6/ei;let l=t/o;return a+=5*Math.log10(e*l),a}class M1{constructor(e,t,n,s,r,a,o,l){this.time=e,this.mag=t,this.phase_angle=n,this.helio_dist=s,this.geo_dist=r,this.gc=a,this.hc=o,this.ring_tilt=l,this.phase_fraction=(1+Math.cos(it*n))/2}}function Qu(i,e){if(i===ye.Earth)throw"The illumination of the Earth is not defined.";const t=Zt(e),n=cs(bn.Earth,t);let s,r,a,o;i===ye.Sun?(a=new gt(-n.x,-n.y,-n.z,t),r=new gt(0,0,0,t),s=0):(i===ye.Moon?(a=Vi(t),r=new gt(n.x+a.x,n.y+a.y,n.z+a.z,t)):(r=si(i,e),a=new gt(r.x-n.x,r.y-n.y,r.z-n.z,t)),s=F_(a,r));let l=a.Length(),c=r.Length(),h;if(i===ye.Sun)o=L_+5*Math.log10(l);else if(i===ye.Moon)o=v1(s,c,l);else if(i===ye.Saturn){const d=x1(s,c,l,a,t);o=d.mag,h=d.ring_tilt}else o=_1(i,s,c,l);return new M1(t,o,s,c,l,a,r,h)}function S1(i){return g1(ye.Moon,ye.Sun,i)}var Uc;(function(i){i[i.Pericenter=0]="Pericenter",i[i.Apocenter=1]="Apocenter"})(Uc||(Uc={}));function y1(i,e){e=Zt(e);const t=i.lat*it,n=i.lon*it,s=i.dist*Math.cos(t);return new gt(s*Math.cos(n),s*Math.sin(n),i.dist*Math.sin(t),e)}function E1(i,e){let t;if(yt(e),e<-90||e>90)return 0;{let n=e;n<-1&&(n=-1),t=1.02/Math.tan((n+10.3/(n+5.11))*it)/60,e<-1&&(t*=(e+90)/89)}return t}var Nc;(function(i){i.Penumbral="penumbral",i.Partial="partial",i.Annular="annular",i.Total="total"})(Nc||(Nc={}));var Fc;(function(i){i[i.Invalid=0]="Invalid",i[i.Ascending=1]="Ascending",i[i.Descending=-1]="Descending"})(Fc||(Fc={}));const b1=["Venus","Mars","Jupiter","Saturn"];function ju(i){return new qu(i.lat,i.lng,i.elevationM)}function T1(i,e,t,n){const s=Xu(t,ju(n),i,e,"normal");return{altitudeDeg:s.altitude,azimuthDeg:s.azimuth}}function va(i,e,t){const n=ju(t),s=n1(ye[i],e,n,!0,!0),r=Xu(e,n,s.ra,s.dec,"normal");return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}function Ma(i,e){return Qu(ye[i],e).mag}function A1(i){const e=S1(i),t=Qu(ye.Moon,i);return{phaseFraction:e/360,illuminatedFraction:t.phase_fraction}}const w1=2e3,R1=3,C1=20;function P1(i,e){if(i.year===void 0&&i.month===void 0&&i.day===void 0&&i.hour===void 0)return;const t=i.year!==void 0,n=i.year??w1,s=i.month??(t?1:R1),r=i.day??(t?1:C1),a=Math.round(e/15);return new Date(Date.UTC(n,s-1,r,(i.hour??12)-a,i.minute??0,i.second??0))}const tr=900,I1=900,D1=850,Oc=850,Sa=4,L1=1.5,U1=-1,N1=6,Bc=-4,F1=[{azimuthDeg:0,label:"N"},{azimuthDeg:45,label:"NE"},{azimuthDeg:90,label:"E"},{azimuthDeg:135,label:"SE"},{azimuthDeg:180,label:"S"},{azimuthDeg:225,label:"SO"},{azimuthDeg:270,label:"O"},{azimuthDeg:315,label:"NO"}],O1=880,zc=40,B1={Venus:new Oe(1,.96,.85),Mars:new Oe(1,.55,.4),Jupiter:new Oe(.95,.87,.72),Saturn:new Oe(.92,.86,.68)};class z1{renderer;scene=new W0;camera;skyMesh;groundMesh;starTiers=[];bodyMeshes=new Map;hitAreas=new Map;glareSprites=new Map;compassSprites=[];showCompass=!1;animationFrameId=null;raycaster=new dd;constructor(e){this.renderer=new c_({canvas:e,antialias:!0}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),this.camera=new Xt(60,e.width/Math.max(e.height,1),.1,tr*1.2),this.camera.position.set(0,1.6,0)}resize(e,t){this.renderer.setSize(e,t,!1),this.camera.aspect=e/Math.max(t,1),this.camera.updateProjectionMatrix(),this.render()}setObserverPose(e){e.headingDeg!==void 0?this.camera.rotation.set(e.pitchDeg*ya,-e.headingDeg*ya,0,"YXZ"):this.camera.rotation.set(e.pitchDeg*ya,this.camera.rotation.y,0,"YXZ"),this.camera.position.y=1.6+e.elevationM,this.camera.fov!==e.fovDeg&&(this.camera.fov=e.fovDeg,this.camera.updateProjectionMatrix())}setShowCompass(e){this.showCompass!==e&&(this.showCompass=e,this.disposeCompassLabels(),e&&this.buildCompassLabels(),this.render())}setAstronomy(e){const t=Nu(e.sun.altitudeDeg).horizon;this.buildSky(e.sun),this.buildGround(t),this.buildStars(e.stars,e.sun.altitudeDeg),this.setBodyMesh("sun",e.sun,Sa,new Oe(1,.96,.88),e.sun.magnitude),this.setMoonMesh(e.moon),this.buildPlanets(e.planets),this.scene.fog=new el(new Oe(...t),tr*.2,tr),this.render()}render(){this.renderer.render(this.scene,this.camera)}pickBodyAt(e,t){this.raycaster.setFromCamera(new ke(e,t),this.camera);const n=[...this.hitAreas.entries()],s=this.raycaster.intersectObjects(n.map(([,r])=>r))[0];if(s)return n.find(([,r])=>r===s.object)?.[0]}dispose(){this.stopTwinkle(),this.disposeMesh(this.skyMesh),this.disposeMesh(this.groundMesh),this.disposeStarTiers();for(const e of this.bodyMeshes.values())this.disposeMesh(e);this.bodyMeshes.clear();for(const e of[...this.hitAreas.keys()])this.disposeHitArea(e);for(const e of[...this.glareSprites.keys()])this.disposeGlare(e);this.disposeCompassLabels(),this.renderer.dispose()}startTwinkle(){if(this.animationFrameId!==null||this.starTiers.length===0)return;const e=t=>{this.updateTwinkle(t/1e3),this.render(),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}stopTwinkle(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}buildSky(e){this.disposeMesh(this.skyMesh);const t=new vr(tr,32,16),n=t.attributes.position,s=[];for(let a=0;a<n.count;a++){const{altitudeDeg:o,azimuthDeg:l}=f_(n.getX(a),n.getY(a),n.getZ(a)),c=g_(o,l,e.azimuthDeg,e.altitudeDeg);s.push(c[0],c[1],c[2])}t.setAttribute("color",new Pt(s,3));const r=new ls({vertexColors:!0,side:Lt,fog:!1});this.skyMesh=new Kt(t,r),this.scene.add(this.skyMesh)}buildGround(e){this.disposeMesh(this.groundMesh);const t=new il(I1,48),n=new Oe(e[0]*.35,e[1]*.35,e[2]*.35),s=new ls({color:n,fog:!0});this.groundMesh=new Kt(t,s),this.groundMesh.rotation.x=-Math.PI/2,this.groundMesh.position.y=-.5,this.scene.add(this.groundMesh)}setBodyMesh(e,t,n,s,r){if(this.disposeMesh(this.bodyMeshes.get(e)),this.disposeHitArea(e),this.disposeGlare(e),t.altitudeDeg<Bc){this.bodyMeshes.delete(e);return}const{x:a,y:o,z:l}=Zs(t.altitudeDeg,t.azimuthDeg,Oc),c=Tc(t.altitudeDeg),h=new Oe(s.r*c[0],s.g*c[1],s.b*c[2]),d=new vr(n,16,16),u=new ls({color:h,fog:!1}),m=new Kt(d,u);m.position.set(a,o,l),this.scene.add(m),this.bodyMeshes.set(e,m),this.setHitArea(e,a,o,l,n),this.setGlare(e,a,o,l,r,h)}setMoonMesh(e){const t="moon";if(this.disposeMesh(this.bodyMeshes.get(t)),this.disposeHitArea(t),this.disposeGlare(t),e.altitudeDeg<Bc){this.bodyMeshes.delete(t);return}const{x:n,y:s,z:r}=Zs(e.altitudeDeg,e.azimuthDeg,Oc),a=Tc(e.altitudeDeg),o=new Oe(a[0],a[1],a[2]),l=new rs({map:H1(e.phase),color:o,fog:!1}),c=new Ds(l);c.position.set(n,s,r);const h=Sa*2;c.scale.set(h,h,1),this.scene.add(c),this.bodyMeshes.set(t,c),this.setHitArea(t,n,s,r,Sa),this.setGlare(t,n,s,r,e.magnitude,o)}setHitArea(e,t,n,s,r){const a=new rs({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1}),o=new Ds(a);o.position.set(t,n,s);const l=r*N1;o.scale.set(l,l,1),this.scene.add(o),this.hitAreas.set(e,o)}disposeHitArea(e){const t=this.hitAreas.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.hitAreas.delete(e))}setGlare(e,t,n,s,r,a){this.disposeGlare(e);const o=x_(r);if(o<=0)return;const l=S_(o),c=new rs({map:k1(),color:a,transparent:!0,opacity:b_(o),blending:wa,depthWrite:!1,fog:!1}),h=new Ds(c);h.position.set(t,n,s),h.scale.set(l*2,l*2,1),this.scene.add(h),this.glareSprites.set(e,h)}disposeGlare(e){const t=this.glareSprites.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.glareSprites.delete(e))}buildPlanets(e){const t=new Set(["sun","moon"]);for(const n of e){t.add(n.body);const s=Ec(n.magnitude),r=bc(s),a=B1[n.body]??new Oe(1,1,1),o=new Oe(a.r*r,a.g*r,a.b*r),l=L1*(.5+.5*s);this.setBodyMesh(n.body,n.position,l,o,n.magnitude)}for(const n of[...this.bodyMeshes.keys()])t.has(n)||(this.disposeMesh(this.bodyMeshes.get(n)),this.bodyMeshes.delete(n),this.disposeHitArea(n),this.disposeGlare(n))}buildStars(e,t){if(this.disposeStarTiers(),!e||e.catalog.count===0){this.stopTwinkle();return}const{catalog:n,date:s,observer:r}=e,a=u_(t),o=W1(1337),l=[];for(let c=0;c<n.count;c++){const h=n.mag[c];if(h>a)continue;const{altitudeDeg:d,azimuthDeg:u}=T1(n.ra[c],n.dec[c],s,r);if(d<U1)continue;const{x:m,y:_,z:S}=Zs(d,u,D1);l.push({x:m,y:_,z:S,brightness:Ec(h),phase:o()*Math.PI*2,speedFactor:.7+o()*.6})}this.starTiers=Fu.map((c,h)=>{const d=l.filter(M=>A_(M.brightness)===h),u=new Float32Array(d.length*3),m=new Float32Array(d.length),_=new Float32Array(d.length),S=new Float32Array(d.length);d.forEach((M,T)=>{u[T*3]=M.x,u[T*3+1]=M.y,u[T*3+2]=M.z,m[T]=M.brightness,_[T]=M.phase,S[T]=M.speedFactor});const g=new Ft;g.setAttribute("position",new Gt(u,3));const f=new Gt(new Float32Array(d.length*3),3);g.setAttribute("color",f);const A=new Mu({vertexColors:!0,size:c.size,sizeAttenuation:!1,fog:!1}),w=new td(g,A);return this.scene.add(w),{points:w,colorAttribute:f,brightness:m,phase:_,speedFactor:S}}),this.updateTwinkle(0),this.startTwinkle()}updateTwinkle(e){for(const t of this.starTiers){const n=t.colorAttribute.array;for(let s=0;s<t.brightness.length;s++){const r=C_(t.brightness[s],{phase:t.phase[s],speedFactor:t.speedFactor[s]},e),a=bc(t.brightness[s])*r;n[s*3]=a,n[s*3+1]=a,n[s*3+2]=a}t.colorAttribute.needsUpdate=!0}}buildCompassLabels(){this.compassSprites=F1.map(({azimuthDeg:e,label:t})=>{const n=new rs({map:V1(t),depthTest:!1,fog:!1}),s=new Ds(n),{x:r,y:a,z:o}=Zs(0,e,O1);return s.position.set(r,a,o),s.scale.set(zc,zc,1),this.scene.add(s),s})}disposeCompassLabels(){for(const e of this.compassSprites)this.scene.remove(e),e.material.map?.dispose(),e.material.dispose();this.compassSprites=[]}disposeStarTiers(){for(const e of this.starTiers)this.disposeMesh(e.points);this.starTiers=[]}disposeMesh(e){if(!e)return;this.scene.remove(e),"geometry"in e&&e.geometry.dispose();const t=e.material;Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose()}}const ya=Math.PI/180;function G1(i,e,t){return Math.max(e,Math.min(t,i))}let nr;function k1(){if(nr)return nr;const i=128,e=document.createElement("canvas");e.width=i,e.height=i;const t=e.getContext("2d"),n=t.createRadialGradient(i/2,i/2,0,i/2,i/2,i/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.4,"rgba(255,255,255,0.35)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,i,i),nr=new nl(e),nr}function H1(i){const t=document.createElement("canvas");t.width=128,t.height=128;const n=t.getContext("2d"),s=128/2-2,r=128/2,a=128/2,o="#2e2b26",l="#f4f1e2";n.fillStyle=o,n.beginPath(),n.arc(r,a,s,0,Math.PI*2),n.fill();const c=G1(i.illuminatedFraction,0,1),h=i.phaseFraction<.5,d=s*Math.abs(1-2*c),u=c<.5;return n.save(),n.beginPath(),n.arc(r,a,s,0,Math.PI*2),n.clip(),n.fillStyle=l,n.beginPath(),h?(n.arc(r,a,s,-Math.PI/2,Math.PI/2,!1),n.ellipse(r,a,d,s,0,Math.PI/2,-Math.PI/2,u)):(n.arc(r,a,s,Math.PI/2,-Math.PI/2,!1),n.ellipse(r,a,d,s,0,-Math.PI/2,Math.PI/2,u)),n.fill(),n.restore(),new nl(t)}function V1(i){const e=document.createElement("canvas");e.width=128,e.height=128;const t=e.getContext("2d");return t.fillStyle="rgba(0, 0, 0, 0.55)",t.beginPath(),t.arc(64,64,60,0,Math.PI*2),t.fill(),t.fillStyle="#ffffff",t.font="bold 52px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(i,64,68),new nl(e)}function W1(i){let e=i;return function(){e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const Gc=new Map;function X1(i){const e=i.byteLength/(4*Float32Array.BYTES_PER_ELEMENT),t=e,n=t*Float32Array.BYTES_PER_ELEMENT;return{count:e,ra:new Float32Array(i,0*n,t),dec:new Float32Array(i,1*n,t),mag:new Float32Array(i,2*n,t),ci:new Float32Array(i,3*n,t)}}function q1(i){let e=Gc.get(i);return e||(e=fetch(i).then(t=>t.arrayBuffer()).then(X1),Gc.set(i,e)),e}wr();const Y1={sun:{en:"Sun",fr:"Soleil"},moon:{en:"Moon",fr:"Lune"},Venus:{en:"Venus",fr:"Vénus"},Mars:{en:"Mars",fr:"Mars"},Jupiter:{en:"Jupiter",fr:"Jupiter"},Saturn:{en:"Saturn",fr:"Saturne"}},K1=["en","fr"],$1=new URL(""+new URL("assets/stars-mag7.5-DDr9QasD.bin",import.meta.url).href,import.meta.url).href,Z1={sun:{altitudeDeg:-3,azimuthDeg:180,magnitude:-26.7},moon:{altitudeDeg:-90,azimuthDeg:0,phase:{phaseFraction:0,illuminatedFraction:0},magnitude:-12.7},planets:[]},Ea={lat:0,lng:0,elevationM:0,headingDeg:void 0,pitchDeg:0,fovDeg:60};class J1 extends HTMLElement{static get observedAttributes(){return["src","star-catalog-src","show-compass"]}shadow;stageElement;frameElement;sceneCanvas;ufoElement;sceneRenderer;bodyTooltip;resizeObserver;lastTimeMs=0;starCatalog;handleFullscreenChange=()=>this.resizeToStage();handlePointerMove=e=>{const n=this.ufoElement.canvasElement.getBoundingClientRect();if(n.width===0||n.height===0)return;const s=(e.clientX-n.left)/n.width*2-1,r=-((e.clientY-n.top)/n.height*2-1),a=this.sceneRenderer.pickBodyAt(s,r);if(!a){this.bodyTooltip.hidden=!0;return}const o=Ho(navigator.languages,K1);this.bodyTooltip.textContent=Y1[a]?.[o]??a,this.bodyTooltip.hidden=!1;const l=this.stageElement.getBoundingClientRect();this.bodyTooltip.style.left=`${e.clientX-l.left+12}px`,this.bodyTooltip.style.top=`${e.clientY-l.top+12}px`};handlePointerLeave=()=>{this.bodyTooltip.hidden=!0};handleTimeUpdate=e=>{this.lastTimeMs=e.detail.time,this.updateAstronomy(this.lastTimeMs)};constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${Yh}</style>${qh}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.frameElement=this.shadow.getElementById("frame"),this.sceneCanvas=this.shadow.getElementById("scene-canvas"),this.sceneRenderer=new z1(this.sceneCanvas),this.bodyTooltip=this.shadow.getElementById("body-tooltip"),this.ufoElement=document.createElement(Aa),this.ufoElement.classList.add("ufo-overlay"),this.ufoElement.style.setProperty("--ufo-canvas-background","transparent"),this.ufoElement.style.setProperty("--ufo-canvas-border","none"),this.ufoElement.fullscreenTarget=this.stageElement,this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.ufoElement.addEventListener("timeupdate",this.handleTimeUpdate),this.ufoElement.canvasElement.addEventListener("pointermove",this.handlePointerMove),this.ufoElement.canvasElement.addEventListener("pointerleave",this.handlePointerLeave)}connectedCallback(){this.resizeToStage(),this.updateAstronomy(this.lastTimeMs),this.loadStars(),this.resizeObserver=new ResizeObserver(()=>this.resizeToStage()),this.resizeObserver.observe(this.frameElement),document.addEventListener("fullscreenchange",this.handleFullscreenChange);const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){this.resizeObserver?.disconnect(),document.removeEventListener("fullscreenchange",this.handleFullscreenChange),this.sceneRenderer.stopTwinkle()}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),e==="star-catalog-src"&&n!==t&&this.isConnected&&this.loadStars(),e==="show-compass"&&n!==t&&this.sceneRenderer.setShowCompass(this.hasAttribute("show-compass"))}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.ufoElement.sightingData=e,this.lastTimeMs=0,this.updateAstronomy(0)}resizeToStage(){const e=this.frameElement.getBoundingClientRect(),t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height));this.sceneCanvas.width=t,this.sceneCanvas.height=n,this.sceneRenderer.resize(t,n)}async loadStars(){const e=this.getAttribute("star-catalog-src")??$1;this.starCatalog=await q1(e),this.updateAstronomy(this.lastTimeMs)}updateAstronomy(e){const t=this.ufoElement.sighting,n=wh(t,e);this.sceneRenderer.setObserverPose(n??Ea);const s=n?.lat??Ea.lat,r=n?.lng??Ea.lng,a=P1(t.event.time??{},r);if(!a){this.sceneRenderer.setAstronomy(Z1);return}const o=new Date(a.getTime()+e),l={lat:s,lng:r,elevationM:n?.elevationM??0},c={...va("Sun",o,l),magnitude:Ma("Sun",o)},h={...va("Moon",o,l),phase:A1(o),magnitude:Ma("Moon",o)},d=b1.map(u=>({body:u,position:va(u,o,l),magnitude:Ma(u,o)}));this.sceneRenderer.setAstronomy({sun:c,moon:h,planets:d,stars:this.starCatalog?{catalog:this.starCatalog,date:o,observer:l}:void 0})}}const Go="rr0-scene";function Q1(){wr(),customElements.get(Go)||customElements.define(Go,J1)}class j1{constructor(e,t){this.timeline=e,this.clock=t}currentPointer=null;shapePrototype=null;sourceId="";start(e,t){this.sourceId=e,this.shapePrototype=t,this.currentPointer=null,this.clock.start(n=>this.recordSample(n))}onPointerMove(e,t){this.currentPointer={x:e,y:t}}stop(){this.clock.stop()}recordSample(e){if(!this.currentPointer||!this.shapePrototype)return;const t=Xc(this.shapePrototype,this.currentPointer.x,this.currentPointer.y);this.timeline.addKeyframe(e,[{sourceId:this.sourceId,shape:t}])}}class ex{constructor(e){this.intervalMs=e}rafId=null;startTime=0;lastTick=0;start(e){this.startTime=performance.now(),this.lastTick=0;const t=()=>{const n=performance.now()-this.startTime;n-this.lastTick>=this.intervalMs&&(this.lastTick=n,e(n)),this.rafId=requestAnimationFrame(t)};this.rafId=requestAnimationFrame(t)}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}}const eh={oval:"Oval",saucer:"Saucer",triangle:"Triangle",color:"Color",transparency:"Transparency",halo:"Halo",shape:"Shape",addShape:"Add shape",samplingRate:"Sampling rate (ms)",duration:"Duration (s)",durationPlaceholder:"recording length",export:"Export JSON",record:"Record",stop:"Stop",latitude:"Latitude",longitude:"Longitude",heading:"Heading (°)",headingPlaceholder:"unknown",pitch:"Tilt (°)",observationTime:"Observation start (optional)",yearPlaceholder:"year",monthPlaceholder:"month",dayPlaceholder:"day",hourPlaceholder:"hour",minutePlaceholder:"min"},tx=Object.freeze(Object.defineProperty({__proto__:null,ufoRecorderMessages_en:eh},Symbol.toStringTag,{value:"Module"}));wr();Q1();const Ii={width:48,height:28},kc="ufo-1",Hc=["oval","saucer","triangle"],nx={presetId:"oval",color:"#39ff14",transparency:0,haloScale:1.5};function ix(i){if(i.kind==="oval")return"oval";if(i.points.length===3)return"triangle";if(i.points.length===8)return"saucer"}class sx extends HTMLElement{shadow;sceneElement;ufoElement;recordButton;samplingRateInput;presetButtons;colorInput;transparencyInput;haloScaleInput;sourceSelect;addShapeButton;durationInput;exportButton;latInput;lngInput;headingInput;pitchInput;obsYearInput;obsMonthInput;obsDayInput;obsHourInput;obsMinuteInput;labelColor;labelTransparency;labelHalo;labelShape;labelSamplingRate;labelDuration;labelLatitude;labelLongitude;labelHeading;labelPitch;labelObservationTime;recorder;isRecording=!1;messages=eh;currentAppearance={...nx};currentSourceId=kc;dragState;handleKeyDown=e=>{e.key==="Escape"&&this.isRecording&&this.toggleRecording()};handleDragPointerMove=e=>this.onDragPointerMove(e);handleDragPointerUp=()=>this.endDrag();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${ch}</style>${lh}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.sceneElement=document.createElement(Go),this.sceneElement.setAttribute("show-compass",""),this.ufoElement=this.sceneElement.ufoElement,this.ufoElement.enableClickToPlay=!1,this.shadow.getElementById("ufo-slot").replaceWith(this.sceneElement),this.recordButton=this.shadow.getElementById("record"),this.samplingRateInput=this.shadow.getElementById("samplingRate"),this.presetButtons={oval:this.shadow.getElementById("preset-oval"),saucer:this.shadow.getElementById("preset-saucer"),triangle:this.shadow.getElementById("preset-triangle")},this.colorInput=this.shadow.getElementById("color"),this.transparencyInput=this.shadow.getElementById("transparency"),this.haloScaleInput=this.shadow.getElementById("haloScale"),this.sourceSelect=this.shadow.getElementById("source"),this.addShapeButton=this.shadow.getElementById("add-shape"),this.durationInput=this.shadow.getElementById("durationSeconds"),this.exportButton=this.shadow.getElementById("export"),this.latInput=this.shadow.getElementById("lat"),this.lngInput=this.shadow.getElementById("lng"),this.headingInput=this.shadow.getElementById("heading"),this.pitchInput=this.shadow.getElementById("pitch"),this.obsYearInput=this.shadow.getElementById("obs-year"),this.obsMonthInput=this.shadow.getElementById("obs-month"),this.obsDayInput=this.shadow.getElementById("obs-day"),this.obsHourInput=this.shadow.getElementById("obs-hour"),this.obsMinuteInput=this.shadow.getElementById("obs-minute"),this.labelColor=this.shadow.getElementById("label-color"),this.labelTransparency=this.shadow.getElementById("label-transparency"),this.labelHalo=this.shadow.getElementById("label-halo"),this.labelShape=this.shadow.getElementById("label-shape"),this.labelSamplingRate=this.shadow.getElementById("label-sampling-rate"),this.labelDuration=this.shadow.getElementById("label-duration"),this.labelLatitude=this.shadow.getElementById("label-lat"),this.labelLongitude=this.shadow.getElementById("label-lng"),this.labelHeading=this.shadow.getElementById("label-heading"),this.labelPitch=this.shadow.getElementById("label-pitch"),this.labelObservationTime=this.shadow.getElementById("label-observation-time"),this.ufoElement.canvasElement.addEventListener("pointerdown",t=>this.onPointerDown(t)),this.ufoElement.canvasElement.addEventListener("pointermove",t=>this.onPointerMove(t)),this.recordButton.addEventListener("click",()=>this.toggleRecording()),this.addShapeButton.addEventListener("click",()=>this.addShape()),this.exportButton.addEventListener("click",()=>this.exportJson()),this.durationInput.addEventListener("input",()=>{this.ufoElement.durationSeconds=this.durationInput.value===""?void 0:Number(this.durationInput.value),this.ufoElement.refresh()}),this.sourceSelect.addEventListener("change",()=>{this.currentSourceId=this.sourceSelect.value,this.onSelectionOrTimeChanged()}),this.ufoElement.addEventListener("timeupdate",()=>{this.onSelectionOrTimeChanged(),this.dispatchEvent(new CustomEvent("sightingchange"))}),document.addEventListener("keydown",this.handleKeyDown);for(const t of Hc)this.presetButtons[t].addEventListener("click",()=>this.setAppearance({presetId:t}));this.colorInput.addEventListener("input",()=>this.setAppearance({color:this.colorInput.value})),this.transparencyInput.addEventListener("input",()=>this.setAppearance({transparency:Number(this.transparencyInput.value)})),this.haloScaleInput.addEventListener("input",()=>this.setAppearance({haloScale:Number(this.haloScaleInput.value)}));for(const t of[this.latInput,this.lngInput,this.headingInput,this.pitchInput])t.addEventListener("input",()=>this.updateObserver());for(const t of[this.obsYearInput,this.obsMonthInput,this.obsDayInput,this.obsHourInput,this.obsMinuteInput])t.addEventListener("input",()=>this.updateObservationTime());this.updatePresetButtons(),this.setRecordButtonLabel(!1),this.applyAppearanceAtPlayhead(),this.refreshSourceList(),this.onSelectionOrTimeChanged(),this.loadLocaleMessages()}disconnectedCallback(){document.removeEventListener("keydown",this.handleKeyDown),this.endDrag()}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.endDrag(),this.ufoElement.sightingData=e,this.currentSourceId=this.ufoElement.sighting.timeline.sourceIds[0]??kc,this.refreshSourceList(),this.onSelectionOrTimeChanged(),this.durationInput.value=this.ufoElement.durationSeconds!==void 0?String(this.ufoElement.durationSeconds):"",this.syncObserverAndTimeFields()}exportJson(){const e=this.sightingData,t=`${e.witnessId??"sighting"}-sighting.json`,n=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),s=URL.createObjectURL(n),r=document.createElement("a");r.href=s,r.download=t,r.click(),URL.revokeObjectURL(s)}numberOrUndefined(e){return e===""?void 0:Number(e)}updateObserver(){const e=this.numberOrUndefined(this.latInput.value),t=this.numberOrUndefined(this.lngInput.value),n=this.numberOrUndefined(this.headingInput.value),s=this.numberOrUndefined(this.pitchInput.value)??0,r=this.ufoElement.sighting.event,a=this.ufoElement.sighting.observerTrack;r.place=e!==void 0&&t!==void 0?[{lat:e,lng:t}]:void 0,e===void 0&&t===void 0&&n===void 0&&s===0?a.clear():a.addKeyframe(0,{lat:e,lng:t,elevationM:0,headingDeg:n,pitchDeg:s,fovDeg:60}),this.ufoElement.refresh()}updateObservationTime(){const e=this.numberOrUndefined(this.obsYearInput.value),t=this.numberOrUndefined(this.obsMonthInput.value),n=this.numberOrUndefined(this.obsDayInput.value),s=this.numberOrUndefined(this.obsHourInput.value),r=this.numberOrUndefined(this.obsMinuteInput.value),a=this.ufoElement.sighting.event;a.time=e===void 0&&t===void 0&&n===void 0&&s===void 0&&r===void 0?void 0:{year:e,month:t,day:n,hour:s,minute:r},this.ufoElement.refresh()}syncObserverAndTimeFields(){const e=this.ufoElement.sighting.event,t=e.place?.[0];this.latInput.value=t?String(t.lat):"",this.lngInput.value=t?String(t.lng):"";const n=this.ufoElement.sighting.observerTrack.getLatestPoseAt(0);this.headingInput.value=n?.headingDeg!==void 0?String(n.headingDeg):"",this.pitchInput.value=String(n?.pitchDeg??0),this.obsYearInput.value=e.time?.year!==void 0?String(e.time.year):"",this.obsMonthInput.value=e.time?.month!==void 0?String(e.time.month):"",this.obsDayInput.value=e.time?.day!==void 0?String(e.time.day):"",this.obsHourInput.value=e.time?.hour!==void 0?String(e.time.hour):"",this.obsMinuteInput.value=e.time?.minute!==void 0?String(e.time.minute):""}get appearance(){return{...this.currentAppearance}}set appearance(e){this.setAppearance(e)}setAppearance(e){this.currentAppearance={...this.currentAppearance,...e},this.updatePresetButtons(),!(this.isRecording||this.ufoElement.playbackState==="playing")&&this.applyAppearanceAtPlayhead()}applyAppearanceAtPlayhead(e){const t=this.ufoElement.sighting.timeline,n=this.ufoElement.currentTime,s=t.getInterpolatedShapeAt(n,this.currentSourceId),r=this.buildAppearanceShape(e??s?.bounds??this.defaultBounds(),s);t.addKeyframe(n,[{sourceId:this.currentSourceId,shape:r}]),this.ufoElement.refresh()}buildAppearanceShape(e,t){const n=_l(e,this.currentAppearance);return t?{...n,angle:t.angle,title:t.title,selected:t.selected}:n}onSelectionOrTimeChanged(){this.syncAppearanceFromTimeline(),this.ufoElement.selectedSourceId=this.currentSourceId}syncAppearanceFromTimeline(){if(this.ufoElement.playbackState==="playing")return;const e=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(this.ufoElement.currentTime,this.currentSourceId);e&&(this.currentAppearance={presetId:ix(e)??this.currentAppearance.presetId,color:e.color,transparency:e.transparency,haloScale:e.haloScale},this.updatePresetButtons(),this.colorInput.value=this.currentAppearance.color,this.transparencyInput.value=String(this.currentAppearance.transparency),this.haloScaleInput.value=String(this.currentAppearance.haloScale))}addShape(){if(this.isRecording)return;const e=this.ufoElement.sighting.timeline,t=new Set([...e.sourceIds,this.currentSourceId]);let n=t.size+1;for(;t.has(`ufo-${n}`);)n++;this.currentSourceId=`ufo-${n}`,this.applyAppearanceAtPlayhead(this.offsetDefaultBounds(e.sourceIds.length)),this.refreshSourceList()}offsetDefaultBounds(e){const t=this.defaultBounds(),n=24;return{...t,x:t.x+e*n,y:t.y+e*n}}refreshSourceList(){const e=this.ufoElement.sighting.timeline,t=[...new Set([...e.sourceIds,this.currentSourceId])];this.sourceSelect.innerHTML="";for(const n of t){const s=document.createElement("option");s.value=n,s.textContent=n,this.sourceSelect.appendChild(s)}this.sourceSelect.value=this.currentSourceId}updatePresetButtons(){for(const e of Hc)this.presetButtons[e]?.setAttribute("aria-pressed",String(e===this.currentAppearance.presetId))}get samplingRate(){return Number(this.samplingRateInput.value)}buildPrototype(e=this.defaultBounds()){return _l(e,this.currentAppearance)}defaultBounds(){const e=this.ufoElement.canvasElement;return{x:e.width/2-Ii.width/2,y:e.height/2-Ii.height/2,width:Ii.width,height:Ii.height}}toggleRecording(){this.endDrag();const e=this.ufoElement.canvasElement;this.isRecording?(this.recorder?.stop(),this.isRecording=!1,this.setRecordButtonLabel(!1),e.style.cursor="",e.style.touchAction="",this.sourceSelect.disabled=!1,this.addShapeButton.disabled=!1,this.ufoElement.refresh(),this.refreshSourceList()):(this.recorder=new j1(this.ufoElement.sighting.timeline,new ex(this.samplingRate)),this.recorder.start(this.currentSourceId,this.buildPrototype()),this.isRecording=!0,this.setRecordButtonLabel(!0),e.style.cursor="crosshair",e.style.touchAction="none",this.sourceSelect.disabled=!0,this.addShapeButton.disabled=!0)}setRecordButtonLabel(e){this.recordButton.textContent=e?"⏹":"⏺";const t=e?this.messages.stop:this.messages.record;this.recordButton.title=t,this.recordButton.setAttribute("aria-label",t)}async loadLocaleMessages(){const e=Ho(navigator.languages,$c);e!=="en"&&this.applyMessages(await Vh(e))}applyMessages(e){this.messages=e,this.presetButtons.oval.textContent=e.oval,this.presetButtons.saucer.textContent=e.saucer,this.presetButtons.triangle.textContent=e.triangle,this.labelColor.textContent=e.color,this.labelTransparency.textContent=e.transparency,this.labelHalo.textContent=e.halo,this.labelShape.textContent=e.shape,this.labelSamplingRate.textContent=e.samplingRate,this.labelDuration.textContent=e.duration,this.durationInput.placeholder=e.durationPlaceholder,this.addShapeButton.textContent=e.addShape,this.exportButton.textContent=e.export,this.labelLatitude.textContent=e.latitude,this.labelLongitude.textContent=e.longitude,this.labelHeading.textContent=e.heading,this.headingInput.placeholder=e.headingPlaceholder,this.labelPitch.textContent=e.pitch,this.labelObservationTime.textContent=e.observationTime,this.obsYearInput.placeholder=e.yearPlaceholder,this.obsMonthInput.placeholder=e.monthPlaceholder,this.obsDayInput.placeholder=e.dayPlaceholder,this.obsHourInput.placeholder=e.hourPlaceholder,this.obsMinuteInput.placeholder=e.minutePlaceholder,this.setRecordButtonLabel(this.isRecording)}onPointerDown(e){if(this.isRecording){this.onPointerMove(e);return}const t=this.canvasPointFromEvent(e);if(!t)return;const n=this.ufoElement.sighting.timeline,s=this.ufoElement.currentTime,r=n.getInterpolatedShapeAt(s,this.currentSourceId),a=r&&Ph(r,t),o=this.ufoElement.playbackState==="playing";if(r&&a){if(o)return;this.beginDrag(a==="rotate"?"rotate":"resize",this.currentSourceId,r,t,a);return}const l=n.hitTest(s,t.x,t.y);l&&(l.sourceId!==this.currentSourceId&&(this.currentSourceId=l.sourceId,this.refreshSourceList(),this.onSelectionOrTimeChanged()),!o&&this.beginDrag("move",l.sourceId,l.shape,t))}beginDrag(e,t,n,s,r){this.dragState={kind:e,sourceId:t,original:n,handle:r,startPointer:s},document.addEventListener("pointermove",this.handleDragPointerMove),document.addEventListener("pointerup",this.handleDragPointerUp)}onDragPointerMove(e){if(!this.dragState)return;const t=this.canvasPointFromEvent(e);if(!t)return;const{kind:n,sourceId:s,original:r,handle:a,startPointer:o}=this.dragState,l=n==="move"?{...r,bounds:{...r.bounds,x:r.bounds.x+(t.x-o.x),y:r.bounds.y+(t.y-o.y)}}:n==="resize"?Dh(r,a,t):Lh(r,t);this.ufoElement.sighting.timeline.addKeyframe(this.ufoElement.currentTime,[{sourceId:s,shape:l}]),this.ufoElement.refresh()}endDrag(){this.dragState&&(this.dragState=void 0,document.removeEventListener("pointermove",this.handleDragPointerMove),document.removeEventListener("pointerup",this.handleDragPointerUp))}onPointerMove(e){if(!this.isRecording)return;const t=this.ufoElement.canvasElement,n=t.getBoundingClientRect(),s=e.clientX-n.left,r=e.clientY-n.top;this.recorder?.onPointerMove(s,r),this.ufoElement.renderer.clear(t.width,t.height),this.ufoElement.renderer.paintShape(Xc(this.buildPrototype({x:0,y:0,width:Ii.width,height:Ii.height}),s,r))}canvasPointFromEvent(e){const t=this.ufoElement.canvasElement,n=t.getBoundingClientRect();if(!(n.width===0||n.height===0))return{x:(e.clientX-n.left)/n.width*t.width,y:(e.clientY-n.top)/n.height*t.height}}}const Vc="rr0-ufo-recorder";function rx(){wr(),customElements.get(Vc)||customElements.define(Vc,sx)}rx();
4431
+ */const Ou=173.1446326846693,ei=14959787069098932e-8,it=.017453292519943295,wc=.26179938779914946,Wn=57.29577951308232,Bu=3.819718634205488,P_=365.24217,Rc=new Date("2000-01-01T12:00:00Z"),Mn=2*Math.PI,zn=3600*(180/Math.PI),Di=484813681109536e-20,zu=10800*60,I_=2*zu,Cc=7292115e-11,D_=zu/Math.PI,L_=-.17-5*Math.log10(D_),Eo=.996647180302104,U_=Eo*Eo,bo=6378.1366,N_=bo/ei,Gu=81.30056,sl=.0002959122082855911,To=2825345909524226e-22,Ao=8459715185680659e-23,wo=1292024916781969e-23,Ro=1524358900784276e-23;function Sr(i){if(i!==!0&&i!==!1)throw console.trace(),`Value is not boolean: ${i}`;return i}function yt(i){if(!Number.isFinite(i))throw console.trace(),`Value is not a finite number: ${i}`;return i}function Pi(i){return i-Math.floor(i)}function F_(i,e){const t=i.x*i.x+i.y*i.y+i.z*i.z;if(Math.abs(t)<1e-8)throw"AngleBetween: first vector is too short.";const n=e.x*e.x+e.y*e.y+e.z*e.z;if(Math.abs(n)<1e-8)throw"AngleBetween: second vector is too short.";const s=(i.x*e.x+i.y*e.y+i.z*e.z)/Math.sqrt(t*n);return s<=-1?180:s>=1?0:Wn*Math.acos(s)}var ye;(function(i){i.Sun="Sun",i.Moon="Moon",i.Mercury="Mercury",i.Venus="Venus",i.Earth="Earth",i.Mars="Mars",i.Jupiter="Jupiter",i.Saturn="Saturn",i.Uranus="Uranus",i.Neptune="Neptune",i.Pluto="Pluto",i.SSB="SSB",i.EMB="EMB",i.Star1="Star1",i.Star2="Star2",i.Star3="Star3",i.Star4="Star4",i.Star5="Star5",i.Star6="Star6",i.Star7="Star7",i.Star8="Star8"})(ye||(ye={}));const O_=[ye.Star1,ye.Star2,ye.Star3,ye.Star4,ye.Star5,ye.Star6,ye.Star7,ye.Star8],B_=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function z_(i){const e=O_.indexOf(i);return e>=0?B_[e]:null}function rl(i){const e=z_(i);return e&&e.dist>0?e:null}var $t;(function(i){i[i.From2000=0]="From2000",i[i.Into2000=1]="Into2000"})($t||($t={}));const bn={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[85831e-11,1.27079125277,161000.6857376741],[57056e-11,2.01374292245,83996.84731811189],[55736e-11,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function G_(i){var e,t,n,s,r,a,o;const l=2e3+(i-14)/P_;return l<-500?(e=(l-1820)/100,-20+32*e*e):l<500?(e=l/100,t=e*e,n=e*t,s=t*t,r=t*n,a=n*n,10583.6-1014.41*e+33.78311*t-5.952053*n-.1798452*s+.022174192*r+.0090316521*a):l<1600?(e=(l-1e3)/100,t=e*e,n=e*t,s=t*t,r=t*n,a=n*n,1574.2-556.01*e+71.23472*t+.319781*n-.8503463*s-.005050998*r+.0083572073*a):l<1700?(e=l-1600,t=e*e,n=e*t,120-.9808*e-.01532*t+n/7129):l<1800?(e=l-1700,t=e*e,n=e*t,s=t*t,8.83+.1603*e-.0059285*t+13336e-8*n-s/1174e3):l<1860?(e=l-1800,t=e*e,n=e*t,s=t*t,r=t*n,a=n*n,o=n*s,13.72-.332447*e+.0068612*t+.0041116*n-37436e-8*s+121272e-10*r-1699e-10*a+875e-12*o):l<1900?(e=l-1860,t=e*e,n=e*t,s=t*t,r=t*n,7.62+.5737*e-.251754*t+.01680668*n-.0004473624*s+r/233174):l<1920?(e=l-1900,t=e*e,n=e*t,s=t*t,-2.79+1.494119*e-.0598939*t+.0061966*n-197e-6*s):l<1941?(e=l-1920,t=e*e,n=e*t,21.2+.84493*e-.0761*t+.0020936*n):l<1961?(e=l-1950,t=e*e,n=e*t,29.07+.407*e-t/233+n/2547):l<1986?(e=l-1975,t=e*e,n=e*t,45.45+1.067*e-t/260-n/718):l<2005?(e=l-2e3,t=e*e,n=e*t,s=t*t,r=t*n,63.86+.3345*e-.060374*t+.0017275*n+651814e-9*s+2373599e-11*r):l<2050?(e=l-2e3,62.92+.32217*e+.005589*e*e):l<2150?(e=(l-1820)/100,-20+32*e*e-.5628*(2150-l)):(e=(l-1820)/100,-20+32*e*e)}let k_=G_;function Pc(i){return i+k_(i)/86400}class Oi{constructor(e){if(e instanceof Oi){this.date=e.date,this.ut=e.ut,this.tt=e.tt;return}const t=1e3*3600*24;if(e instanceof Date&&Number.isFinite(e.getTime())){this.date=e,this.ut=(e.getTime()-Rc.getTime())/t,this.tt=Pc(this.ut);return}if(Number.isFinite(e)){this.date=new Date(Rc.getTime()+e*t),this.ut=e,this.tt=Pc(this.ut);return}throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date."}static FromTerrestrialTime(e){let t=new Oi(e);for(;;){const n=e-t.tt;if(Math.abs(n)<1e-12)return t;t=t.AddDays(n)}}toString(){return this.date.toISOString()}AddDays(e){return new Oi(this.ut+e)}}function Zt(i){return i instanceof Oi?i:new Oi(i)}function H_(i){function e(u){return u%I_*Di}const t=i.tt/36525,n=e(128710479305e-5+t*1295965810481e-4),s=e(335779.526232+t*17395272628478e-4),r=e(107226070369e-5+t*1602961601209e-3),a=e(450160.398036-t*69628905431e-4);let o=Math.sin(a),l=Math.cos(a),c=(-172064161-174666*t)*o+33386*l,h=(92052331+9086*t)*l+15377*o,d=2*(s-r+a);return o=Math.sin(d),l=Math.cos(d),c+=(-13170906-1675*t)*o-13696*l,h+=(5730336-3015*t)*l-4587*o,d=2*(s+a),o=Math.sin(d),l=Math.cos(d),c+=(-2276413-234*t)*o+2796*l,h+=(978459-485*t)*l+1374*o,d=2*a,o=Math.sin(d),l=Math.cos(d),c+=(2074554+207*t)*o-698*l,h+=(-897492+470*t)*l-291*o,o=Math.sin(n),l=Math.cos(n),c+=(1475877-3633*t)*o+11817*l,h+=(73871-184*t)*l-1924*o,{dpsi:-135e-6+c*1e-7,deps:388e-6+h*1e-7}}function ku(i){var e=i.tt/36525,t=((((-434e-10*e-576e-9)*e+.0020034)*e-1831e-7)*e-46.836769)*e+84381.406;return t/3600}var Js;function al(i){if(!Js||Math.abs(Js.tt-i.tt)>1e-6){const e=H_(i),t=ku(i),n=t+e.deps/3600;Js={tt:i.tt,dpsi:e.dpsi,deps:e.deps,ee:e.dpsi*Math.cos(t*it)/15,mobl:t,tobl:n}}return Js}function V_(i,e){const t=i*it,n=Math.cos(t),s=Math.sin(t);return[e[0],e[1]*n-e[2]*s,e[1]*s+e[2]*n]}function W_(i,e){return V_(ku(i),e)}function X_(i){const e=i.tt/36525;function t(we,ve){const Ue=[];let Ie;for(Ie=0;Ie<=ve-we;++Ie)Ue.push(0);return{min:we,array:Ue}}function n(we,ve,Ue,Ie){const De=[];for(let $e=0;$e<=ve-we;++$e)De.push(t(Ue,Ie));return{min:we,array:De}}function s(we,ve,Ue){const Ie=we.array[ve-we.min];return Ie.array[Ue-Ie.min]}function r(we,ve,Ue,Ie){const De=we.array[ve-we.min];De.array[Ue-De.min]=Ie}let a,o,l,c,h,d,u,m,_,S,g,f,A,w,M,T,E,R,x,b,D,C,N,Y=n(-6,6,1,4),K=n(-6,6,1,4);function O(we,ve){return s(Y,we,ve)}function W(we,ve){return s(K,we,ve)}function V(we,ve,Ue){return r(Y,we,ve,Ue)}function Q(we,ve,Ue){return r(K,we,ve,Ue)}function te(we,ve,Ue,Ie,De){De(we*Ue-ve*Ie,ve*Ue+we*Ie)}function ee(we){return Math.sin(Mn*we)}u=e*e,_=0,N=0,g=0,f=3422.7;var se=ee(.19833+.05611*e),ge=ee(.27869+.04508*e),Ve=ee(.16827-.36903*e),st=ee(.34734-5.37261*e),We=ee(.10498-5.37899*e),$=ee(.42681-.41855*e),re=ee(.14943-5.37511*e);for(R=.84*se+.31*ge+14.27*Ve+7.26*st+.28*We+.24*$,x=2.94*se+.31*ge+14.27*Ve+9.34*st+1.12*We+.83*$,b=-6.4*se-1.89*$,D=.21*se+.31*ge+14.27*Ve-88.7*st-15.3*We+.24*$-1.86*re,C=R-b,m=-3332e-9*ee(.59734-5.37261*e)-539e-9*ee(.35498-5.37899*e)-64e-9*ee(.39943-5.37511*e),A=Mn*Pi(.60643382+1336.85522467*e-313e-8*u)+R/zn,w=Mn*Pi(.37489701+1325.55240982*e+2565e-8*u)+x/zn,M=Mn*Pi(.99312619+99.99735956*e-44e-8*u)+b/zn,T=Mn*Pi(.25909118+1342.2278298*e-892e-8*u)+D/zn,E=Mn*Pi(.82736186+1236.85308708*e-397e-8*u)+C/zn,h=1;h<=4;++h){switch(h){case 1:l=w,o=4,c=1.000002208;break;case 2:l=M,o=3,c=.997504612-.002495388*e;break;case 3:l=T,o=4,c=1.000002708+139.978*m;break;case 4:l=E,o=6,c=1;break;default:throw`Internal error: I = ${h}`}for(V(0,h,1),V(1,h,Math.cos(l)*c),Q(0,h,0),Q(1,h,Math.sin(l)*c),d=2;d<=o;++d)te(O(d-1,h),W(d-1,h),O(1,h),W(1,h),(we,ve)=>(V(d,h,we),Q(d,h,ve)));for(d=1;d<=o;++d)V(-d,h,O(d,h)),Q(-d,h,-W(d,h))}function ne(we,ve,Ue,Ie){for(var De={x:1,y:0},$e=[0,we,ve,Ue,Ie],Ze=1;Ze<=4;++Ze)$e[Ze]!==0&&te(De.x,De.y,O($e[Ze],Ze),W($e[Ze],Ze),(ct,ot)=>(De.x=ct,De.y=ot));return De}function G(we,ve,Ue,Ie,De,$e,Ze,ct){var ot=ne(De,$e,Ze,ct);_+=we*ot.y,N+=ve*ot.y,g+=Ue*ot.x,f+=Ie*ot.x}G(13.902,14.06,-.001,.2607,0,0,0,4),G(.403,-4.01,.394,.0023,0,0,0,3),G(2369.912,2373.36,.601,28.2333,0,0,0,2),G(-125.154,-112.79,-.725,-.9781,0,0,0,1),G(1.979,6.98,-.445,.0433,1,0,0,4),G(191.953,192.72,.029,3.0861,1,0,0,2),G(-8.466,-13.51,.455,-.1093,1,0,0,1),G(22639.5,22609.07,.079,186.5398,1,0,0,0),G(18.609,3.59,-.094,.0118,1,0,0,-1),G(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),G(3.215,5.44,.192,-.0386,1,0,0,-3),G(-38.428,-38.64,.001,.6008,1,0,0,-4),G(-.393,-1.43,-.092,.0086,1,0,0,-6),G(-.289,-1.59,.123,-.0053,0,1,0,4),G(-24.42,-25.1,.04,-.3,0,1,0,2),G(18.023,17.93,.007,.1494,0,1,0,1),G(-668.146,-126.98,-1.302,-.3997,0,1,0,0),G(.56,.32,-.001,-.0037,0,1,0,-1),G(-165.145,-165.06,.054,1.9178,0,1,0,-2),G(-1.877,-6.46,-.416,.0339,0,1,0,-4),G(.213,1.02,-.074,.0054,2,0,0,4),G(14.387,14.78,-.017,.2833,2,0,0,2),G(-.586,-1.2,.054,-.01,2,0,0,1),G(769.016,767.96,.107,10.1657,2,0,0,0),G(1.75,2.01,-.018,.0155,2,0,0,-1),G(-211.656,-152.53,5.679,-.3039,2,0,0,-2),G(1.225,.91,-.03,-.0088,2,0,0,-3),G(-30.773,-34.07,-.308,.3722,2,0,0,-4),G(-.57,-1.4,-.074,.0109,2,0,0,-6),G(-2.921,-11.75,.787,-.0484,1,1,0,2),G(1.267,1.52,-.022,.0164,1,1,0,1),G(-109.673,-115.18,.461,-.949,1,1,0,0),G(-205.962,-182.36,2.056,1.4437,1,1,0,-2),G(.233,.36,.012,-.0025,1,1,0,-3),G(-4.391,-9.66,-.471,.0673,1,1,0,-4),G(.283,1.53,-.111,.006,1,-1,0,4),G(14.577,31.7,-1.54,.2302,1,-1,0,2),G(147.687,138.76,.679,1.1528,1,-1,0,0),G(-1.089,.55,.021,0,1,-1,0,-1),G(28.475,23.59,-.443,-.2257,1,-1,0,-2),G(-.276,-.38,-.006,-.0036,1,-1,0,-3),G(.636,2.27,.146,-.0102,1,-1,0,-4),G(-.189,-1.68,.131,-.0028,0,2,0,2),G(-7.486,-.66,-.037,-.0086,0,2,0,0),G(-8.096,-16.35,-.74,.0918,0,2,0,-2),G(-5.741,-.04,0,-9e-4,0,0,2,2),G(.255,0,0,0,0,0,2,1),G(-411.608,-.2,0,-.0124,0,0,2,0),G(.584,.84,0,.0071,0,0,2,-1),G(-55.173,-52.14,0,-.1052,0,0,2,-2),G(.254,.25,0,-.0017,0,0,2,-3),G(.025,-1.67,0,.0031,0,0,2,-4),G(1.06,2.96,-.166,.0243,3,0,0,2),G(36.124,50.64,-1.3,.6215,3,0,0,0),G(-13.193,-16.4,.258,-.1187,3,0,0,-2),G(-1.187,-.74,.042,.0074,3,0,0,-4),G(-.293,-.31,-.002,.0046,3,0,0,-6),G(-.29,-1.45,.116,-.0051,2,1,0,2),G(-7.649,-10.56,.259,-.1038,2,1,0,0),G(-8.627,-7.59,.078,-.0192,2,1,0,-2),G(-2.74,-2.54,.022,.0324,2,1,0,-4),G(1.181,3.32,-.212,.0213,2,-1,0,2),G(9.703,11.67,-.151,.1268,2,-1,0,0),G(-.352,-.37,.001,-.0028,2,-1,0,-1),G(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),G(.36,.2,-.012,-.0043,2,-1,0,-4),G(-1.167,-1.25,.008,-.0106,1,2,0,0),G(-7.412,-6.12,.117,.0484,1,2,0,-2),G(-.311,-.65,-.032,.0044,1,2,0,-4),G(.757,1.82,-.105,.0112,1,-2,0,2),G(2.58,2.32,.027,.0196,1,-2,0,0),G(2.533,2.4,-.014,-.0212,1,-2,0,-2),G(-.344,-.57,-.025,.0036,0,3,0,-2),G(-.992,-.02,0,0,1,0,2,2),G(-45.099,-.02,0,-.001,1,0,2,0),G(-.179,-9.52,0,-.0833,1,0,2,-2),G(-.301,-.33,0,.0014,1,0,2,-4),G(-6.382,-3.37,0,-.0481,1,0,-2,2),G(39.528,85.13,0,-.7136,1,0,-2,0),G(9.366,.71,0,-.0112,1,0,-2,-2),G(.202,.02,0,0,1,0,-2,-4),G(.415,.1,0,.0013,0,1,2,0),G(-2.152,-2.26,0,-.0066,0,1,2,-2),G(-1.44,-1.3,0,.0014,0,1,-2,2),G(.384,-.04,0,0,0,1,-2,-2),G(1.938,3.6,-.145,.0401,4,0,0,0),G(-.952,-1.58,.052,-.013,4,0,0,-2),G(-.551,-.94,.032,-.0097,3,1,0,0),G(-.482,-.57,.005,-.0045,3,1,0,-2),G(.681,.96,-.026,.0115,3,-1,0,0),G(-.297,-.27,.002,-9e-4,2,2,0,-2),G(.254,.21,-.003,0,2,-2,0,-2),G(-.25,-.22,.004,.0014,1,3,0,-2),G(-3.996,0,0,4e-4,2,0,2,0),G(.557,-.75,0,-.009,2,0,2,-2),G(-.459,-.38,0,-.0053,2,0,-2,2),G(-1.298,.74,0,4e-4,2,0,-2,0),G(.538,1.14,0,-.0141,2,0,-2,-2),G(.263,.02,0,0,1,1,2,0),G(.426,.07,0,-6e-4,1,1,-2,-2),G(-.304,.03,0,3e-4,1,-1,2,0),G(-.372,-.19,0,-.0027,1,-1,-2,2),G(.418,0,0,0,0,0,4,0),G(-.33,-.04,0,0,3,0,2,0);function Ce(we,ve,Ue,Ie,De){return we*ne(ve,Ue,Ie,De).y}S=0,S+=Ce(-526.069,0,0,1,-2),S+=Ce(-3.352,0,0,1,-4),S+=Ce(44.297,1,0,1,-2),S+=Ce(-6,1,0,1,-4),S+=Ce(20.599,-1,0,1,0),S+=Ce(-30.598,-1,0,1,-2),S+=Ce(-24.649,-2,0,1,0),S+=Ce(-2,-2,0,1,-2),S+=Ce(-22.571,0,1,1,-2),S+=Ce(10.985,0,-1,1,-2),_+=.82*ee(.7736-62.5512*e)+.31*ee(.0466-125.1025*e)+.35*ee(.5785-25.1042*e)+.66*ee(.4591+1335.8075*e)+.64*ee(.313-91.568*e)+1.14*ee(.148+1331.2898*e)+.21*ee(.5918+1056.5859*e)+.44*ee(.5784+1322.8595*e)+.24*ee(.2275-5.7374*e)+.28*ee(.2965+2.6929*e)+.33*ee(.3132+6.3368*e),a=T+N/zn;let Pe=(1.000002708+139.978*m)*(18518.511+1.189+g)*Math.sin(a)-6.24*Math.sin(3*a)+S;return{geo_eclip_lon:Mn*Pi((A+_/zn)/Mn),geo_eclip_lat:Math.PI/(180*3600)*Pe,distance_au:zn*N_/(.999953253*f)}}function Hu(i,e){return[i.rot[0][0]*e[0]+i.rot[1][0]*e[1]+i.rot[2][0]*e[2],i.rot[0][1]*e[0]+i.rot[1][1]*e[1]+i.rot[2][1]*e[2],i.rot[0][2]*e[0]+i.rot[1][2]*e[1]+i.rot[2][2]*e[2]]}function yr(i,e,t){const n=q_(e,t);return Hu(n,i)}function q_(i,e){const t=i.tt/36525;let n=84381.406,s=((((-951e-10*t+132851e-9)*t-.00114045)*t-1.0790069)*t+5038.481507)*t,r=((((3337e-10*t-467e-9)*t-.00772503)*t+.0512623)*t-.025754)*t+n,a=((((-56e-9*t+170663e-9)*t-.00121197)*t-2.3814292)*t+10.556403)*t;n*=Di,s*=Di,r*=Di,a*=Di;const o=Math.sin(n),l=Math.cos(n),c=Math.sin(-s),h=Math.cos(-s),d=Math.sin(-r),u=Math.cos(-r),m=Math.sin(a),_=Math.cos(a),S=_*h-c*m*u,g=_*c*l+m*u*h*l-o*m*d,f=_*c*o+m*u*h*o+l*m*d,A=-m*h-c*_*u,w=-m*c*l+_*u*h*l-o*_*d,M=-m*c*o+_*u*h*o+l*_*d,T=c*d,E=-d*h*l-o*u,R=-d*h*o+u*l;if(e===$t.Into2000)return new Er([[S,g,f],[A,w,M],[T,E,R]]);if(e===$t.From2000)return new Er([[S,A,T],[g,w,E],[f,M,R]]);throw"Invalid precess direction"}function Y_(i){const e=.779057273264+.00273781191135448*i.ut,t=i.ut%1;let n=360*((e+t)%1);return n<0&&(n+=360),n}let Qs;function Vu(i){if(!Qs||Qs.tt!==i.tt){const e=i.tt/36525;let t=15*al(i).ee;const n=Y_(i);let r=((t+.014506+((((-368e-10*e-29956e-9)*e-44e-8)*e+1.3915817)*e+4612.156534)*e)/3600+n)%360/15;r<0&&(r+=24),Qs={tt:i.tt,st:r}}return Qs.st}function K_(i,e){const t=i.latitude*it,n=Math.sin(t),s=Math.cos(t),r=1/Math.hypot(s,Eo*n),a=U_*r,o=i.height/1e3,l=bo*r+o,c=bo*a+o,h=(15*e+i.longitude)*it,d=Math.sin(h),u=Math.cos(h);return{pos:[l*s*u/ei,l*s*d/ei,c*n/ei],vel:[-Cc*l*s*d*86400/ei,Cc*l*s*u*86400/ei,0]}}function Co(i,e,t){const n=$_(e,t);return Hu(n,i)}function $_(i,e){const t=al(i),n=t.mobl*it,s=t.tobl*it,r=t.dpsi*Di,a=Math.cos(n),o=Math.sin(n),l=Math.cos(s),c=Math.sin(s),h=Math.cos(r),d=Math.sin(r),u=h,m=-d*a,_=-d*o,S=d*l,g=h*a*l+o*c,f=h*o*l-a*c,A=d*c,w=h*a*c-o*l,M=h*o*c+a*l;if(e===$t.From2000)return new Er([[u,S,A],[m,g,w],[_,f,M]]);if(e===$t.Into2000)return new Er([[u,m,_],[S,g,f],[A,w,M]]);throw"Invalid precess direction"}function Wu(i,e,t){return t===$t.Into2000?yr(Co(i,e,t),e,t):Co(yr(i,e,t),e,t)}function Z_(i,e){const t=Vu(i),n=K_(e,t).pos;return Wu(n,i,$t.Into2000)}class gt{constructor(e,t,n,s){this.x=e,this.y=t,this.z=n,this.t=s}Length(){return Math.hypot(this.x,this.y,this.z)}}class Hn{constructor(e,t,n,s,r,a,o){this.x=e,this.y=t,this.z=n,this.vx=s,this.vy=r,this.vz=a,this.t=o}}class J_{constructor(e,t,n){this.lat=yt(e),this.lon=yt(t),this.dist=yt(n)}}class Ic{constructor(e,t,n,s){this.ra=yt(e),this.dec=yt(t),this.dist=yt(n),this.vec=s}}class Er{constructor(e){this.rot=e}}class Q_{constructor(e,t,n,s){this.azimuth=yt(e),this.altitude=yt(t),this.ra=yt(n),this.dec=yt(s)}}class j_{constructor(e,t,n){this.vec=e,this.elat=yt(t),this.elon=yt(n)}}function e1(i,e){return new gt(i[0],i[1],i[2],e)}function t1(i,e){const t=e1(i,e),n=t.x*t.x+t.y*t.y,s=Math.sqrt(n+t.z*t.z);if(n===0){if(t.z===0)throw"Indeterminate sky coordinates";return new Ic(0,t.z<0?-90:90,s,t)}let r=Bu*Math.atan2(t.y,t.x);r<0&&(r+=24);const a=Wn*Math.atan2(i[2],Math.sqrt(n));return new Ic(r,a,s,t)}function _a(i,e){const t=i*it,n=Math.cos(t),s=Math.sin(t);return[n*e[0]+s*e[1],n*e[1]-s*e[0],e[2]]}function Xu(i,e,t,n,s){let r=Zt(i);ol(e),yt(t),yt(n);const a=Math.sin(e.latitude*it),o=Math.cos(e.latitude*it),l=Math.sin(e.longitude*it),c=Math.cos(e.longitude*it),h=Math.sin(n*it),d=Math.cos(n*it),u=Math.sin(t*wc),m=Math.cos(t*wc);let _=[o*c,o*l,a],S=[-a*c,-a*l,o],g=[l,-c,0];const f=-15*Vu(r);let A=_a(f,_),w=_a(f,S),M=_a(f,g),T=[d*m,d*u,h];const E=T[0]*A[0]+T[1]*A[1]+T[2]*A[2],R=T[0]*w[0]+T[1]*w[1]+T[2]*w[2],x=T[0]*M[0]+T[1]*M[1]+T[2]*M[2];let b=Math.hypot(R,x),D;b>0?(D=-Wn*Math.atan2(x,R),D<0&&(D+=360)):D=0;let C=Wn*Math.atan2(b,E),N=t,Y=n;{let K=C,O=E1(s,90-C);if(C-=O,O>0&&C>3e-4){const W=Math.sin(C*it),V=Math.cos(C*it),Q=Math.sin(K*it),te=Math.cos(K*it),ee=[];for(let se=0;se<3;++se)ee.push((T[se]-te*A[se])/Q*W+A[se]*V);b=Math.hypot(ee[0],ee[1]),b>0?(N=Bu*Math.atan2(ee[1],ee[0]),N<0&&(N+=24)):N=0,Y=Wn*Math.atan2(ee[2],b)}}return new Q_(D,90-C,N,Y)}function ol(i){if(!(i instanceof qu))throw`Not an instance of the Observer class: ${i}`;if(yt(i.latitude),yt(i.longitude),yt(i.height),i.latitude<-90||i.latitude>90)throw`Latitude ${i.latitude} is out of range. Must be -90..+90.`;return i}class qu{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,ol(this)}}function n1(i,e,t,n,s){ol(t),Sr(n),Sr(s);const r=Zt(e),a=Z_(r,t),o=zo(i,r,s),l=[o.x-a[0],o.y-a[1],o.z-a[2]],c=Wu(l,r,$t.From2000);return t1(c,r)}function i1(i,e,t){const n=i.x,s=i.y*e+i.z*t,r=-i.y*t+i.z*e,a=Math.hypot(n,s);let o=0;a>0&&(o=Wn*Math.atan2(s,n),o<0&&(o+=360));let l=Wn*Math.atan2(r,a),c=new gt(n,s,r,i.t);return new j_(c,l,o)}function Po(i){const e=al(i.t),t=[i.x,i.y,i.z],n=yr(t,i.t,$t.From2000),[s,r,a]=Co(n,i.t,$t.From2000),o=new gt(s,r,a,i.t),l=e.tobl*it;return i1(o,Math.cos(l),Math.sin(l))}function Vi(i){const e=Zt(i),t=X_(e),n=t.distance_au*Math.cos(t.geo_eclip_lat),s=[n*Math.cos(t.geo_eclip_lon),n*Math.sin(t.geo_eclip_lon),t.distance_au*Math.sin(t.geo_eclip_lat)],r=W_(e,s),a=yr(r,e,$t.Into2000);return new gt(a[0],a[1],a[2],e)}function Yu(i){const e=Zt(i),t=1e-5,n=e.AddDays(-t),s=e.AddDays(+t),r=Vi(n),a=Vi(s);return new Hn((r.x+a.x)/2,(r.y+a.y)/2,(r.z+a.z)/2,(a.x-r.x)/(2*t),(a.y-r.y)/(2*t),(a.z-r.z)/(2*t),e)}function s1(i){const e=Zt(i),t=Yu(e),n=1+Gu;return new Hn(t.x/n,t.y/n,t.z/n,t.vx/n,t.vy/n,t.vz/n,e)}function Bi(i,e,t){let n=1,s=0;for(let r of i){let a=0;for(let[l,c,h]of r)a+=l*Math.cos(c+e*h);let o=n*a;t&&(o%=Mn),s+=o,n*=e}return s}function xa(i,e){let t=1,n=0,s=0,r=0;for(let a of i){let o=0,l=0;for(let[c,h,d]of a){let u=h+e*d;o+=c*d*Math.sin(u),r>0&&(l+=c*Math.cos(u))}s+=r*n*l-t*o,n=t,t*=e,++r}return s}const os=365250,Io=0,Do=1,Lo=2;function Uo(i){return new wt(i[0]+44036e-11*i[1]-190919e-12*i[2],-479966e-12*i[0]+.917482137087*i[1]-.397776982902*i[2],.397776982902*i[1]+.917482137087*i[2])}function Ku(i,e,t){const n=t*Math.cos(e),s=Math.cos(i),r=Math.sin(i);return[n*s,n*r,t*Math.sin(e)]}function cs(i,e){const t=e.tt/os,n=Bi(i[Io],t,!0),s=Bi(i[Do],t,!1),r=Bi(i[Lo],t,!1),a=Ku(n,s,r);return Uo(a).ToAstroVector(e)}function No(i,e){const t=e/os,n=Bi(i[Io],t,!0),s=Bi(i[Do],t,!1),r=Bi(i[Lo],t,!1),a=xa(i[Io],t),o=xa(i[Do],t),l=xa(i[Lo],t),c=Math.cos(n),h=Math.sin(n),d=Math.cos(s),u=Math.sin(s),m=+(l*d*c)-r*u*c*o-r*d*h*a,_=+(l*d*h)-r*u*h*o+r*d*c*a,S=+(l*u)+r*d*o,g=Ku(n,s,r),f=[m/os,_/os,S/os],A=Uo(g),w=Uo(f);return new li(e,A,w)}function js(i,e,t,n){const s=n/(n+sl),r=cs(bn[t],e);i.x+=s*r.x,i.y+=s*r.y,i.z+=s*r.z}function r1(i){const e=new gt(0,0,0,i);return js(e,i,ye.Jupiter,To),js(e,i,ye.Saturn,Ao),js(e,i,ye.Uranus,wo),js(e,i,ye.Neptune,Ro),e}const Fo=51,a1=29200,Li=146,Sn=201,ii=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]];class wt{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new wt(this.x,this.y,this.z)}ToAstroVector(e){return new gt(this.x,this.y,this.z,e)}static zero(){return new wt(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(e){return new wt(this.x+e.x,this.y+e.y,this.z+e.z)}sub(e){return new wt(this.x-e.x,this.y-e.y,this.z-e.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(e){return new wt(e*this.x,e*this.y,e*this.z)}div(e){return new wt(this.x/e,this.y/e,this.z/e)}mean(e){return new wt((this.x+e.x)/2,(this.y+e.y)/2,(this.z+e.z)/2)}neg(){return new wt(-this.x,-this.y,-this.z)}}class li{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new li(this.tt,this.r,this.v)}sub(e){return new li(this.tt,this.r.sub(e.r),this.v.sub(e.v))}}function o1(i){let[e,[t,n,s],[r,a,o]]=i;return new li(e,new wt(t,n,s),new wt(r,a,o))}function er(i,e,t,n){const s=n/(n+sl),r=No(bn[t],e);return i.r.incr(r.r.mul(s)),i.v.incr(r.v.mul(s)),r}function is(i,e,t){const n=t.sub(i),s=n.quadrature();return n.mul(e/(s*Math.sqrt(s)))}class Lr{constructor(e){let t=new li(e,new wt(0,0,0),new wt(0,0,0));this.Jupiter=er(t,e,ye.Jupiter,To),this.Saturn=er(t,e,ye.Saturn,Ao),this.Uranus=er(t,e,ye.Uranus,wo),this.Neptune=er(t,e,ye.Neptune,Ro),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new li(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=is(e,sl,this.Sun.r);return t.incr(is(e,To,this.Jupiter.r)),t.incr(is(e,Ao,this.Saturn.r)),t.incr(is(e,wo,this.Uranus.r)),t.incr(is(e,Ro,this.Neptune.r)),t}}class Ur{constructor(e,t,n,s){this.tt=e,this.r=t,this.v=n,this.a=s}clone(){return new Ur(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}}class $u{constructor(e,t){this.bary=e,this.grav=t}}function br(i,e,t,n){return new wt(e.x+i*(t.x+i*n.x/2),e.y+i*(t.y+i*n.y/2),e.z+i*(t.z+i*n.z/2))}function Dc(i,e,t){return new wt(e.x+i*t.x,e.y+i*t.y,e.z+i*t.z)}function Oo(i,e){const t=i-e.tt,n=new Lr(i),s=br(t,e.r,e.v,e.a),r=n.Acceleration(s).mean(e.a),a=br(t,e.r,e.v,r),o=e.v.add(r.mul(t)),l=n.Acceleration(a),c=new Ur(i,a,o,l);return new $u(n,c)}const l1=[];function Zu(i,e){const t=Math.floor(i);return t<0?0:t>=e?e-1:t}function Bo(i){const e=o1(i),t=new Lr(e.tt),n=e.r.add(t.Sun.r),s=e.v.add(t.Sun.v),r=t.Acceleration(n),a=new Ur(e.tt,n,s,r);return new $u(t,a)}function c1(i,e){const t=ii[0][0];if(e<t||e>ii[Fo-1][0])return null;const n=Zu((e-t)/a1,Fo-1);if(!i[n]){const r=i[n]=[];r[0]=Bo(ii[n]).grav,r[Sn-1]=Bo(ii[n+1]).grav;let a,o=r[0].tt;for(a=1;a<Sn-1;++a)r[a]=Oo(o+=Li,r[a-1]).grav;o=r[Sn-1].tt;var s=[];for(s[Sn-1]=r[Sn-1],a=Sn-2;a>0;--a)s[a]=Oo(o-=Li,s[a+1]).grav;for(a=Sn-2;a>0;--a){const l=a/(Sn-1);r[a].r=r[a].r.mul(1-l).add(s[a].r.mul(l)),r[a].v=r[a].v.mul(1-l).add(s[a].v.mul(l)),r[a].a=r[a].a.mul(1-l).add(s[a].a.mul(l))}}return i[n]}function Lc(i,e,t){let n=Bo(i);const s=Math.ceil((e-n.grav.tt)/t);for(let r=0;r<s;++r)n=Oo(r+1===s?e:n.grav.tt+t,n.grav);return n}function Ju(i,e){let t,n,s;const r=c1(l1,i.tt);if(r){const a=Zu((i.tt-r[0].tt)/Li,Sn-1),o=r[a],l=r[a+1],c=o.a.mean(l.a),h=br(i.tt-o.tt,o.r,o.v,c),d=Dc(i.tt-o.tt,o.v,c),u=br(i.tt-l.tt,l.r,l.v,c),m=Dc(i.tt-l.tt,l.v,c),_=(i.tt-o.tt)/Li;t=h.mul(1-_).add(u.mul(_)),n=d.mul(1-_).add(m.mul(_))}else{let a;i.tt<ii[0][0]?a=Lc(ii[0],i.tt,-Li):a=Lc(ii[Fo-1],i.tt,+Li),t=a.grav.r,n=a.grav.v,s=a.bary}return s||(s=new Lr(i.tt)),t=t.sub(s.Sun.r),n=n.sub(s.Sun.v),new Hn(t.x,t.y,t.z,n.x,n.y,n.z,i)}function si(i,e){var t=Zt(e);if(i in bn)return cs(bn[i],t);if(i===ye.Pluto){const a=Ju(t);return new gt(a.x,a.y,a.z,t)}if(i===ye.Sun)return new gt(0,0,0,t);if(i===ye.Moon){var n=cs(bn.Earth,t),s=Vi(t);return new gt(n.x+s.x,n.y+s.y,n.z+s.z,t)}if(i===ye.EMB){const a=cs(bn.Earth,t),o=Vi(t),l=1+Gu;return new gt(a.x+o.x/l,a.y+o.y/l,a.z+o.z/l,t)}if(i===ye.SSB)return r1(t);const r=rl(i);if(r){const a=new J_(r.dec,15*r.ra,r.dist);return y1(a,t)}throw`HelioVector: Unknown body "${i}"`}function u1(i,e){let t=e,n=0;for(let s=0;s<10;++s){const r=i(t),a=r.Length()/Ou;if(a>1)throw"Object is too distant for light-travel solver.";const o=e.AddDays(-a);if(n=Math.abs(o.tt-t.tt),n<1e-9)return r;t=o}throw`Light-travel time solver did not converge: dt = ${n}`}class h1{constructor(e,t,n,s){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=s}Position(e){this.aberration&&(this.observerPos=si(this.observerBody,e));const t=si(this.targetBody,e);return new gt(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}}function d1(i,e,t,n){Sr(n);const s=Zt(i);if(rl(t)){const o=si(t,s);if(n){const c=p1(e,s),h=new gt(o.x-c.x,o.y-c.y,o.z-c.z,s),d=Ou/h.Length();return new gt(h.x+c.vx/d,h.y+c.vy/d,h.z+c.vz/d,s)}const l=si(e,s);return new gt(o.x-l.x,o.y-l.y,o.z-l.z,s)}let r;n?r=new gt(0,0,0,s):r=si(e,s);const a=new h1(e,t,n,r);return u1(o=>a.Position(o),s)}function zo(i,e,t){Sr(t);const n=Zt(e);switch(i){case ye.Earth:return new gt(0,0,0,n);case ye.Moon:return Vi(n);default:const s=d1(n,ye.Earth,i,t);return s.t=n,s}}function f1(i,e){return new Hn(i.r.x,i.r.y,i.r.z,i.v.x,i.v.y,i.v.z,e)}function p1(i,e){const t=Zt(e);switch(i){case ye.Sun:return new Hn(0,0,0,0,0,0,t);case ye.SSB:const n=new Lr(t.tt);return new Hn(-n.Sun.r.x,-n.Sun.r.y,-n.Sun.r.z,-n.Sun.v.x,-n.Sun.v.y,-n.Sun.v.z,t);case ye.Mercury:case ye.Venus:case ye.Earth:case ye.Mars:case ye.Jupiter:case ye.Saturn:case ye.Uranus:case ye.Neptune:const s=No(bn[i],t.tt);return f1(s,t);case ye.Pluto:return Ju(t);case ye.Moon:case ye.EMB:const r=No(bn.Earth,t.tt),a=i==ye.Moon?Yu(t):s1(t);return new Hn(a.x+r.r.x,a.y+r.r.y,a.z+r.r.z,a.vx+r.v.x,a.vy+r.v.y,a.vz+r.v.z,t);default:if(rl(i)){const o=si(i,t);return new Hn(o.x,o.y,o.z,0,0,0,t)}throw`HelioState: Unsupported body "${i}"`}}function m1(i){for(;i<0;)i+=360;for(;i>=360;)i-=360;return i}function g1(i,e,t){if(i===ye.Earth||e===ye.Earth)throw"The Earth does not have a longitude as seen from itself.";const n=Zt(t),s=zo(i,n,!1),r=Po(s),a=zo(e,n,!1),o=Po(a);return m1(r.elon-o.elon)}function _1(i,e,t,n){let s,r=0,a=0,o=0;switch(i){case ye.Mercury:s=-.6,r=4.98,a=-4.88,o=3.02;break;case ye.Venus:e<163.6?(s=-4.47,r=1.03,a=.57,o=.13):(s=.98,r=-1.02);break;case ye.Mars:s=-1.52,r=1.6;break;case ye.Jupiter:s=-9.4,r=.5;break;case ye.Uranus:s=-7.19,r=.25;break;case ye.Neptune:s=-6.87;break;case ye.Pluto:s=-1,r=4;break;default:throw`VisualMagnitude: unsupported body ${i}`}const l=e/100;let c=s+l*(r+l*(a+l*o));return c+=5*Math.log10(t*n),c}function x1(i,e,t,n,s){const r=Po(n),a=it*28.06,o=it*(169.51+382e-7*s.tt),l=it*r.elat,c=it*r.elon,h=Math.asin(Math.sin(l)*Math.cos(a)-Math.cos(l)*Math.sin(a)*Math.sin(c-o)),d=Math.sin(Math.abs(h));let u=-9+.044*i;return u+=d*(-2.6+1.2*d),u+=5*Math.log10(e*t),{mag:u,ring_tilt:Wn*h}}function v1(i,e,t){let n=i*it,s=n*n,r=s*s,a=-12.717+1.49*Math.abs(n)+.0431*r;const o=385000.6/ei;let l=t/o;return a+=5*Math.log10(e*l),a}class M1{constructor(e,t,n,s,r,a,o,l){this.time=e,this.mag=t,this.phase_angle=n,this.helio_dist=s,this.geo_dist=r,this.gc=a,this.hc=o,this.ring_tilt=l,this.phase_fraction=(1+Math.cos(it*n))/2}}function Qu(i,e){if(i===ye.Earth)throw"The illumination of the Earth is not defined.";const t=Zt(e),n=cs(bn.Earth,t);let s,r,a,o;i===ye.Sun?(a=new gt(-n.x,-n.y,-n.z,t),r=new gt(0,0,0,t),s=0):(i===ye.Moon?(a=Vi(t),r=new gt(n.x+a.x,n.y+a.y,n.z+a.z,t)):(r=si(i,e),a=new gt(r.x-n.x,r.y-n.y,r.z-n.z,t)),s=F_(a,r));let l=a.Length(),c=r.Length(),h;if(i===ye.Sun)o=L_+5*Math.log10(l);else if(i===ye.Moon)o=v1(s,c,l);else if(i===ye.Saturn){const d=x1(s,c,l,a,t);o=d.mag,h=d.ring_tilt}else o=_1(i,s,c,l);return new M1(t,o,s,c,l,a,r,h)}function S1(i){return g1(ye.Moon,ye.Sun,i)}var Uc;(function(i){i[i.Pericenter=0]="Pericenter",i[i.Apocenter=1]="Apocenter"})(Uc||(Uc={}));function y1(i,e){e=Zt(e);const t=i.lat*it,n=i.lon*it,s=i.dist*Math.cos(t);return new gt(s*Math.cos(n),s*Math.sin(n),i.dist*Math.sin(t),e)}function E1(i,e){let t;if(yt(e),e<-90||e>90)return 0;{let n=e;n<-1&&(n=-1),t=1.02/Math.tan((n+10.3/(n+5.11))*it)/60,e<-1&&(t*=(e+90)/89)}return t}var Nc;(function(i){i.Penumbral="penumbral",i.Partial="partial",i.Annular="annular",i.Total="total"})(Nc||(Nc={}));var Fc;(function(i){i[i.Invalid=0]="Invalid",i[i.Ascending=1]="Ascending",i[i.Descending=-1]="Descending"})(Fc||(Fc={}));const b1=["Venus","Mars","Jupiter","Saturn"];function ju(i){return new qu(i.lat,i.lng,i.elevationM)}function T1(i,e,t,n){const s=Xu(t,ju(n),i,e,"normal");return{altitudeDeg:s.altitude,azimuthDeg:s.azimuth}}function va(i,e,t){const n=ju(t),s=n1(ye[i],e,n,!0,!0),r=Xu(e,n,s.ra,s.dec,"normal");return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}function Ma(i,e){return Qu(ye[i],e).mag}function A1(i){const e=S1(i),t=Qu(ye.Moon,i);return{phaseFraction:e/360,illuminatedFraction:t.phase_fraction}}const w1=2e3,R1=3,C1=20;function P1(i,e){if(i.year===void 0&&i.month===void 0&&i.day===void 0&&i.hour===void 0)return;const t=i.year!==void 0,n=i.year??w1,s=i.month??(t?1:R1),r=i.day??(t?1:C1),a=Math.round(e/15);return new Date(Date.UTC(n,s-1,r,(i.hour??12)-a,i.minute??0,i.second??0))}const tr=900,I1=900,D1=850,Oc=850,Sa=4,L1=1.5,U1=-1,N1=6,Bc=-4,F1=[{azimuthDeg:0,label:"N"},{azimuthDeg:45,label:"NE"},{azimuthDeg:90,label:"E"},{azimuthDeg:135,label:"SE"},{azimuthDeg:180,label:"S"},{azimuthDeg:225,label:"SO"},{azimuthDeg:270,label:"O"},{azimuthDeg:315,label:"NO"}],O1=880,zc=40,B1={Venus:new Oe(1,.96,.85),Mars:new Oe(1,.55,.4),Jupiter:new Oe(.95,.87,.72),Saturn:new Oe(.92,.86,.68)};class z1{renderer;scene=new W0;camera;skyMesh;groundMesh;starTiers=[];bodyMeshes=new Map;hitAreas=new Map;glareSprites=new Map;compassSprites=[];showCompass=!1;animationFrameId=null;raycaster=new dd;constructor(e){this.renderer=new c_({canvas:e,antialias:!0}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),this.camera=new Xt(60,e.width/Math.max(e.height,1),.1,tr*1.2),this.camera.position.set(0,1.6,0)}resize(e,t){this.renderer.setSize(e,t,!1),this.camera.aspect=e/Math.max(t,1),this.camera.updateProjectionMatrix(),this.render()}setObserverPose(e){e.headingDeg!==void 0?this.camera.rotation.set(e.pitchDeg*ya,-e.headingDeg*ya,0,"YXZ"):this.camera.rotation.set(e.pitchDeg*ya,this.camera.rotation.y,0,"YXZ"),this.camera.position.y=1.6+e.elevationM,this.camera.fov!==e.fovDeg&&(this.camera.fov=e.fovDeg,this.camera.updateProjectionMatrix())}setShowCompass(e){this.showCompass!==e&&(this.showCompass=e,this.disposeCompassLabels(),e&&this.buildCompassLabels(),this.render())}setAstronomy(e){const t=Nu(e.sun.altitudeDeg).horizon;this.buildSky(e.sun),this.buildGround(t),this.buildStars(e.stars,e.sun.altitudeDeg),this.setBodyMesh("sun",e.sun,Sa,new Oe(1,.96,.88),e.sun.magnitude),this.setMoonMesh(e.moon),this.buildPlanets(e.planets),this.scene.fog=new el(new Oe(...t),tr*.2,tr),this.render()}render(){this.renderer.render(this.scene,this.camera)}pickBodyAt(e,t){this.raycaster.setFromCamera(new ke(e,t),this.camera);const n=[...this.hitAreas.entries()],s=this.raycaster.intersectObjects(n.map(([,r])=>r))[0];if(s)return n.find(([,r])=>r===s.object)?.[0]}dispose(){this.stopTwinkle(),this.disposeMesh(this.skyMesh),this.disposeMesh(this.groundMesh),this.disposeStarTiers();for(const e of this.bodyMeshes.values())this.disposeMesh(e);this.bodyMeshes.clear();for(const e of[...this.hitAreas.keys()])this.disposeHitArea(e);for(const e of[...this.glareSprites.keys()])this.disposeGlare(e);this.disposeCompassLabels(),this.renderer.dispose()}startTwinkle(){if(this.animationFrameId!==null||this.starTiers.length===0)return;const e=t=>{this.updateTwinkle(t/1e3),this.render(),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}stopTwinkle(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}buildSky(e){this.disposeMesh(this.skyMesh);const t=new vr(tr,32,16),n=t.attributes.position,s=[];for(let a=0;a<n.count;a++){const{altitudeDeg:o,azimuthDeg:l}=f_(n.getX(a),n.getY(a),n.getZ(a)),c=g_(o,l,e.azimuthDeg,e.altitudeDeg);s.push(c[0],c[1],c[2])}t.setAttribute("color",new Pt(s,3));const r=new ls({vertexColors:!0,side:Lt,fog:!1});this.skyMesh=new Kt(t,r),this.scene.add(this.skyMesh)}buildGround(e){this.disposeMesh(this.groundMesh);const t=new il(I1,48),n=new Oe(e[0]*.35,e[1]*.35,e[2]*.35),s=new ls({color:n,fog:!0});this.groundMesh=new Kt(t,s),this.groundMesh.rotation.x=-Math.PI/2,this.groundMesh.position.y=-.5,this.scene.add(this.groundMesh)}setBodyMesh(e,t,n,s,r){if(this.disposeMesh(this.bodyMeshes.get(e)),this.disposeHitArea(e),this.disposeGlare(e),t.altitudeDeg<Bc){this.bodyMeshes.delete(e);return}const{x:a,y:o,z:l}=Zs(t.altitudeDeg,t.azimuthDeg,Oc),c=Tc(t.altitudeDeg),h=new Oe(s.r*c[0],s.g*c[1],s.b*c[2]),d=new vr(n,16,16),u=new ls({color:h,fog:!1}),m=new Kt(d,u);m.position.set(a,o,l),this.scene.add(m),this.bodyMeshes.set(e,m),this.setHitArea(e,a,o,l,n),this.setGlare(e,a,o,l,r,h)}setMoonMesh(e){const t="moon";if(this.disposeMesh(this.bodyMeshes.get(t)),this.disposeHitArea(t),this.disposeGlare(t),e.altitudeDeg<Bc){this.bodyMeshes.delete(t);return}const{x:n,y:s,z:r}=Zs(e.altitudeDeg,e.azimuthDeg,Oc),a=Tc(e.altitudeDeg),o=new Oe(a[0],a[1],a[2]),l=new rs({map:H1(e.phase),color:o,fog:!1}),c=new Ds(l);c.position.set(n,s,r);const h=Sa*2;c.scale.set(h,h,1),this.scene.add(c),this.bodyMeshes.set(t,c),this.setHitArea(t,n,s,r,Sa),this.setGlare(t,n,s,r,e.magnitude,o)}setHitArea(e,t,n,s,r){const a=new rs({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1}),o=new Ds(a);o.position.set(t,n,s);const l=r*N1;o.scale.set(l,l,1),this.scene.add(o),this.hitAreas.set(e,o)}disposeHitArea(e){const t=this.hitAreas.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.hitAreas.delete(e))}setGlare(e,t,n,s,r,a){this.disposeGlare(e);const o=x_(r);if(o<=0)return;const l=S_(o),c=new rs({map:k1(),color:a,transparent:!0,opacity:b_(o),blending:wa,depthWrite:!1,fog:!1}),h=new Ds(c);h.position.set(t,n,s),h.scale.set(l*2,l*2,1),this.scene.add(h),this.glareSprites.set(e,h)}disposeGlare(e){const t=this.glareSprites.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.glareSprites.delete(e))}buildPlanets(e){const t=new Set(["sun","moon"]);for(const n of e){t.add(n.body);const s=Ec(n.magnitude),r=bc(s),a=B1[n.body]??new Oe(1,1,1),o=new Oe(a.r*r,a.g*r,a.b*r),l=L1*(.5+.5*s);this.setBodyMesh(n.body,n.position,l,o,n.magnitude)}for(const n of[...this.bodyMeshes.keys()])t.has(n)||(this.disposeMesh(this.bodyMeshes.get(n)),this.bodyMeshes.delete(n),this.disposeHitArea(n),this.disposeGlare(n))}buildStars(e,t){if(this.disposeStarTiers(),!e||e.catalog.count===0){this.stopTwinkle();return}const{catalog:n,date:s,observer:r}=e,a=u_(t),o=W1(1337),l=[];for(let c=0;c<n.count;c++){const h=n.mag[c];if(h>a)continue;const{altitudeDeg:d,azimuthDeg:u}=T1(n.ra[c],n.dec[c],s,r);if(d<U1)continue;const{x:m,y:_,z:S}=Zs(d,u,D1);l.push({x:m,y:_,z:S,brightness:Ec(h),phase:o()*Math.PI*2,speedFactor:.7+o()*.6})}this.starTiers=Fu.map((c,h)=>{const d=l.filter(M=>A_(M.brightness)===h),u=new Float32Array(d.length*3),m=new Float32Array(d.length),_=new Float32Array(d.length),S=new Float32Array(d.length);d.forEach((M,T)=>{u[T*3]=M.x,u[T*3+1]=M.y,u[T*3+2]=M.z,m[T]=M.brightness,_[T]=M.phase,S[T]=M.speedFactor});const g=new Ft;g.setAttribute("position",new Gt(u,3));const f=new Gt(new Float32Array(d.length*3),3);g.setAttribute("color",f);const A=new Mu({vertexColors:!0,size:c.size,sizeAttenuation:!1,fog:!1}),w=new td(g,A);return this.scene.add(w),{points:w,colorAttribute:f,brightness:m,phase:_,speedFactor:S}}),this.updateTwinkle(0),this.startTwinkle()}updateTwinkle(e){for(const t of this.starTiers){const n=t.colorAttribute.array;for(let s=0;s<t.brightness.length;s++){const r=C_(t.brightness[s],{phase:t.phase[s],speedFactor:t.speedFactor[s]},e),a=bc(t.brightness[s])*r;n[s*3]=a,n[s*3+1]=a,n[s*3+2]=a}t.colorAttribute.needsUpdate=!0}}buildCompassLabels(){this.compassSprites=F1.map(({azimuthDeg:e,label:t})=>{const n=new rs({map:V1(t),depthTest:!1,fog:!1}),s=new Ds(n),{x:r,y:a,z:o}=Zs(0,e,O1);return s.position.set(r,a,o),s.scale.set(zc,zc,1),this.scene.add(s),s})}disposeCompassLabels(){for(const e of this.compassSprites)this.scene.remove(e),e.material.map?.dispose(),e.material.dispose();this.compassSprites=[]}disposeStarTiers(){for(const e of this.starTiers)this.disposeMesh(e.points);this.starTiers=[]}disposeMesh(e){if(!e)return;this.scene.remove(e),"geometry"in e&&e.geometry.dispose();const t=e.material;Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose()}}const ya=Math.PI/180;function G1(i,e,t){return Math.max(e,Math.min(t,i))}let nr;function k1(){if(nr)return nr;const i=128,e=document.createElement("canvas");e.width=i,e.height=i;const t=e.getContext("2d"),n=t.createRadialGradient(i/2,i/2,0,i/2,i/2,i/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.4,"rgba(255,255,255,0.35)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,i,i),nr=new nl(e),nr}function H1(i){const t=document.createElement("canvas");t.width=128,t.height=128;const n=t.getContext("2d"),s=128/2-2,r=128/2,a=128/2,o="#2e2b26",l="#f4f1e2";n.fillStyle=o,n.beginPath(),n.arc(r,a,s,0,Math.PI*2),n.fill();const c=G1(i.illuminatedFraction,0,1),h=i.phaseFraction<.5,d=s*Math.abs(1-2*c),u=c<.5;return n.save(),n.beginPath(),n.arc(r,a,s,0,Math.PI*2),n.clip(),n.fillStyle=l,n.beginPath(),h?(n.arc(r,a,s,-Math.PI/2,Math.PI/2,!1),n.ellipse(r,a,d,s,0,Math.PI/2,-Math.PI/2,u)):(n.arc(r,a,s,Math.PI/2,-Math.PI/2,!1),n.ellipse(r,a,d,s,0,-Math.PI/2,Math.PI/2,u)),n.fill(),n.restore(),new nl(t)}function V1(i){const e=document.createElement("canvas");e.width=128,e.height=128;const t=e.getContext("2d");return t.fillStyle="rgba(0, 0, 0, 0.55)",t.beginPath(),t.arc(64,64,60,0,Math.PI*2),t.fill(),t.fillStyle="#ffffff",t.font="bold 52px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(i,64,68),new nl(e)}function W1(i){let e=i;return function(){e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const Gc=new Map;function X1(i){const e=i.byteLength/(4*Float32Array.BYTES_PER_ELEMENT),t=e,n=t*Float32Array.BYTES_PER_ELEMENT;return{count:e,ra:new Float32Array(i,0*n,t),dec:new Float32Array(i,1*n,t),mag:new Float32Array(i,2*n,t),ci:new Float32Array(i,3*n,t)}}function q1(i){let e=Gc.get(i);return e||(e=fetch(i).then(t=>t.arrayBuffer()).then(X1),Gc.set(i,e)),e}wr();const Y1={sun:{en:"Sun",fr:"Soleil"},moon:{en:"Moon",fr:"Lune"},Venus:{en:"Venus",fr:"Vénus"},Mars:{en:"Mars",fr:"Mars"},Jupiter:{en:"Jupiter",fr:"Jupiter"},Saturn:{en:"Saturn",fr:"Saturne"}},K1=["en","fr"],$1=new URL(""+new URL("stars-mag7.5-DDr9QasD.bin",import.meta.url).href,import.meta.url).href,Z1={sun:{altitudeDeg:-3,azimuthDeg:180,magnitude:-26.7},moon:{altitudeDeg:-90,azimuthDeg:0,phase:{phaseFraction:0,illuminatedFraction:0},magnitude:-12.7},planets:[]},Ea={lat:0,lng:0,elevationM:0,headingDeg:void 0,pitchDeg:0,fovDeg:60};class J1 extends HTMLElement{static get observedAttributes(){return["src","star-catalog-src","show-compass"]}shadow;stageElement;frameElement;sceneCanvas;ufoElement;sceneRenderer;bodyTooltip;resizeObserver;lastTimeMs=0;starCatalog;handleFullscreenChange=()=>this.resizeToStage();handlePointerMove=e=>{const n=this.ufoElement.canvasElement.getBoundingClientRect();if(n.width===0||n.height===0)return;const s=(e.clientX-n.left)/n.width*2-1,r=-((e.clientY-n.top)/n.height*2-1),a=this.sceneRenderer.pickBodyAt(s,r);if(!a){this.bodyTooltip.hidden=!0;return}const o=Ho(navigator.languages,K1);this.bodyTooltip.textContent=Y1[a]?.[o]??a,this.bodyTooltip.hidden=!1;const l=this.stageElement.getBoundingClientRect();this.bodyTooltip.style.left=`${e.clientX-l.left+12}px`,this.bodyTooltip.style.top=`${e.clientY-l.top+12}px`};handlePointerLeave=()=>{this.bodyTooltip.hidden=!0};handleTimeUpdate=e=>{this.lastTimeMs=e.detail.time,this.updateAstronomy(this.lastTimeMs)};constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${Yh}</style>${qh}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.frameElement=this.shadow.getElementById("frame"),this.sceneCanvas=this.shadow.getElementById("scene-canvas"),this.sceneRenderer=new z1(this.sceneCanvas),this.bodyTooltip=this.shadow.getElementById("body-tooltip"),this.ufoElement=document.createElement(Aa),this.ufoElement.classList.add("ufo-overlay"),this.ufoElement.style.setProperty("--ufo-canvas-background","transparent"),this.ufoElement.style.setProperty("--ufo-canvas-border","none"),this.ufoElement.fullscreenTarget=this.stageElement,this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.ufoElement.addEventListener("timeupdate",this.handleTimeUpdate),this.ufoElement.canvasElement.addEventListener("pointermove",this.handlePointerMove),this.ufoElement.canvasElement.addEventListener("pointerleave",this.handlePointerLeave)}connectedCallback(){this.resizeToStage(),this.updateAstronomy(this.lastTimeMs),this.loadStars(),this.resizeObserver=new ResizeObserver(()=>this.resizeToStage()),this.resizeObserver.observe(this.frameElement),document.addEventListener("fullscreenchange",this.handleFullscreenChange);const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){this.resizeObserver?.disconnect(),document.removeEventListener("fullscreenchange",this.handleFullscreenChange),this.sceneRenderer.stopTwinkle()}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),e==="star-catalog-src"&&n!==t&&this.isConnected&&this.loadStars(),e==="show-compass"&&n!==t&&this.sceneRenderer.setShowCompass(this.hasAttribute("show-compass"))}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.ufoElement.sightingData=e,this.lastTimeMs=0,this.updateAstronomy(0)}resizeToStage(){const e=this.frameElement.getBoundingClientRect(),t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height));this.sceneCanvas.width=t,this.sceneCanvas.height=n,this.sceneRenderer.resize(t,n)}async loadStars(){const e=this.getAttribute("star-catalog-src")??$1;this.starCatalog=await q1(e),this.updateAstronomy(this.lastTimeMs)}updateAstronomy(e){const t=this.ufoElement.sighting,n=wh(t,e);this.sceneRenderer.setObserverPose(n??Ea);const s=n?.lat??Ea.lat,r=n?.lng??Ea.lng,a=P1(t.event.time??{},r);if(!a){this.sceneRenderer.setAstronomy(Z1);return}const o=new Date(a.getTime()+e),l={lat:s,lng:r,elevationM:n?.elevationM??0},c={...va("Sun",o,l),magnitude:Ma("Sun",o)},h={...va("Moon",o,l),phase:A1(o),magnitude:Ma("Moon",o)},d=b1.map(u=>({body:u,position:va(u,o,l),magnitude:Ma(u,o)}));this.sceneRenderer.setAstronomy({sun:c,moon:h,planets:d,stars:this.starCatalog?{catalog:this.starCatalog,date:o,observer:l}:void 0})}}const Go="rr0-scene";function Q1(){wr(),customElements.get(Go)||customElements.define(Go,J1)}class j1{constructor(e,t){this.timeline=e,this.clock=t}currentPointer=null;shapePrototype=null;sourceId="";start(e,t){this.sourceId=e,this.shapePrototype=t,this.currentPointer=null,this.clock.start(n=>this.recordSample(n))}onPointerMove(e,t){this.currentPointer={x:e,y:t}}stop(){this.clock.stop()}recordSample(e){if(!this.currentPointer||!this.shapePrototype)return;const t=Xc(this.shapePrototype,this.currentPointer.x,this.currentPointer.y);this.timeline.addKeyframe(e,[{sourceId:this.sourceId,shape:t}])}}class ex{constructor(e){this.intervalMs=e}rafId=null;startTime=0;lastTick=0;start(e){this.startTime=performance.now(),this.lastTick=0;const t=()=>{const n=performance.now()-this.startTime;n-this.lastTick>=this.intervalMs&&(this.lastTick=n,e(n)),this.rafId=requestAnimationFrame(t)};this.rafId=requestAnimationFrame(t)}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}}const eh={oval:"Oval",saucer:"Saucer",triangle:"Triangle",color:"Color",transparency:"Transparency",halo:"Halo",shape:"Shape",addShape:"Add shape",samplingRate:"Sampling rate (ms)",duration:"Duration (s)",durationPlaceholder:"recording length",export:"Export JSON",record:"Record",stop:"Stop",latitude:"Latitude",longitude:"Longitude",heading:"Heading (°)",headingPlaceholder:"unknown",pitch:"Tilt (°)",observationTime:"Observation start (optional)",yearPlaceholder:"year",monthPlaceholder:"month",dayPlaceholder:"day",hourPlaceholder:"hour",minutePlaceholder:"min"},tx=Object.freeze(Object.defineProperty({__proto__:null,ufoRecorderMessages_en:eh},Symbol.toStringTag,{value:"Module"}));wr();Q1();const Ii={width:48,height:28},kc="ufo-1",Hc=["oval","saucer","triangle"],nx={presetId:"oval",color:"#39ff14",transparency:0,haloScale:1.5};function ix(i){if(i.kind==="oval")return"oval";if(i.points.length===3)return"triangle";if(i.points.length===8)return"saucer"}class sx extends HTMLElement{shadow;sceneElement;ufoElement;recordButton;samplingRateInput;presetButtons;colorInput;transparencyInput;haloScaleInput;sourceSelect;addShapeButton;durationInput;exportButton;latInput;lngInput;headingInput;pitchInput;obsYearInput;obsMonthInput;obsDayInput;obsHourInput;obsMinuteInput;labelColor;labelTransparency;labelHalo;labelShape;labelSamplingRate;labelDuration;labelLatitude;labelLongitude;labelHeading;labelPitch;labelObservationTime;recorder;isRecording=!1;messages=eh;currentAppearance={...nx};currentSourceId=kc;dragState;handleKeyDown=e=>{e.key==="Escape"&&this.isRecording&&this.toggleRecording()};handleDragPointerMove=e=>this.onDragPointerMove(e);handleDragPointerUp=()=>this.endDrag();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${ch}</style>${lh}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.sceneElement=document.createElement(Go),this.sceneElement.setAttribute("show-compass",""),this.ufoElement=this.sceneElement.ufoElement,this.ufoElement.enableClickToPlay=!1,this.shadow.getElementById("ufo-slot").replaceWith(this.sceneElement),this.recordButton=this.shadow.getElementById("record"),this.samplingRateInput=this.shadow.getElementById("samplingRate"),this.presetButtons={oval:this.shadow.getElementById("preset-oval"),saucer:this.shadow.getElementById("preset-saucer"),triangle:this.shadow.getElementById("preset-triangle")},this.colorInput=this.shadow.getElementById("color"),this.transparencyInput=this.shadow.getElementById("transparency"),this.haloScaleInput=this.shadow.getElementById("haloScale"),this.sourceSelect=this.shadow.getElementById("source"),this.addShapeButton=this.shadow.getElementById("add-shape"),this.durationInput=this.shadow.getElementById("durationSeconds"),this.exportButton=this.shadow.getElementById("export"),this.latInput=this.shadow.getElementById("lat"),this.lngInput=this.shadow.getElementById("lng"),this.headingInput=this.shadow.getElementById("heading"),this.pitchInput=this.shadow.getElementById("pitch"),this.obsYearInput=this.shadow.getElementById("obs-year"),this.obsMonthInput=this.shadow.getElementById("obs-month"),this.obsDayInput=this.shadow.getElementById("obs-day"),this.obsHourInput=this.shadow.getElementById("obs-hour"),this.obsMinuteInput=this.shadow.getElementById("obs-minute"),this.labelColor=this.shadow.getElementById("label-color"),this.labelTransparency=this.shadow.getElementById("label-transparency"),this.labelHalo=this.shadow.getElementById("label-halo"),this.labelShape=this.shadow.getElementById("label-shape"),this.labelSamplingRate=this.shadow.getElementById("label-sampling-rate"),this.labelDuration=this.shadow.getElementById("label-duration"),this.labelLatitude=this.shadow.getElementById("label-lat"),this.labelLongitude=this.shadow.getElementById("label-lng"),this.labelHeading=this.shadow.getElementById("label-heading"),this.labelPitch=this.shadow.getElementById("label-pitch"),this.labelObservationTime=this.shadow.getElementById("label-observation-time"),this.ufoElement.canvasElement.addEventListener("pointerdown",t=>this.onPointerDown(t)),this.ufoElement.canvasElement.addEventListener("pointermove",t=>this.onPointerMove(t)),this.recordButton.addEventListener("click",()=>this.toggleRecording()),this.addShapeButton.addEventListener("click",()=>this.addShape()),this.exportButton.addEventListener("click",()=>this.exportJson()),this.durationInput.addEventListener("input",()=>{this.ufoElement.durationSeconds=this.durationInput.value===""?void 0:Number(this.durationInput.value),this.ufoElement.refresh()}),this.sourceSelect.addEventListener("change",()=>{this.currentSourceId=this.sourceSelect.value,this.onSelectionOrTimeChanged()}),this.ufoElement.addEventListener("timeupdate",()=>{this.onSelectionOrTimeChanged(),this.dispatchEvent(new CustomEvent("sightingchange"))}),document.addEventListener("keydown",this.handleKeyDown);for(const t of Hc)this.presetButtons[t].addEventListener("click",()=>this.setAppearance({presetId:t}));this.colorInput.addEventListener("input",()=>this.setAppearance({color:this.colorInput.value})),this.transparencyInput.addEventListener("input",()=>this.setAppearance({transparency:Number(this.transparencyInput.value)})),this.haloScaleInput.addEventListener("input",()=>this.setAppearance({haloScale:Number(this.haloScaleInput.value)}));for(const t of[this.latInput,this.lngInput,this.headingInput,this.pitchInput])t.addEventListener("input",()=>this.updateObserver());for(const t of[this.obsYearInput,this.obsMonthInput,this.obsDayInput,this.obsHourInput,this.obsMinuteInput])t.addEventListener("input",()=>this.updateObservationTime());this.updatePresetButtons(),this.setRecordButtonLabel(!1),this.applyAppearanceAtPlayhead(),this.refreshSourceList(),this.onSelectionOrTimeChanged(),this.loadLocaleMessages()}disconnectedCallback(){document.removeEventListener("keydown",this.handleKeyDown),this.endDrag()}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.endDrag(),this.ufoElement.sightingData=e,this.currentSourceId=this.ufoElement.sighting.timeline.sourceIds[0]??kc,this.refreshSourceList(),this.onSelectionOrTimeChanged(),this.durationInput.value=this.ufoElement.durationSeconds!==void 0?String(this.ufoElement.durationSeconds):"",this.syncObserverAndTimeFields()}exportJson(){const e=this.sightingData,t=`${e.witnessId??"sighting"}-sighting.json`,n=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),s=URL.createObjectURL(n),r=document.createElement("a");r.href=s,r.download=t,r.click(),URL.revokeObjectURL(s)}numberOrUndefined(e){return e===""?void 0:Number(e)}updateObserver(){const e=this.numberOrUndefined(this.latInput.value),t=this.numberOrUndefined(this.lngInput.value),n=this.numberOrUndefined(this.headingInput.value),s=this.numberOrUndefined(this.pitchInput.value)??0,r=this.ufoElement.sighting.event,a=this.ufoElement.sighting.observerTrack;r.place=e!==void 0&&t!==void 0?[{lat:e,lng:t}]:void 0,e===void 0&&t===void 0&&n===void 0&&s===0?a.clear():a.addKeyframe(0,{lat:e,lng:t,elevationM:0,headingDeg:n,pitchDeg:s,fovDeg:60}),this.ufoElement.refresh()}updateObservationTime(){const e=this.numberOrUndefined(this.obsYearInput.value),t=this.numberOrUndefined(this.obsMonthInput.value),n=this.numberOrUndefined(this.obsDayInput.value),s=this.numberOrUndefined(this.obsHourInput.value),r=this.numberOrUndefined(this.obsMinuteInput.value),a=this.ufoElement.sighting.event;a.time=e===void 0&&t===void 0&&n===void 0&&s===void 0&&r===void 0?void 0:{year:e,month:t,day:n,hour:s,minute:r},this.ufoElement.refresh()}syncObserverAndTimeFields(){const e=this.ufoElement.sighting.event,t=e.place?.[0];this.latInput.value=t?String(t.lat):"",this.lngInput.value=t?String(t.lng):"";const n=this.ufoElement.sighting.observerTrack.getLatestPoseAt(0);this.headingInput.value=n?.headingDeg!==void 0?String(n.headingDeg):"",this.pitchInput.value=String(n?.pitchDeg??0),this.obsYearInput.value=e.time?.year!==void 0?String(e.time.year):"",this.obsMonthInput.value=e.time?.month!==void 0?String(e.time.month):"",this.obsDayInput.value=e.time?.day!==void 0?String(e.time.day):"",this.obsHourInput.value=e.time?.hour!==void 0?String(e.time.hour):"",this.obsMinuteInput.value=e.time?.minute!==void 0?String(e.time.minute):""}get appearance(){return{...this.currentAppearance}}set appearance(e){this.setAppearance(e)}setAppearance(e){this.currentAppearance={...this.currentAppearance,...e},this.updatePresetButtons(),!(this.isRecording||this.ufoElement.playbackState==="playing")&&this.applyAppearanceAtPlayhead()}applyAppearanceAtPlayhead(e){const t=this.ufoElement.sighting.timeline,n=this.ufoElement.currentTime,s=t.getInterpolatedShapeAt(n,this.currentSourceId),r=this.buildAppearanceShape(e??s?.bounds??this.defaultBounds(),s);t.addKeyframe(n,[{sourceId:this.currentSourceId,shape:r}]),this.ufoElement.refresh()}buildAppearanceShape(e,t){const n=_l(e,this.currentAppearance);return t?{...n,angle:t.angle,title:t.title,selected:t.selected}:n}onSelectionOrTimeChanged(){this.syncAppearanceFromTimeline(),this.ufoElement.selectedSourceId=this.currentSourceId}syncAppearanceFromTimeline(){if(this.ufoElement.playbackState==="playing")return;const e=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(this.ufoElement.currentTime,this.currentSourceId);e&&(this.currentAppearance={presetId:ix(e)??this.currentAppearance.presetId,color:e.color,transparency:e.transparency,haloScale:e.haloScale},this.updatePresetButtons(),this.colorInput.value=this.currentAppearance.color,this.transparencyInput.value=String(this.currentAppearance.transparency),this.haloScaleInput.value=String(this.currentAppearance.haloScale))}addShape(){if(this.isRecording)return;const e=this.ufoElement.sighting.timeline,t=new Set([...e.sourceIds,this.currentSourceId]);let n=t.size+1;for(;t.has(`ufo-${n}`);)n++;this.currentSourceId=`ufo-${n}`,this.applyAppearanceAtPlayhead(this.offsetDefaultBounds(e.sourceIds.length)),this.refreshSourceList()}offsetDefaultBounds(e){const t=this.defaultBounds(),n=24;return{...t,x:t.x+e*n,y:t.y+e*n}}refreshSourceList(){const e=this.ufoElement.sighting.timeline,t=[...new Set([...e.sourceIds,this.currentSourceId])];this.sourceSelect.innerHTML="";for(const n of t){const s=document.createElement("option");s.value=n,s.textContent=n,this.sourceSelect.appendChild(s)}this.sourceSelect.value=this.currentSourceId}updatePresetButtons(){for(const e of Hc)this.presetButtons[e]?.setAttribute("aria-pressed",String(e===this.currentAppearance.presetId))}get samplingRate(){return Number(this.samplingRateInput.value)}buildPrototype(e=this.defaultBounds()){return _l(e,this.currentAppearance)}defaultBounds(){const e=this.ufoElement.canvasElement;return{x:e.width/2-Ii.width/2,y:e.height/2-Ii.height/2,width:Ii.width,height:Ii.height}}toggleRecording(){this.endDrag();const e=this.ufoElement.canvasElement;this.isRecording?(this.recorder?.stop(),this.isRecording=!1,this.setRecordButtonLabel(!1),e.style.cursor="",e.style.touchAction="",this.sourceSelect.disabled=!1,this.addShapeButton.disabled=!1,this.ufoElement.refresh(),this.refreshSourceList()):(this.recorder=new j1(this.ufoElement.sighting.timeline,new ex(this.samplingRate)),this.recorder.start(this.currentSourceId,this.buildPrototype()),this.isRecording=!0,this.setRecordButtonLabel(!0),e.style.cursor="crosshair",e.style.touchAction="none",this.sourceSelect.disabled=!0,this.addShapeButton.disabled=!0)}setRecordButtonLabel(e){this.recordButton.textContent=e?"⏹":"⏺";const t=e?this.messages.stop:this.messages.record;this.recordButton.title=t,this.recordButton.setAttribute("aria-label",t)}async loadLocaleMessages(){const e=Ho(navigator.languages,$c);e!=="en"&&this.applyMessages(await Vh(e))}applyMessages(e){this.messages=e,this.presetButtons.oval.textContent=e.oval,this.presetButtons.saucer.textContent=e.saucer,this.presetButtons.triangle.textContent=e.triangle,this.labelColor.textContent=e.color,this.labelTransparency.textContent=e.transparency,this.labelHalo.textContent=e.halo,this.labelShape.textContent=e.shape,this.labelSamplingRate.textContent=e.samplingRate,this.labelDuration.textContent=e.duration,this.durationInput.placeholder=e.durationPlaceholder,this.addShapeButton.textContent=e.addShape,this.exportButton.textContent=e.export,this.labelLatitude.textContent=e.latitude,this.labelLongitude.textContent=e.longitude,this.labelHeading.textContent=e.heading,this.headingInput.placeholder=e.headingPlaceholder,this.labelPitch.textContent=e.pitch,this.labelObservationTime.textContent=e.observationTime,this.obsYearInput.placeholder=e.yearPlaceholder,this.obsMonthInput.placeholder=e.monthPlaceholder,this.obsDayInput.placeholder=e.dayPlaceholder,this.obsHourInput.placeholder=e.hourPlaceholder,this.obsMinuteInput.placeholder=e.minutePlaceholder,this.setRecordButtonLabel(this.isRecording)}onPointerDown(e){if(this.isRecording){this.onPointerMove(e);return}const t=this.canvasPointFromEvent(e);if(!t)return;const n=this.ufoElement.sighting.timeline,s=this.ufoElement.currentTime,r=n.getInterpolatedShapeAt(s,this.currentSourceId),a=r&&Ph(r,t),o=this.ufoElement.playbackState==="playing";if(r&&a){if(o)return;this.beginDrag(a==="rotate"?"rotate":"resize",this.currentSourceId,r,t,a);return}const l=n.hitTest(s,t.x,t.y);l&&(l.sourceId!==this.currentSourceId&&(this.currentSourceId=l.sourceId,this.refreshSourceList(),this.onSelectionOrTimeChanged()),!o&&this.beginDrag("move",l.sourceId,l.shape,t))}beginDrag(e,t,n,s,r){this.dragState={kind:e,sourceId:t,original:n,handle:r,startPointer:s},document.addEventListener("pointermove",this.handleDragPointerMove),document.addEventListener("pointerup",this.handleDragPointerUp)}onDragPointerMove(e){if(!this.dragState)return;const t=this.canvasPointFromEvent(e);if(!t)return;const{kind:n,sourceId:s,original:r,handle:a,startPointer:o}=this.dragState,l=n==="move"?{...r,bounds:{...r.bounds,x:r.bounds.x+(t.x-o.x),y:r.bounds.y+(t.y-o.y)}}:n==="resize"?Dh(r,a,t):Lh(r,t);this.ufoElement.sighting.timeline.addKeyframe(this.ufoElement.currentTime,[{sourceId:s,shape:l}]),this.ufoElement.refresh()}endDrag(){this.dragState&&(this.dragState=void 0,document.removeEventListener("pointermove",this.handleDragPointerMove),document.removeEventListener("pointerup",this.handleDragPointerUp))}onPointerMove(e){if(!this.isRecording)return;const t=this.ufoElement.canvasElement,n=t.getBoundingClientRect(),s=e.clientX-n.left,r=e.clientY-n.top;this.recorder?.onPointerMove(s,r),this.ufoElement.renderer.clear(t.width,t.height),this.ufoElement.renderer.paintShape(Xc(this.buildPrototype({x:0,y:0,width:Ii.width,height:Ii.height}),s,r))}canvasPointFromEvent(e){const t=this.ufoElement.canvasElement,n=t.getBoundingClientRect();if(!(n.width===0||n.height===0))return{x:(e.clientX-n.left)/n.width*t.width,y:(e.clientY-n.top)/n.height*t.height}}}const Vc="rr0-ufo-recorder";function rx(){wr(),customElements.get(Vc)||customElements.define(Vc,sx)}rx();
@@ -205,7 +205,7 @@ input[type=range] {
205
205
  min-width: 3em;
206
206
  text-align: center;
207
207
  }
208
- `;function Q0(i,e,t){const{bounds:n}=i;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Ht(i,e,t){return i+(e-i)*t}function ul(i){const e=/^#([0-9a-f]{6})$/i.exec(i);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function j0(i){return`#${i.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function eu(i,e,t){const n=ul(i),r=ul(e);return!n||!r?t<1?i:e:j0([Ht(n[0],r[0],t),Ht(n[1],r[1],t),Ht(n[2],r[2],t)])}function tu(i,e,t){const n={x:Ht(i.bounds.x,e.bounds.x,t),y:Ht(i.bounds.y,e.bounds.y,t),width:Ht(i.bounds.width,e.bounds.width,t),height:Ht(i.bounds.height,e.bounds.height,t)},r=Ht(i.angle,e.angle,t),s=Ht(i.transparency,e.transparency,t),a=Ht(i.haloScale,e.haloScale,t),o=eu(i.color,e.color,t);return i.kind==="polygon"&&e.kind==="polygon"&&i.points.length===e.points.length?{...i,bounds:n,angle:r,transparency:s,haloScale:a,color:o,points:i.points.map((l,c)=>({x:Ht(l.x,e.points[c].x,t),y:Ht(l.y,e.points[c].y,t)}))}:{...t<1?i:e,bounds:n,angle:r,transparency:s,haloScale:a,color:o}}class Es{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);if(this.keyframes[n]?.t===e){const r=new Set(t.map(s=>s.sourceId));this.keyframes[n]={t:e,shapes:[...this.keyframes[n].shapes.filter(s=>!r.has(s.sourceId)),...t]}}else this.keyframes.splice(n,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const r=t+n>>>1;this.keyframes[r].t<e?t=r+1:n=r}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t];return n?.t===e?n:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(n=>n.sourceId===t)?.shape}getLatestShapeAt(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const r=this.keyframes[n].shapes.find(s=>s.sourceId===t);if(r)return r.shape}}getInterpolatedShapeAt(e,t){const n=this.findShapeAtOrBefore(e,t);if(n?.t===e)return n.shape;const r=this.findShapeAtOrAfter(e,t);return n?r?tu(n.shape,r.shape,(e-n.t)/(r.t-n.t)):n.shape:r?.shape}findShapeAtOrBefore(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const r=this.keyframes[n].shapes.find(s=>s.sourceId===t);if(r)return{t:this.keyframes[n].t,shape:r.shape}}}findShapeAtOrAfter(e,t){for(let n=this.findInsertIndex(e);n<this.keyframes.length;n++){const r=this.keyframes[n].shapes.find(s=>s.sourceId===t);if(r)return{t:this.keyframes[n].t,shape:r.shape}}}hitTest(e,t,n){const r=this.sourceIds;for(let s=r.length-1;s>=0;s--){const a=this.getInterpolatedShapeAt(e,r[s]);if(a&&Q0(a,t,n))return{sourceId:r[s],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const n of t.shapes)e.add(n.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new Es;for(const n of e.keyframes)t.addKeyframe(n.t,n.shapes);return t}}function nu(i,e,t){return Math.max(e,Math.min(t,i))}function iu(i,e,t){const n=((e-i)%360+540)%360-180;return((i+n*t)%360+360)%360}function qi(i,e,t){return i+(e-i)*t}function ru(i,e,t){return{lat:i.lat===void 0||e.lat===void 0?void 0:qi(i.lat,e.lat,t),lng:i.lng===void 0||e.lng===void 0?void 0:qi(i.lng,e.lng,t),elevationM:qi(i.elevationM,e.elevationM,t),headingDeg:i.headingDeg===void 0||e.headingDeg===void 0?void 0:iu(i.headingDeg,e.headingDeg,t),pitchDeg:qi(i.pitchDeg,e.pitchDeg,t),fovDeg:qi(i.fovDeg,e.fovDeg,t)}}class cr{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,pose:t}:this.keyframes.splice(n,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const r=t+n>>>1;this.keyframes[r].t<e?t=r+1:n=r}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(n?.t===e)return n.pose;const r=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?r?ru(n.pose,r.pose,nu((e-n.t)/(r.t-n.t),0,1)):n.pose:r?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new cr;for(const n of e.keyframes)t.addKeyframe(n.t,n.pose);return t}}function Ma(i){if(i.year!==void 0)return Date.UTC(i.year,(i.month??1)-1,i.day??1,i.hour??0,i.minute??0,i.second??0)}function su(i){if(i.durationSeconds!==void 0)return i.durationSeconds*1e3;const e=i.time?Ma(i.time):void 0,t=i.endTime?Ma(i.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class ys{constructor(e,t,n,r,s,a){this.event=e,this.timeline=t,this.observerTrack=n,this.witnessId=r,this.witnessName=s,this.caseId=a}static create(e,t,n){return new ys({eventType:"sighting",time:e,place:t},new Es,new cr,n)}}const au=0,ou=0,lu=60;function cu(i,e){const t=i.observerTrack.getInterpolatedPoseAt(e);if(t)return t;const n=i.event.place?.[0];if(n)return{lat:n.lat,lng:n.lng,elevationM:au,headingDeg:void 0,pitchDeg:ou,fovDeg:lu}}class uu{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const n of this.timeline.sourceIds){const r=this.timeline.getInterpolatedShapeAt(e,n);r&&t.set(n,r)}this.onFrame(e,t)}}const hu=["nw","n","ne","e","se","s","sw","w"],fu=24;function du(i,e,t){const n=i.x-e.x,r=i.y-e.y,s=Math.cos(t),a=Math.sin(t);return{x:e.x+n*s-r*a,y:e.y+n*a+r*s}}function pu(i){return{x:i.x+i.width/2,y:i.y+i.height/2}}function mu(i){const{x:e,y:t,width:n,height:r}=i.bounds,s={nw:{x:e,y:t},n:{x:e+n/2,y:t},ne:{x:e+n,y:t},e:{x:e+n,y:t+r/2},se:{x:e+n,y:t+r},s:{x:e+n/2,y:t+r},sw:{x:e,y:t+r},w:{x:e,y:t+r/2},rotate:{x:e+n/2,y:t-fu}},a=pu(i.bounds),o={};for(const l of Object.keys(s))o[l]=du(s[l],a,i.angle);return o}const Sa=6,_r=Sa/2,gu=20;class _u{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:n,width:r,height:s}=e.bounds,a=r/2,o=s/2;this.ctx.ellipse(t+a,n+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:n,width:r,height:s}=e.bounds;this.ctx.save(),this.ctx.translate(t+r/2,n+s/2),this.ctx.rotate(e.angle),this.ctx.translate(-r/2,-s/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=gu*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=mu(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const n of hu){const r=t[n];this.ctx.fillRect(r.x-_r,r.y-_r,Sa,Sa)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,_r+1,_r+1,0,0,2*Math.PI),this.ctx.fill()}}function xu(i){return{version:1,time:i.event.time,endTime:i.event.endTime,durationSeconds:i.event.durationSeconds,place:i.event.place,witnessId:i.witnessId,witnessName:i.witnessName,caseId:i.caseId,timeline:i.timeline.toJSON(),observerTrack:i.observerTrack.toJSON()}}function vu(i){return new ys({eventType:"sighting",time:i.time,endTime:i.endTime,durationSeconds:i.durationSeconds,place:i.place},Es.fromJSON(i.timeline),i.observerTrack?cr.fromJSON(i.observerTrack):new cr,i.witnessId,i.witnessName,i.caseId)}function Nc(i,e){for(const t of i){const n=t.toLowerCase().split("-")[0];if(e.includes(n))return n}return"en"}const Mu="modulepreload",Su=function(i,e){return new URL(i,e).href},hl={},fl=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");r=a(t.map(h=>{if(h=Su(h,n),h in hl)return;hl[h]=!0;const f=h.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(!!n)for(let S=o.length-1;S>=0;S--){const m=o[S];if(m.href===h&&(!f||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const _=document.createElement("link");if(_.rel=f?"stylesheet":Mu,f||(_.as="script"),_.crossOrigin="",_.href=h,c&&_.setAttribute("nonce",c),document.head.appendChild(_),f)return new Promise((S,m)=>{_.addEventListener("load",S),_.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return r.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})},Eu=["en","fr"],yu={en:()=>fl(()=>Promise.resolve().then(()=>Tu),void 0,import.meta.url).then(i=>i.ufoMessages_en),fr:()=>fl(()=>import("./assets/UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(i=>i.ufoMessages_fr)};function bu(i){return yu[i]()}const Fc={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},Tu=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:Fc},Symbol.toStringTag,{value:"Module"}));class Au extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=ys.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=Fc;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${J0}</style>${$0}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new _u(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return xu(this.currentSighting)}set sightingData(e){this.currentSighting=vu(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const n=this.playbackState!=="playing";for(const[r,s]of t){const a=n&&r===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...s,selected:!0}:s)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new uu(this.currentSighting.timeline,(t,n)=>this.onFrame(t,n));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=Nc(navigator.languages,Eu);e!=="en"&&this.applyMessages(await bu(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=su(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?Ma(e.time):void 0;const n=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&n>0?n/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return xr(e);const t=this.currentSighting.timeline.duration,n=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?pl(dl(this.realStartMs+n)):xr(n)}formatEndOfTimeline(){return this.realDurationMs===void 0?xr(this.currentSighting.timeline.duration):this.realStartMs!==void 0?pl(dl(this.realStartMs+this.realDurationMs)):xr(this.realDurationMs)}}function dl(i){const e=new Date(i);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function pl(i){if(i.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return i.second?`${e(i.hour)}:${e(i.minute??0)}:${e(i.second)}`:`${e(i.hour)}:${e(i.minute??0)}`}function xr(i){const e=Math.round(i/1e3),t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,"0")}`}const Ea="rr0-ufo";function Oc(){customElements.get(Ea)||customElements.define(Ea,Au)}/**
208
+ `;function Q0(i,e,t){const{bounds:n}=i;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Ht(i,e,t){return i+(e-i)*t}function ul(i){const e=/^#([0-9a-f]{6})$/i.exec(i);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function j0(i){return`#${i.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function eu(i,e,t){const n=ul(i),r=ul(e);return!n||!r?t<1?i:e:j0([Ht(n[0],r[0],t),Ht(n[1],r[1],t),Ht(n[2],r[2],t)])}function tu(i,e,t){const n={x:Ht(i.bounds.x,e.bounds.x,t),y:Ht(i.bounds.y,e.bounds.y,t),width:Ht(i.bounds.width,e.bounds.width,t),height:Ht(i.bounds.height,e.bounds.height,t)},r=Ht(i.angle,e.angle,t),s=Ht(i.transparency,e.transparency,t),a=Ht(i.haloScale,e.haloScale,t),o=eu(i.color,e.color,t);return i.kind==="polygon"&&e.kind==="polygon"&&i.points.length===e.points.length?{...i,bounds:n,angle:r,transparency:s,haloScale:a,color:o,points:i.points.map((l,c)=>({x:Ht(l.x,e.points[c].x,t),y:Ht(l.y,e.points[c].y,t)}))}:{...t<1?i:e,bounds:n,angle:r,transparency:s,haloScale:a,color:o}}class Es{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);if(this.keyframes[n]?.t===e){const r=new Set(t.map(s=>s.sourceId));this.keyframes[n]={t:e,shapes:[...this.keyframes[n].shapes.filter(s=>!r.has(s.sourceId)),...t]}}else this.keyframes.splice(n,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const r=t+n>>>1;this.keyframes[r].t<e?t=r+1:n=r}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t];return n?.t===e?n:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(n=>n.sourceId===t)?.shape}getLatestShapeAt(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const r=this.keyframes[n].shapes.find(s=>s.sourceId===t);if(r)return r.shape}}getInterpolatedShapeAt(e,t){const n=this.findShapeAtOrBefore(e,t);if(n?.t===e)return n.shape;const r=this.findShapeAtOrAfter(e,t);return n?r?tu(n.shape,r.shape,(e-n.t)/(r.t-n.t)):n.shape:r?.shape}findShapeAtOrBefore(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const r=this.keyframes[n].shapes.find(s=>s.sourceId===t);if(r)return{t:this.keyframes[n].t,shape:r.shape}}}findShapeAtOrAfter(e,t){for(let n=this.findInsertIndex(e);n<this.keyframes.length;n++){const r=this.keyframes[n].shapes.find(s=>s.sourceId===t);if(r)return{t:this.keyframes[n].t,shape:r.shape}}}hitTest(e,t,n){const r=this.sourceIds;for(let s=r.length-1;s>=0;s--){const a=this.getInterpolatedShapeAt(e,r[s]);if(a&&Q0(a,t,n))return{sourceId:r[s],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const n of t.shapes)e.add(n.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new Es;for(const n of e.keyframes)t.addKeyframe(n.t,n.shapes);return t}}function nu(i,e,t){return Math.max(e,Math.min(t,i))}function iu(i,e,t){const n=((e-i)%360+540)%360-180;return((i+n*t)%360+360)%360}function qi(i,e,t){return i+(e-i)*t}function ru(i,e,t){return{lat:i.lat===void 0||e.lat===void 0?void 0:qi(i.lat,e.lat,t),lng:i.lng===void 0||e.lng===void 0?void 0:qi(i.lng,e.lng,t),elevationM:qi(i.elevationM,e.elevationM,t),headingDeg:i.headingDeg===void 0||e.headingDeg===void 0?void 0:iu(i.headingDeg,e.headingDeg,t),pitchDeg:qi(i.pitchDeg,e.pitchDeg,t),fovDeg:qi(i.fovDeg,e.fovDeg,t)}}class cr{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,pose:t}:this.keyframes.splice(n,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const r=t+n>>>1;this.keyframes[r].t<e?t=r+1:n=r}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),n=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(n?.t===e)return n.pose;const r=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?r?ru(n.pose,r.pose,nu((e-n.t)/(r.t-n.t),0,1)):n.pose:r?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new cr;for(const n of e.keyframes)t.addKeyframe(n.t,n.pose);return t}}function Ma(i){if(i.year!==void 0)return Date.UTC(i.year,(i.month??1)-1,i.day??1,i.hour??0,i.minute??0,i.second??0)}function su(i){if(i.durationSeconds!==void 0)return i.durationSeconds*1e3;const e=i.time?Ma(i.time):void 0,t=i.endTime?Ma(i.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class ys{constructor(e,t,n,r,s,a){this.event=e,this.timeline=t,this.observerTrack=n,this.witnessId=r,this.witnessName=s,this.caseId=a}static create(e,t,n){return new ys({eventType:"sighting",time:e,place:t},new Es,new cr,n)}}const au=0,ou=0,lu=60;function cu(i,e){const t=i.observerTrack.getInterpolatedPoseAt(e);if(t)return t;const n=i.event.place?.[0];if(n)return{lat:n.lat,lng:n.lng,elevationM:au,headingDeg:void 0,pitchDeg:ou,fovDeg:lu}}class uu{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const n of this.timeline.sourceIds){const r=this.timeline.getInterpolatedShapeAt(e,n);r&&t.set(n,r)}this.onFrame(e,t)}}const hu=["nw","n","ne","e","se","s","sw","w"],fu=24;function du(i,e,t){const n=i.x-e.x,r=i.y-e.y,s=Math.cos(t),a=Math.sin(t);return{x:e.x+n*s-r*a,y:e.y+n*a+r*s}}function pu(i){return{x:i.x+i.width/2,y:i.y+i.height/2}}function mu(i){const{x:e,y:t,width:n,height:r}=i.bounds,s={nw:{x:e,y:t},n:{x:e+n/2,y:t},ne:{x:e+n,y:t},e:{x:e+n,y:t+r/2},se:{x:e+n,y:t+r},s:{x:e+n/2,y:t+r},sw:{x:e,y:t+r},w:{x:e,y:t+r/2},rotate:{x:e+n/2,y:t-fu}},a=pu(i.bounds),o={};for(const l of Object.keys(s))o[l]=du(s[l],a,i.angle);return o}const Sa=6,_r=Sa/2,gu=20;class _u{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:n,width:r,height:s}=e.bounds,a=r/2,o=s/2;this.ctx.ellipse(t+a,n+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:n,width:r,height:s}=e.bounds;this.ctx.save(),this.ctx.translate(t+r/2,n+s/2),this.ctx.rotate(e.angle),this.ctx.translate(-r/2,-s/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=gu*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=mu(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const n of hu){const r=t[n];this.ctx.fillRect(r.x-_r,r.y-_r,Sa,Sa)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,_r+1,_r+1,0,0,2*Math.PI),this.ctx.fill()}}function xu(i){return{version:1,time:i.event.time,endTime:i.event.endTime,durationSeconds:i.event.durationSeconds,place:i.event.place,witnessId:i.witnessId,witnessName:i.witnessName,caseId:i.caseId,timeline:i.timeline.toJSON(),observerTrack:i.observerTrack.toJSON()}}function vu(i){return new ys({eventType:"sighting",time:i.time,endTime:i.endTime,durationSeconds:i.durationSeconds,place:i.place},Es.fromJSON(i.timeline),i.observerTrack?cr.fromJSON(i.observerTrack):new cr,i.witnessId,i.witnessName,i.caseId)}function Nc(i,e){for(const t of i){const n=t.toLowerCase().split("-")[0];if(e.includes(n))return n}return"en"}const Mu="modulepreload",Su=function(i,e){return new URL(i,e).href},hl={},fl=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");r=a(t.map(h=>{if(h=Su(h,n),h in hl)return;hl[h]=!0;const f=h.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(!!n)for(let S=o.length-1;S>=0;S--){const m=o[S];if(m.href===h&&(!f||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const _=document.createElement("link");if(_.rel=f?"stylesheet":Mu,f||(_.as="script"),_.crossOrigin="",_.href=h,c&&_.setAttribute("nonce",c),document.head.appendChild(_),f)return new Promise((S,m)=>{_.addEventListener("load",S),_.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return r.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})},Eu=["en","fr"],yu={en:()=>fl(()=>Promise.resolve().then(()=>Tu),void 0,import.meta.url).then(i=>i.ufoMessages_en),fr:()=>fl(()=>import("./UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(i=>i.ufoMessages_fr)};function bu(i){return yu[i]()}const Fc={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},Tu=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:Fc},Symbol.toStringTag,{value:"Module"}));class Au extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=ys.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=Fc;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${J0}</style>${$0}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new _u(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return xu(this.currentSighting)}set sightingData(e){this.currentSighting=vu(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const n=this.playbackState!=="playing";for(const[r,s]of t){const a=n&&r===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...s,selected:!0}:s)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new uu(this.currentSighting.timeline,(t,n)=>this.onFrame(t,n));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=Nc(navigator.languages,Eu);e!=="en"&&this.applyMessages(await bu(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=su(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?Ma(e.time):void 0;const n=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&n>0?n/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return xr(e);const t=this.currentSighting.timeline.duration,n=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?pl(dl(this.realStartMs+n)):xr(n)}formatEndOfTimeline(){return this.realDurationMs===void 0?xr(this.currentSighting.timeline.duration):this.realStartMs!==void 0?pl(dl(this.realStartMs+this.realDurationMs)):xr(this.realDurationMs)}}function dl(i){const e=new Date(i);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function pl(i){if(i.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return i.second?`${e(i.hour)}:${e(i.minute??0)}:${e(i.second)}`:`${e(i.hour)}:${e(i.minute??0)}`}function xr(i){const e=Math.round(i/1e3),t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,"0")}`}const Ea="rr0-ufo";function Oc(){customElements.get(Ea)||customElements.define(Ea,Au)}/**
209
209
  * @license
210
210
  * Copyright 2010-2026 Three.js Authors
211
211
  * SPDX-License-Identifier: MIT
@@ -4351,4 +4351,4 @@ void main() {
4351
4351
  * @fileoverview Astronomy calculation library for browser scripting and Node.js.
4352
4352
  * @author Don Cross <cosinekitty@gmail.com>
4353
4353
  * @license MIT
4354
- */const b0=173.1446326846693,ei=14959787069098932e-8,it=.017453292519943295,Mc=.26179938779914946,Wn=57.29577951308232,T0=3.819718634205488,c_=365.24217,Sc=new Date("2000-01-01T12:00:00Z"),Mn=2*Math.PI,zn=3600*(180/Math.PI),Di=484813681109536e-20,A0=10800*60,u_=2*A0,Ec=7292115e-11,h_=A0/Math.PI,f_=-.17-5*Math.log10(h_),vo=.996647180302104,d_=vo*vo,Mo=6378.1366,p_=Mo/ei,w0=81.30056,Jo=.0002959122082855911,So=2825345909524226e-22,Eo=8459715185680659e-23,yo=1292024916781969e-23,bo=1524358900784276e-23;function xs(i){if(i!==!0&&i!==!1)throw console.trace(),`Value is not boolean: ${i}`;return i}function Et(i){if(!Number.isFinite(i))throw console.trace(),`Value is not a finite number: ${i}`;return i}function Pi(i){return i-Math.floor(i)}function m_(i,e){const t=i.x*i.x+i.y*i.y+i.z*i.z;if(Math.abs(t)<1e-8)throw"AngleBetween: first vector is too short.";const n=e.x*e.x+e.y*e.y+e.z*e.z;if(Math.abs(n)<1e-8)throw"AngleBetween: second vector is too short.";const r=(i.x*e.x+i.y*e.y+i.z*e.z)/Math.sqrt(t*n);return r<=-1?180:r>=1?0:Wn*Math.acos(r)}var Ee;(function(i){i.Sun="Sun",i.Moon="Moon",i.Mercury="Mercury",i.Venus="Venus",i.Earth="Earth",i.Mars="Mars",i.Jupiter="Jupiter",i.Saturn="Saturn",i.Uranus="Uranus",i.Neptune="Neptune",i.Pluto="Pluto",i.SSB="SSB",i.EMB="EMB",i.Star1="Star1",i.Star2="Star2",i.Star3="Star3",i.Star4="Star4",i.Star5="Star5",i.Star6="Star6",i.Star7="Star7",i.Star8="Star8"})(Ee||(Ee={}));const g_=[Ee.Star1,Ee.Star2,Ee.Star3,Ee.Star4,Ee.Star5,Ee.Star6,Ee.Star7,Ee.Star8],__=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function x_(i){const e=g_.indexOf(i);return e>=0?__[e]:null}function Qo(i){const e=x_(i);return e&&e.dist>0?e:null}var Zt;(function(i){i[i.From2000=0]="From2000",i[i.Into2000=1]="Into2000"})(Zt||(Zt={}));const bn={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[85831e-11,1.27079125277,161000.6857376741],[57056e-11,2.01374292245,83996.84731811189],[55736e-11,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function v_(i){var e,t,n,r,s,a,o;const l=2e3+(i-14)/c_;return l<-500?(e=(l-1820)/100,-20+32*e*e):l<500?(e=l/100,t=e*e,n=e*t,r=t*t,s=t*n,a=n*n,10583.6-1014.41*e+33.78311*t-5.952053*n-.1798452*r+.022174192*s+.0090316521*a):l<1600?(e=(l-1e3)/100,t=e*e,n=e*t,r=t*t,s=t*n,a=n*n,1574.2-556.01*e+71.23472*t+.319781*n-.8503463*r-.005050998*s+.0083572073*a):l<1700?(e=l-1600,t=e*e,n=e*t,120-.9808*e-.01532*t+n/7129):l<1800?(e=l-1700,t=e*e,n=e*t,r=t*t,8.83+.1603*e-.0059285*t+13336e-8*n-r/1174e3):l<1860?(e=l-1800,t=e*e,n=e*t,r=t*t,s=t*n,a=n*n,o=n*r,13.72-.332447*e+.0068612*t+.0041116*n-37436e-8*r+121272e-10*s-1699e-10*a+875e-12*o):l<1900?(e=l-1860,t=e*e,n=e*t,r=t*t,s=t*n,7.62+.5737*e-.251754*t+.01680668*n-.0004473624*r+s/233174):l<1920?(e=l-1900,t=e*e,n=e*t,r=t*t,-2.79+1.494119*e-.0598939*t+.0061966*n-197e-6*r):l<1941?(e=l-1920,t=e*e,n=e*t,21.2+.84493*e-.0761*t+.0020936*n):l<1961?(e=l-1950,t=e*e,n=e*t,29.07+.407*e-t/233+n/2547):l<1986?(e=l-1975,t=e*e,n=e*t,45.45+1.067*e-t/260-n/718):l<2005?(e=l-2e3,t=e*e,n=e*t,r=t*t,s=t*n,63.86+.3345*e-.060374*t+.0017275*n+651814e-9*r+2373599e-11*s):l<2050?(e=l-2e3,62.92+.32217*e+.005589*e*e):l<2150?(e=(l-1820)/100,-20+32*e*e-.5628*(2150-l)):(e=(l-1820)/100,-20+32*e*e)}let M_=v_;function yc(i){return i+M_(i)/86400}class Fi{constructor(e){if(e instanceof Fi){this.date=e.date,this.ut=e.ut,this.tt=e.tt;return}const t=1e3*3600*24;if(e instanceof Date&&Number.isFinite(e.getTime())){this.date=e,this.ut=(e.getTime()-Sc.getTime())/t,this.tt=yc(this.ut);return}if(Number.isFinite(e)){this.date=new Date(Sc.getTime()+e*t),this.ut=e,this.tt=yc(this.ut);return}throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date."}static FromTerrestrialTime(e){let t=new Fi(e);for(;;){const n=e-t.tt;if(Math.abs(n)<1e-12)return t;t=t.AddDays(n)}}toString(){return this.date.toISOString()}AddDays(e){return new Fi(this.ut+e)}}function $t(i){return i instanceof Fi?i:new Fi(i)}function S_(i){function e(u){return u%u_*Di}const t=i.tt/36525,n=e(128710479305e-5+t*1295965810481e-4),r=e(335779.526232+t*17395272628478e-4),s=e(107226070369e-5+t*1602961601209e-3),a=e(450160.398036-t*69628905431e-4);let o=Math.sin(a),l=Math.cos(a),c=(-172064161-174666*t)*o+33386*l,h=(92052331+9086*t)*l+15377*o,f=2*(r-s+a);return o=Math.sin(f),l=Math.cos(f),c+=(-13170906-1675*t)*o-13696*l,h+=(5730336-3015*t)*l-4587*o,f=2*(r+a),o=Math.sin(f),l=Math.cos(f),c+=(-2276413-234*t)*o+2796*l,h+=(978459-485*t)*l+1374*o,f=2*a,o=Math.sin(f),l=Math.cos(f),c+=(2074554+207*t)*o-698*l,h+=(-897492+470*t)*l-291*o,o=Math.sin(n),l=Math.cos(n),c+=(1475877-3633*t)*o+11817*l,h+=(73871-184*t)*l-1924*o,{dpsi:-135e-6+c*1e-7,deps:388e-6+h*1e-7}}function R0(i){var e=i.tt/36525,t=((((-434e-10*e-576e-9)*e+.0020034)*e-1831e-7)*e-46.836769)*e+84381.406;return t/3600}var Zr;function jo(i){if(!Zr||Math.abs(Zr.tt-i.tt)>1e-6){const e=S_(i),t=R0(i),n=t+e.deps/3600;Zr={tt:i.tt,dpsi:e.dpsi,deps:e.deps,ee:e.dpsi*Math.cos(t*it)/15,mobl:t,tobl:n}}return Zr}function E_(i,e){const t=i*it,n=Math.cos(t),r=Math.sin(t);return[e[0],e[1]*n-e[2]*r,e[1]*r+e[2]*n]}function y_(i,e){return E_(R0(i),e)}function b_(i){const e=i.tt/36525;function t(we,ve){const Ue=[];let De;for(De=0;De<=ve-we;++De)Ue.push(0);return{min:we,array:Ue}}function n(we,ve,Ue,De){const Ie=[];for(let Ze=0;Ze<=ve-we;++Ze)Ie.push(t(Ue,De));return{min:we,array:Ie}}function r(we,ve,Ue){const De=we.array[ve-we.min];return De.array[Ue-De.min]}function s(we,ve,Ue,De){const Ie=we.array[ve-we.min];Ie.array[Ue-Ie.min]=De}let a,o,l,c,h,f,u,g,_,S,m,d,A,w,M,T,y,R,x,b,I,C,N,Y=n(-6,6,1,4),K=n(-6,6,1,4);function O(we,ve){return r(Y,we,ve)}function W(we,ve){return r(K,we,ve)}function H(we,ve,Ue){return s(Y,we,ve,Ue)}function Q(we,ve,Ue){return s(K,we,ve,Ue)}function te(we,ve,Ue,De,Ie){Ie(we*Ue-ve*De,ve*Ue+we*De)}function ee(we){return Math.sin(Mn*we)}u=e*e,_=0,N=0,m=0,d=3422.7;var re=ee(.19833+.05611*e),ge=ee(.27869+.04508*e),He=ee(.16827-.36903*e),rt=ee(.34734-5.37261*e),We=ee(.10498-5.37899*e),Z=ee(.42681-.41855*e),se=ee(.14943-5.37511*e);for(R=.84*re+.31*ge+14.27*He+7.26*rt+.28*We+.24*Z,x=2.94*re+.31*ge+14.27*He+9.34*rt+1.12*We+.83*Z,b=-6.4*re-1.89*Z,I=.21*re+.31*ge+14.27*He-88.7*rt-15.3*We+.24*Z-1.86*se,C=R-b,g=-3332e-9*ee(.59734-5.37261*e)-539e-9*ee(.35498-5.37899*e)-64e-9*ee(.39943-5.37511*e),A=Mn*Pi(.60643382+1336.85522467*e-313e-8*u)+R/zn,w=Mn*Pi(.37489701+1325.55240982*e+2565e-8*u)+x/zn,M=Mn*Pi(.99312619+99.99735956*e-44e-8*u)+b/zn,T=Mn*Pi(.25909118+1342.2278298*e-892e-8*u)+I/zn,y=Mn*Pi(.82736186+1236.85308708*e-397e-8*u)+C/zn,h=1;h<=4;++h){switch(h){case 1:l=w,o=4,c=1.000002208;break;case 2:l=M,o=3,c=.997504612-.002495388*e;break;case 3:l=T,o=4,c=1.000002708+139.978*g;break;case 4:l=y,o=6,c=1;break;default:throw`Internal error: I = ${h}`}for(H(0,h,1),H(1,h,Math.cos(l)*c),Q(0,h,0),Q(1,h,Math.sin(l)*c),f=2;f<=o;++f)te(O(f-1,h),W(f-1,h),O(1,h),W(1,h),(we,ve)=>(H(f,h,we),Q(f,h,ve)));for(f=1;f<=o;++f)H(-f,h,O(f,h)),Q(-f,h,-W(f,h))}function ne(we,ve,Ue,De){for(var Ie={x:1,y:0},Ze=[0,we,ve,Ue,De],$e=1;$e<=4;++$e)Ze[$e]!==0&&te(Ie.x,Ie.y,O(Ze[$e],$e),W(Ze[$e],$e),(ct,ot)=>(Ie.x=ct,Ie.y=ot));return Ie}function G(we,ve,Ue,De,Ie,Ze,$e,ct){var ot=ne(Ie,Ze,$e,ct);_+=we*ot.y,N+=ve*ot.y,m+=Ue*ot.x,d+=De*ot.x}G(13.902,14.06,-.001,.2607,0,0,0,4),G(.403,-4.01,.394,.0023,0,0,0,3),G(2369.912,2373.36,.601,28.2333,0,0,0,2),G(-125.154,-112.79,-.725,-.9781,0,0,0,1),G(1.979,6.98,-.445,.0433,1,0,0,4),G(191.953,192.72,.029,3.0861,1,0,0,2),G(-8.466,-13.51,.455,-.1093,1,0,0,1),G(22639.5,22609.07,.079,186.5398,1,0,0,0),G(18.609,3.59,-.094,.0118,1,0,0,-1),G(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),G(3.215,5.44,.192,-.0386,1,0,0,-3),G(-38.428,-38.64,.001,.6008,1,0,0,-4),G(-.393,-1.43,-.092,.0086,1,0,0,-6),G(-.289,-1.59,.123,-.0053,0,1,0,4),G(-24.42,-25.1,.04,-.3,0,1,0,2),G(18.023,17.93,.007,.1494,0,1,0,1),G(-668.146,-126.98,-1.302,-.3997,0,1,0,0),G(.56,.32,-.001,-.0037,0,1,0,-1),G(-165.145,-165.06,.054,1.9178,0,1,0,-2),G(-1.877,-6.46,-.416,.0339,0,1,0,-4),G(.213,1.02,-.074,.0054,2,0,0,4),G(14.387,14.78,-.017,.2833,2,0,0,2),G(-.586,-1.2,.054,-.01,2,0,0,1),G(769.016,767.96,.107,10.1657,2,0,0,0),G(1.75,2.01,-.018,.0155,2,0,0,-1),G(-211.656,-152.53,5.679,-.3039,2,0,0,-2),G(1.225,.91,-.03,-.0088,2,0,0,-3),G(-30.773,-34.07,-.308,.3722,2,0,0,-4),G(-.57,-1.4,-.074,.0109,2,0,0,-6),G(-2.921,-11.75,.787,-.0484,1,1,0,2),G(1.267,1.52,-.022,.0164,1,1,0,1),G(-109.673,-115.18,.461,-.949,1,1,0,0),G(-205.962,-182.36,2.056,1.4437,1,1,0,-2),G(.233,.36,.012,-.0025,1,1,0,-3),G(-4.391,-9.66,-.471,.0673,1,1,0,-4),G(.283,1.53,-.111,.006,1,-1,0,4),G(14.577,31.7,-1.54,.2302,1,-1,0,2),G(147.687,138.76,.679,1.1528,1,-1,0,0),G(-1.089,.55,.021,0,1,-1,0,-1),G(28.475,23.59,-.443,-.2257,1,-1,0,-2),G(-.276,-.38,-.006,-.0036,1,-1,0,-3),G(.636,2.27,.146,-.0102,1,-1,0,-4),G(-.189,-1.68,.131,-.0028,0,2,0,2),G(-7.486,-.66,-.037,-.0086,0,2,0,0),G(-8.096,-16.35,-.74,.0918,0,2,0,-2),G(-5.741,-.04,0,-9e-4,0,0,2,2),G(.255,0,0,0,0,0,2,1),G(-411.608,-.2,0,-.0124,0,0,2,0),G(.584,.84,0,.0071,0,0,2,-1),G(-55.173,-52.14,0,-.1052,0,0,2,-2),G(.254,.25,0,-.0017,0,0,2,-3),G(.025,-1.67,0,.0031,0,0,2,-4),G(1.06,2.96,-.166,.0243,3,0,0,2),G(36.124,50.64,-1.3,.6215,3,0,0,0),G(-13.193,-16.4,.258,-.1187,3,0,0,-2),G(-1.187,-.74,.042,.0074,3,0,0,-4),G(-.293,-.31,-.002,.0046,3,0,0,-6),G(-.29,-1.45,.116,-.0051,2,1,0,2),G(-7.649,-10.56,.259,-.1038,2,1,0,0),G(-8.627,-7.59,.078,-.0192,2,1,0,-2),G(-2.74,-2.54,.022,.0324,2,1,0,-4),G(1.181,3.32,-.212,.0213,2,-1,0,2),G(9.703,11.67,-.151,.1268,2,-1,0,0),G(-.352,-.37,.001,-.0028,2,-1,0,-1),G(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),G(.36,.2,-.012,-.0043,2,-1,0,-4),G(-1.167,-1.25,.008,-.0106,1,2,0,0),G(-7.412,-6.12,.117,.0484,1,2,0,-2),G(-.311,-.65,-.032,.0044,1,2,0,-4),G(.757,1.82,-.105,.0112,1,-2,0,2),G(2.58,2.32,.027,.0196,1,-2,0,0),G(2.533,2.4,-.014,-.0212,1,-2,0,-2),G(-.344,-.57,-.025,.0036,0,3,0,-2),G(-.992,-.02,0,0,1,0,2,2),G(-45.099,-.02,0,-.001,1,0,2,0),G(-.179,-9.52,0,-.0833,1,0,2,-2),G(-.301,-.33,0,.0014,1,0,2,-4),G(-6.382,-3.37,0,-.0481,1,0,-2,2),G(39.528,85.13,0,-.7136,1,0,-2,0),G(9.366,.71,0,-.0112,1,0,-2,-2),G(.202,.02,0,0,1,0,-2,-4),G(.415,.1,0,.0013,0,1,2,0),G(-2.152,-2.26,0,-.0066,0,1,2,-2),G(-1.44,-1.3,0,.0014,0,1,-2,2),G(.384,-.04,0,0,0,1,-2,-2),G(1.938,3.6,-.145,.0401,4,0,0,0),G(-.952,-1.58,.052,-.013,4,0,0,-2),G(-.551,-.94,.032,-.0097,3,1,0,0),G(-.482,-.57,.005,-.0045,3,1,0,-2),G(.681,.96,-.026,.0115,3,-1,0,0),G(-.297,-.27,.002,-9e-4,2,2,0,-2),G(.254,.21,-.003,0,2,-2,0,-2),G(-.25,-.22,.004,.0014,1,3,0,-2),G(-3.996,0,0,4e-4,2,0,2,0),G(.557,-.75,0,-.009,2,0,2,-2),G(-.459,-.38,0,-.0053,2,0,-2,2),G(-1.298,.74,0,4e-4,2,0,-2,0),G(.538,1.14,0,-.0141,2,0,-2,-2),G(.263,.02,0,0,1,1,2,0),G(.426,.07,0,-6e-4,1,1,-2,-2),G(-.304,.03,0,3e-4,1,-1,2,0),G(-.372,-.19,0,-.0027,1,-1,-2,2),G(.418,0,0,0,0,0,4,0),G(-.33,-.04,0,0,3,0,2,0);function Ce(we,ve,Ue,De,Ie){return we*ne(ve,Ue,De,Ie).y}S=0,S+=Ce(-526.069,0,0,1,-2),S+=Ce(-3.352,0,0,1,-4),S+=Ce(44.297,1,0,1,-2),S+=Ce(-6,1,0,1,-4),S+=Ce(20.599,-1,0,1,0),S+=Ce(-30.598,-1,0,1,-2),S+=Ce(-24.649,-2,0,1,0),S+=Ce(-2,-2,0,1,-2),S+=Ce(-22.571,0,1,1,-2),S+=Ce(10.985,0,-1,1,-2),_+=.82*ee(.7736-62.5512*e)+.31*ee(.0466-125.1025*e)+.35*ee(.5785-25.1042*e)+.66*ee(.4591+1335.8075*e)+.64*ee(.313-91.568*e)+1.14*ee(.148+1331.2898*e)+.21*ee(.5918+1056.5859*e)+.44*ee(.5784+1322.8595*e)+.24*ee(.2275-5.7374*e)+.28*ee(.2965+2.6929*e)+.33*ee(.3132+6.3368*e),a=T+N/zn;let Pe=(1.000002708+139.978*g)*(18518.511+1.189+m)*Math.sin(a)-6.24*Math.sin(3*a)+S;return{geo_eclip_lon:Mn*Pi((A+_/zn)/Mn),geo_eclip_lat:Math.PI/(180*3600)*Pe,distance_au:zn*p_/(.999953253*d)}}function C0(i,e){return[i.rot[0][0]*e[0]+i.rot[1][0]*e[1]+i.rot[2][0]*e[2],i.rot[0][1]*e[0]+i.rot[1][1]*e[1]+i.rot[2][1]*e[2],i.rot[0][2]*e[0]+i.rot[1][2]*e[1]+i.rot[2][2]*e[2]]}function vs(i,e,t){const n=T_(e,t);return C0(n,i)}function T_(i,e){const t=i.tt/36525;let n=84381.406,r=((((-951e-10*t+132851e-9)*t-.00114045)*t-1.0790069)*t+5038.481507)*t,s=((((3337e-10*t-467e-9)*t-.00772503)*t+.0512623)*t-.025754)*t+n,a=((((-56e-9*t+170663e-9)*t-.00121197)*t-2.3814292)*t+10.556403)*t;n*=Di,r*=Di,s*=Di,a*=Di;const o=Math.sin(n),l=Math.cos(n),c=Math.sin(-r),h=Math.cos(-r),f=Math.sin(-s),u=Math.cos(-s),g=Math.sin(a),_=Math.cos(a),S=_*h-c*g*u,m=_*c*l+g*u*h*l-o*g*f,d=_*c*o+g*u*h*o+l*g*f,A=-g*h-c*_*u,w=-g*c*l+_*u*h*l-o*_*f,M=-g*c*o+_*u*h*o+l*_*f,T=c*f,y=-f*h*l-o*u,R=-f*h*o+u*l;if(e===Zt.Into2000)return new Ms([[S,m,d],[A,w,M],[T,y,R]]);if(e===Zt.From2000)return new Ms([[S,A,T],[m,w,y],[d,M,R]]);throw"Invalid precess direction"}function A_(i){const e=.779057273264+.00273781191135448*i.ut,t=i.ut%1;let n=360*((e+t)%1);return n<0&&(n+=360),n}let $r;function P0(i){if(!$r||$r.tt!==i.tt){const e=i.tt/36525;let t=15*jo(i).ee;const n=A_(i);let s=((t+.014506+((((-368e-10*e-29956e-9)*e-44e-8)*e+1.3915817)*e+4612.156534)*e)/3600+n)%360/15;s<0&&(s+=24),$r={tt:i.tt,st:s}}return $r.st}function w_(i,e){const t=i.latitude*it,n=Math.sin(t),r=Math.cos(t),s=1/Math.hypot(r,vo*n),a=d_*s,o=i.height/1e3,l=Mo*s+o,c=Mo*a+o,h=(15*e+i.longitude)*it,f=Math.sin(h),u=Math.cos(h);return{pos:[l*r*u/ei,l*r*f/ei,c*n/ei],vel:[-Ec*l*r*f*86400/ei,Ec*l*r*u*86400/ei,0]}}function To(i,e,t){const n=R_(e,t);return C0(n,i)}function R_(i,e){const t=jo(i),n=t.mobl*it,r=t.tobl*it,s=t.dpsi*Di,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),f=Math.sin(s),u=h,g=-f*a,_=-f*o,S=f*l,m=h*a*l+o*c,d=h*o*l-a*c,A=f*c,w=h*a*c-o*l,M=h*o*c+a*l;if(e===Zt.From2000)return new Ms([[u,S,A],[g,m,w],[_,d,M]]);if(e===Zt.Into2000)return new Ms([[u,g,_],[S,m,d],[A,w,M]]);throw"Invalid precess direction"}function D0(i,e,t){return t===Zt.Into2000?vs(To(i,e,t),e,t):To(vs(i,e,t),e,t)}function C_(i,e){const t=P0(i),n=w_(e,t).pos;return D0(n,i,Zt.Into2000)}class gt{constructor(e,t,n,r){this.x=e,this.y=t,this.z=n,this.t=r}Length(){return Math.hypot(this.x,this.y,this.z)}}class kn{constructor(e,t,n,r,s,a,o){this.x=e,this.y=t,this.z=n,this.vx=r,this.vy=s,this.vz=a,this.t=o}}class P_{constructor(e,t,n){this.lat=Et(e),this.lon=Et(t),this.dist=Et(n)}}class bc{constructor(e,t,n,r){this.ra=Et(e),this.dec=Et(t),this.dist=Et(n),this.vec=r}}class Ms{constructor(e){this.rot=e}}class D_{constructor(e,t,n,r){this.azimuth=Et(e),this.altitude=Et(t),this.ra=Et(n),this.dec=Et(r)}}class I_{constructor(e,t,n){this.vec=e,this.elat=Et(t),this.elon=Et(n)}}function L_(i,e){return new gt(i[0],i[1],i[2],e)}function U_(i,e){const t=L_(i,e),n=t.x*t.x+t.y*t.y,r=Math.sqrt(n+t.z*t.z);if(n===0){if(t.z===0)throw"Indeterminate sky coordinates";return new bc(0,t.z<0?-90:90,r,t)}let s=T0*Math.atan2(t.y,t.x);s<0&&(s+=24);const a=Wn*Math.atan2(i[2],Math.sqrt(n));return new bc(s,a,r,t)}function da(i,e){const t=i*it,n=Math.cos(t),r=Math.sin(t);return[n*e[0]+r*e[1],n*e[1]-r*e[0],e[2]]}function I0(i,e,t,n,r){let s=$t(i);el(e),Et(t),Et(n);const a=Math.sin(e.latitude*it),o=Math.cos(e.latitude*it),l=Math.sin(e.longitude*it),c=Math.cos(e.longitude*it),h=Math.sin(n*it),f=Math.cos(n*it),u=Math.sin(t*Mc),g=Math.cos(t*Mc);let _=[o*c,o*l,a],S=[-a*c,-a*l,o],m=[l,-c,0];const d=-15*P0(s);let A=da(d,_),w=da(d,S),M=da(d,m),T=[f*g,f*u,h];const y=T[0]*A[0]+T[1]*A[1]+T[2]*A[2],R=T[0]*w[0]+T[1]*w[1]+T[2]*w[2],x=T[0]*M[0]+T[1]*M[1]+T[2]*M[2];let b=Math.hypot(R,x),I;b>0?(I=-Wn*Math.atan2(x,R),I<0&&(I+=360)):I=0;let C=Wn*Math.atan2(b,y),N=t,Y=n;{let K=C,O=n1(r,90-C);if(C-=O,O>0&&C>3e-4){const W=Math.sin(C*it),H=Math.cos(C*it),Q=Math.sin(K*it),te=Math.cos(K*it),ee=[];for(let re=0;re<3;++re)ee.push((T[re]-te*A[re])/Q*W+A[re]*H);b=Math.hypot(ee[0],ee[1]),b>0?(N=T0*Math.atan2(ee[1],ee[0]),N<0&&(N+=24)):N=0,Y=Wn*Math.atan2(ee[2],b)}}return new D_(I,90-C,N,Y)}function el(i){if(!(i instanceof L0))throw`Not an instance of the Observer class: ${i}`;if(Et(i.latitude),Et(i.longitude),Et(i.height),i.latitude<-90||i.latitude>90)throw`Latitude ${i.latitude} is out of range. Must be -90..+90.`;return i}class L0{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,el(this)}}function N_(i,e,t,n,r){el(t),xs(n),xs(r);const s=$t(e),a=C_(s,t),o=No(i,s,r),l=[o.x-a[0],o.y-a[1],o.z-a[2]],c=D0(l,s,Zt.From2000);return U_(c,s)}function F_(i,e,t){const n=i.x,r=i.y*e+i.z*t,s=-i.y*t+i.z*e,a=Math.hypot(n,r);let o=0;a>0&&(o=Wn*Math.atan2(r,n),o<0&&(o+=360));let l=Wn*Math.atan2(s,a),c=new gt(n,r,s,i.t);return new I_(c,l,o)}function Ao(i){const e=jo(i.t),t=[i.x,i.y,i.z],n=vs(t,i.t,Zt.From2000),[r,s,a]=To(n,i.t,Zt.From2000),o=new gt(r,s,a,i.t),l=e.tobl*it;return F_(o,Math.cos(l),Math.sin(l))}function ki(i){const e=$t(i),t=b_(e),n=t.distance_au*Math.cos(t.geo_eclip_lat),r=[n*Math.cos(t.geo_eclip_lon),n*Math.sin(t.geo_eclip_lon),t.distance_au*Math.sin(t.geo_eclip_lat)],s=y_(e,r),a=vs(s,e,Zt.Into2000);return new gt(a[0],a[1],a[2],e)}function U0(i){const e=$t(i),t=1e-5,n=e.AddDays(-t),r=e.AddDays(+t),s=ki(n),a=ki(r);return new kn((s.x+a.x)/2,(s.y+a.y)/2,(s.z+a.z)/2,(a.x-s.x)/(2*t),(a.y-s.y)/(2*t),(a.z-s.z)/(2*t),e)}function O_(i){const e=$t(i),t=U0(e),n=1+w0;return new kn(t.x/n,t.y/n,t.z/n,t.vx/n,t.vy/n,t.vz/n,e)}function Oi(i,e,t){let n=1,r=0;for(let s of i){let a=0;for(let[l,c,h]of s)a+=l*Math.cos(c+e*h);let o=n*a;t&&(o%=Mn),r+=o,n*=e}return r}function pa(i,e){let t=1,n=0,r=0,s=0;for(let a of i){let o=0,l=0;for(let[c,h,f]of a){let u=h+e*f;o+=c*f*Math.sin(u),s>0&&(l+=c*Math.cos(u))}r+=s*n*l-t*o,n=t,t*=e,++s}return r}const ar=365250,wo=0,Ro=1,Co=2;function Po(i){return new wt(i[0]+44036e-11*i[1]-190919e-12*i[2],-479966e-12*i[0]+.917482137087*i[1]-.397776982902*i[2],.397776982902*i[1]+.917482137087*i[2])}function N0(i,e,t){const n=t*Math.cos(e),r=Math.cos(i),s=Math.sin(i);return[n*r,n*s,t*Math.sin(e)]}function lr(i,e){const t=e.tt/ar,n=Oi(i[wo],t,!0),r=Oi(i[Ro],t,!1),s=Oi(i[Co],t,!1),a=N0(n,r,s);return Po(a).ToAstroVector(e)}function Do(i,e){const t=e/ar,n=Oi(i[wo],t,!0),r=Oi(i[Ro],t,!1),s=Oi(i[Co],t,!1),a=pa(i[wo],t),o=pa(i[Ro],t),l=pa(i[Co],t),c=Math.cos(n),h=Math.sin(n),f=Math.cos(r),u=Math.sin(r),g=+(l*f*c)-s*u*c*o-s*f*h*a,_=+(l*f*h)-s*u*h*o+s*f*c*a,S=+(l*u)+s*f*o,m=N0(n,r,s),d=[g/ar,_/ar,S/ar],A=Po(m),w=Po(d);return new li(e,A,w)}function Jr(i,e,t,n){const r=n/(n+Jo),s=lr(bn[t],e);i.x+=r*s.x,i.y+=r*s.y,i.z+=r*s.z}function B_(i){const e=new gt(0,0,0,i);return Jr(e,i,Ee.Jupiter,So),Jr(e,i,Ee.Saturn,Eo),Jr(e,i,Ee.Uranus,yo),Jr(e,i,Ee.Neptune,bo),e}const Io=51,z_=29200,Ii=146,Sn=201,ii=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]];class wt{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new wt(this.x,this.y,this.z)}ToAstroVector(e){return new gt(this.x,this.y,this.z,e)}static zero(){return new wt(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(e){return new wt(this.x+e.x,this.y+e.y,this.z+e.z)}sub(e){return new wt(this.x-e.x,this.y-e.y,this.z-e.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(e){return new wt(e*this.x,e*this.y,e*this.z)}div(e){return new wt(this.x/e,this.y/e,this.z/e)}mean(e){return new wt((this.x+e.x)/2,(this.y+e.y)/2,(this.z+e.z)/2)}neg(){return new wt(-this.x,-this.y,-this.z)}}class li{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new li(this.tt,this.r,this.v)}sub(e){return new li(this.tt,this.r.sub(e.r),this.v.sub(e.v))}}function G_(i){let[e,[t,n,r],[s,a,o]]=i;return new li(e,new wt(t,n,r),new wt(s,a,o))}function Qr(i,e,t,n){const r=n/(n+Jo),s=Do(bn[t],e);return i.r.incr(s.r.mul(r)),i.v.incr(s.v.mul(r)),s}function nr(i,e,t){const n=t.sub(i),r=n.quadrature();return n.mul(e/(r*Math.sqrt(r)))}class Cs{constructor(e){let t=new li(e,new wt(0,0,0),new wt(0,0,0));this.Jupiter=Qr(t,e,Ee.Jupiter,So),this.Saturn=Qr(t,e,Ee.Saturn,Eo),this.Uranus=Qr(t,e,Ee.Uranus,yo),this.Neptune=Qr(t,e,Ee.Neptune,bo),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new li(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=nr(e,Jo,this.Sun.r);return t.incr(nr(e,So,this.Jupiter.r)),t.incr(nr(e,Eo,this.Saturn.r)),t.incr(nr(e,yo,this.Uranus.r)),t.incr(nr(e,bo,this.Neptune.r)),t}}class Ps{constructor(e,t,n,r){this.tt=e,this.r=t,this.v=n,this.a=r}clone(){return new Ps(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}}class F0{constructor(e,t){this.bary=e,this.grav=t}}function Ss(i,e,t,n){return new wt(e.x+i*(t.x+i*n.x/2),e.y+i*(t.y+i*n.y/2),e.z+i*(t.z+i*n.z/2))}function Tc(i,e,t){return new wt(e.x+i*t.x,e.y+i*t.y,e.z+i*t.z)}function Lo(i,e){const t=i-e.tt,n=new Cs(i),r=Ss(t,e.r,e.v,e.a),s=n.Acceleration(r).mean(e.a),a=Ss(t,e.r,e.v,s),o=e.v.add(s.mul(t)),l=n.Acceleration(a),c=new Ps(i,a,o,l);return new F0(n,c)}const V_=[];function O0(i,e){const t=Math.floor(i);return t<0?0:t>=e?e-1:t}function Uo(i){const e=G_(i),t=new Cs(e.tt),n=e.r.add(t.Sun.r),r=e.v.add(t.Sun.v),s=t.Acceleration(n),a=new Ps(e.tt,n,r,s);return new F0(t,a)}function k_(i,e){const t=ii[0][0];if(e<t||e>ii[Io-1][0])return null;const n=O0((e-t)/z_,Io-1);if(!i[n]){const s=i[n]=[];s[0]=Uo(ii[n]).grav,s[Sn-1]=Uo(ii[n+1]).grav;let a,o=s[0].tt;for(a=1;a<Sn-1;++a)s[a]=Lo(o+=Ii,s[a-1]).grav;o=s[Sn-1].tt;var r=[];for(r[Sn-1]=s[Sn-1],a=Sn-2;a>0;--a)r[a]=Lo(o-=Ii,r[a+1]).grav;for(a=Sn-2;a>0;--a){const l=a/(Sn-1);s[a].r=s[a].r.mul(1-l).add(r[a].r.mul(l)),s[a].v=s[a].v.mul(1-l).add(r[a].v.mul(l)),s[a].a=s[a].a.mul(1-l).add(r[a].a.mul(l))}}return i[n]}function Ac(i,e,t){let n=Uo(i);const r=Math.ceil((e-n.grav.tt)/t);for(let s=0;s<r;++s)n=Lo(s+1===r?e:n.grav.tt+t,n.grav);return n}function B0(i,e){let t,n,r;const s=k_(V_,i.tt);if(s){const a=O0((i.tt-s[0].tt)/Ii,Sn-1),o=s[a],l=s[a+1],c=o.a.mean(l.a),h=Ss(i.tt-o.tt,o.r,o.v,c),f=Tc(i.tt-o.tt,o.v,c),u=Ss(i.tt-l.tt,l.r,l.v,c),g=Tc(i.tt-l.tt,l.v,c),_=(i.tt-o.tt)/Ii;t=h.mul(1-_).add(u.mul(_)),n=f.mul(1-_).add(g.mul(_))}else{let a;i.tt<ii[0][0]?a=Ac(ii[0],i.tt,-Ii):a=Ac(ii[Io-1],i.tt,+Ii),t=a.grav.r,n=a.grav.v,r=a.bary}return r||(r=new Cs(i.tt)),t=t.sub(r.Sun.r),n=n.sub(r.Sun.v),new kn(t.x,t.y,t.z,n.x,n.y,n.z,i)}function ri(i,e){var t=$t(e);if(i in bn)return lr(bn[i],t);if(i===Ee.Pluto){const a=B0(t);return new gt(a.x,a.y,a.z,t)}if(i===Ee.Sun)return new gt(0,0,0,t);if(i===Ee.Moon){var n=lr(bn.Earth,t),r=ki(t);return new gt(n.x+r.x,n.y+r.y,n.z+r.z,t)}if(i===Ee.EMB){const a=lr(bn.Earth,t),o=ki(t),l=1+w0;return new gt(a.x+o.x/l,a.y+o.y/l,a.z+o.z/l,t)}if(i===Ee.SSB)return B_(t);const s=Qo(i);if(s){const a=new P_(s.dec,15*s.ra,s.dist);return t1(a,t)}throw`HelioVector: Unknown body "${i}"`}function H_(i,e){let t=e,n=0;for(let r=0;r<10;++r){const s=i(t),a=s.Length()/b0;if(a>1)throw"Object is too distant for light-travel solver.";const o=e.AddDays(-a);if(n=Math.abs(o.tt-t.tt),n<1e-9)return s;t=o}throw`Light-travel time solver did not converge: dt = ${n}`}class W_{constructor(e,t,n,r){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=r}Position(e){this.aberration&&(this.observerPos=ri(this.observerBody,e));const t=ri(this.targetBody,e);return new gt(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}}function X_(i,e,t,n){xs(n);const r=$t(i);if(Qo(t)){const o=ri(t,r);if(n){const c=Y_(e,r),h=new gt(o.x-c.x,o.y-c.y,o.z-c.z,r),f=b0/h.Length();return new gt(h.x+c.vx/f,h.y+c.vy/f,h.z+c.vz/f,r)}const l=ri(e,r);return new gt(o.x-l.x,o.y-l.y,o.z-l.z,r)}let s;n?s=new gt(0,0,0,r):s=ri(e,r);const a=new W_(e,t,n,s);return H_(o=>a.Position(o),r)}function No(i,e,t){xs(t);const n=$t(e);switch(i){case Ee.Earth:return new gt(0,0,0,n);case Ee.Moon:return ki(n);default:const r=X_(n,Ee.Earth,i,t);return r.t=n,r}}function q_(i,e){return new kn(i.r.x,i.r.y,i.r.z,i.v.x,i.v.y,i.v.z,e)}function Y_(i,e){const t=$t(e);switch(i){case Ee.Sun:return new kn(0,0,0,0,0,0,t);case Ee.SSB:const n=new Cs(t.tt);return new kn(-n.Sun.r.x,-n.Sun.r.y,-n.Sun.r.z,-n.Sun.v.x,-n.Sun.v.y,-n.Sun.v.z,t);case Ee.Mercury:case Ee.Venus:case Ee.Earth:case Ee.Mars:case Ee.Jupiter:case Ee.Saturn:case Ee.Uranus:case Ee.Neptune:const r=Do(bn[i],t.tt);return q_(r,t);case Ee.Pluto:return B0(t);case Ee.Moon:case Ee.EMB:const s=Do(bn.Earth,t.tt),a=i==Ee.Moon?U0(t):O_(t);return new kn(a.x+s.r.x,a.y+s.r.y,a.z+s.r.z,a.vx+s.v.x,a.vy+s.v.y,a.vz+s.v.z,t);default:if(Qo(i)){const o=ri(i,t);return new kn(o.x,o.y,o.z,0,0,0,t)}throw`HelioState: Unsupported body "${i}"`}}function K_(i){for(;i<0;)i+=360;for(;i>=360;)i-=360;return i}function Z_(i,e,t){if(i===Ee.Earth||e===Ee.Earth)throw"The Earth does not have a longitude as seen from itself.";const n=$t(t),r=No(i,n,!1),s=Ao(r),a=No(e,n,!1),o=Ao(a);return K_(s.elon-o.elon)}function $_(i,e,t,n){let r,s=0,a=0,o=0;switch(i){case Ee.Mercury:r=-.6,s=4.98,a=-4.88,o=3.02;break;case Ee.Venus:e<163.6?(r=-4.47,s=1.03,a=.57,o=.13):(r=.98,s=-1.02);break;case Ee.Mars:r=-1.52,s=1.6;break;case Ee.Jupiter:r=-9.4,s=.5;break;case Ee.Uranus:r=-7.19,s=.25;break;case Ee.Neptune:r=-6.87;break;case Ee.Pluto:r=-1,s=4;break;default:throw`VisualMagnitude: unsupported body ${i}`}const l=e/100;let c=r+l*(s+l*(a+l*o));return c+=5*Math.log10(t*n),c}function J_(i,e,t,n,r){const s=Ao(n),a=it*28.06,o=it*(169.51+382e-7*r.tt),l=it*s.elat,c=it*s.elon,h=Math.asin(Math.sin(l)*Math.cos(a)-Math.cos(l)*Math.sin(a)*Math.sin(c-o)),f=Math.sin(Math.abs(h));let u=-9+.044*i;return u+=f*(-2.6+1.2*f),u+=5*Math.log10(e*t),{mag:u,ring_tilt:Wn*h}}function Q_(i,e,t){let n=i*it,r=n*n,s=r*r,a=-12.717+1.49*Math.abs(n)+.0431*s;const o=385000.6/ei;let l=t/o;return a+=5*Math.log10(e*l),a}class j_{constructor(e,t,n,r,s,a,o,l){this.time=e,this.mag=t,this.phase_angle=n,this.helio_dist=r,this.geo_dist=s,this.gc=a,this.hc=o,this.ring_tilt=l,this.phase_fraction=(1+Math.cos(it*n))/2}}function z0(i,e){if(i===Ee.Earth)throw"The illumination of the Earth is not defined.";const t=$t(e),n=lr(bn.Earth,t);let r,s,a,o;i===Ee.Sun?(a=new gt(-n.x,-n.y,-n.z,t),s=new gt(0,0,0,t),r=0):(i===Ee.Moon?(a=ki(t),s=new gt(n.x+a.x,n.y+a.y,n.z+a.z,t)):(s=ri(i,e),a=new gt(s.x-n.x,s.y-n.y,s.z-n.z,t)),r=m_(a,s));let l=a.Length(),c=s.Length(),h;if(i===Ee.Sun)o=f_+5*Math.log10(l);else if(i===Ee.Moon)o=Q_(r,c,l);else if(i===Ee.Saturn){const f=J_(r,c,l,a,t);o=f.mag,h=f.ring_tilt}else o=$_(i,r,c,l);return new j_(t,o,r,c,l,a,s,h)}function e1(i){return Z_(Ee.Moon,Ee.Sun,i)}var wc;(function(i){i[i.Pericenter=0]="Pericenter",i[i.Apocenter=1]="Apocenter"})(wc||(wc={}));function t1(i,e){e=$t(e);const t=i.lat*it,n=i.lon*it,r=i.dist*Math.cos(t);return new gt(r*Math.cos(n),r*Math.sin(n),i.dist*Math.sin(t),e)}function n1(i,e){let t;if(Et(e),e<-90||e>90)return 0;{let n=e;n<-1&&(n=-1),t=1.02/Math.tan((n+10.3/(n+5.11))*it)/60,e<-1&&(t*=(e+90)/89)}return t}var Rc;(function(i){i.Penumbral="penumbral",i.Partial="partial",i.Annular="annular",i.Total="total"})(Rc||(Rc={}));var Cc;(function(i){i[i.Invalid=0]="Invalid",i[i.Ascending=1]="Ascending",i[i.Descending=-1]="Descending"})(Cc||(Cc={}));const i1=["Venus","Mars","Jupiter","Saturn"];function G0(i){return new L0(i.lat,i.lng,i.elevationM)}function r1(i,e,t,n){const r=I0(t,G0(n),i,e,"normal");return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}function ma(i,e,t){const n=G0(t),r=N_(Ee[i],e,n,!0,!0),s=I0(e,n,r.ra,r.dec,"normal");return{altitudeDeg:s.altitude,azimuthDeg:s.azimuth}}function ga(i,e){return z0(Ee[i],e).mag}function s1(i){const e=e1(i),t=z0(Ee.Moon,i);return{phaseFraction:e/360,illuminatedFraction:t.phase_fraction}}const a1=2e3,o1=3,l1=20;function c1(i,e){if(i.year===void 0&&i.month===void 0&&i.day===void 0&&i.hour===void 0)return;const t=i.year!==void 0,n=i.year??a1,r=i.month??(t?1:o1),s=i.day??(t?1:l1),a=Math.round(e/15);return new Date(Date.UTC(n,r-1,s,(i.hour??12)-a,i.minute??0,i.second??0))}const jr=900,u1=900,h1=850,Pc=850,_a=4,f1=1.5,d1=-1,p1=6,Dc=-4,m1=[{azimuthDeg:0,label:"N"},{azimuthDeg:45,label:"NE"},{azimuthDeg:90,label:"E"},{azimuthDeg:135,label:"SE"},{azimuthDeg:180,label:"S"},{azimuthDeg:225,label:"SO"},{azimuthDeg:270,label:"O"},{azimuthDeg:315,label:"NO"}],g1=880,Ic=40,_1={Venus:new Oe(1,.96,.85),Mars:new Oe(1,.55,.4),Jupiter:new Oe(.95,.87,.72),Saturn:new Oe(.92,.86,.68)};class x1{renderer;scene=new yh;camera;skyMesh;groundMesh;starTiers=[];bodyMeshes=new Map;hitAreas=new Map;glareSprites=new Map;compassSprites=[];showCompass=!1;animationFrameId=null;raycaster=new Xh;constructor(e){this.renderer=new kg({canvas:e,antialias:!0}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),this.camera=new Xt(60,e.width/Math.max(e.height,1),.1,jr*1.2),this.camera.position.set(0,1.6,0)}resize(e,t){this.renderer.setSize(e,t,!1),this.camera.aspect=e/Math.max(t,1),this.camera.updateProjectionMatrix(),this.render()}setObserverPose(e){e.headingDeg!==void 0?this.camera.rotation.set(e.pitchDeg*xa,-e.headingDeg*xa,0,"YXZ"):this.camera.rotation.set(e.pitchDeg*xa,this.camera.rotation.y,0,"YXZ"),this.camera.position.y=1.6+e.elevationM,this.camera.fov!==e.fovDeg&&(this.camera.fov=e.fovDeg,this.camera.updateProjectionMatrix())}setShowCompass(e){this.showCompass!==e&&(this.showCompass=e,this.disposeCompassLabels(),e&&this.buildCompassLabels(),this.render())}setAstronomy(e){const t=E0(e.sun.altitudeDeg).horizon;this.buildSky(e.sun),this.buildGround(t),this.buildStars(e.stars,e.sun.altitudeDeg),this.setBodyMesh("sun",e.sun,_a,new Oe(1,.96,.88),e.sun.magnitude),this.setMoonMesh(e.moon),this.buildPlanets(e.planets),this.scene.fog=new Yo(new Oe(...t),jr*.2,jr),this.render()}render(){this.renderer.render(this.scene,this.camera)}pickBodyAt(e,t){this.raycaster.setFromCamera(new Ve(e,t),this.camera);const n=[...this.hitAreas.entries()],r=this.raycaster.intersectObjects(n.map(([,s])=>s))[0];if(r)return n.find(([,s])=>s===r.object)?.[0]}dispose(){this.stopTwinkle(),this.disposeMesh(this.skyMesh),this.disposeMesh(this.groundMesh),this.disposeStarTiers();for(const e of this.bodyMeshes.values())this.disposeMesh(e);this.bodyMeshes.clear();for(const e of[...this.hitAreas.keys()])this.disposeHitArea(e);for(const e of[...this.glareSprites.keys()])this.disposeGlare(e);this.disposeCompassLabels(),this.renderer.dispose()}startTwinkle(){if(this.animationFrameId!==null||this.starTiers.length===0)return;const e=t=>{this.updateTwinkle(t/1e3),this.render(),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}stopTwinkle(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}buildSky(e){this.disposeMesh(this.skyMesh);const t=new gs(jr,32,16),n=t.attributes.position,r=[];for(let a=0;a<n.count;a++){const{altitudeDeg:o,azimuthDeg:l}=qg(n.getX(a),n.getY(a),n.getZ(a)),c=Zg(o,l,e.azimuthDeg,e.altitudeDeg);r.push(c[0],c[1],c[2])}t.setAttribute("color",new Pt(r,3));const s=new or({vertexColors:!0,side:Lt,fog:!1});this.skyMesh=new Kt(t,s),this.scene.add(this.skyMesh)}buildGround(e){this.disposeMesh(this.groundMesh);const t=new $o(u1,48),n=new Oe(e[0]*.35,e[1]*.35,e[2]*.35),r=new or({color:n,fog:!0});this.groundMesh=new Kt(t,r),this.groundMesh.rotation.x=-Math.PI/2,this.groundMesh.position.y=-.5,this.scene.add(this.groundMesh)}setBodyMesh(e,t,n,r,s){if(this.disposeMesh(this.bodyMeshes.get(e)),this.disposeHitArea(e),this.disposeGlare(e),t.altitudeDeg<Dc){this.bodyMeshes.delete(e);return}const{x:a,y:o,z:l}=Kr(t.altitudeDeg,t.azimuthDeg,Pc),c=xc(t.altitudeDeg),h=new Oe(r.r*c[0],r.g*c[1],r.b*c[2]),f=new gs(n,16,16),u=new or({color:h,fog:!1}),g=new Kt(f,u);g.position.set(a,o,l),this.scene.add(g),this.bodyMeshes.set(e,g),this.setHitArea(e,a,o,l,n),this.setGlare(e,a,o,l,s,h)}setMoonMesh(e){const t="moon";if(this.disposeMesh(this.bodyMeshes.get(t)),this.disposeHitArea(t),this.disposeGlare(t),e.altitudeDeg<Dc){this.bodyMeshes.delete(t);return}const{x:n,y:r,z:s}=Kr(e.altitudeDeg,e.azimuthDeg,Pc),a=xc(e.altitudeDeg),o=new Oe(a[0],a[1],a[2]),l=new rr({map:S1(e.phase),color:o,fog:!1}),c=new Pr(l);c.position.set(n,r,s);const h=_a*2;c.scale.set(h,h,1),this.scene.add(c),this.bodyMeshes.set(t,c),this.setHitArea(t,n,r,s,_a),this.setGlare(t,n,r,s,e.magnitude,o)}setHitArea(e,t,n,r,s){const a=new rr({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1}),o=new Pr(a);o.position.set(t,n,r);const l=s*p1;o.scale.set(l,l,1),this.scene.add(o),this.hitAreas.set(e,o)}disposeHitArea(e){const t=this.hitAreas.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.hitAreas.delete(e))}setGlare(e,t,n,r,s,a){this.disposeGlare(e);const o=Jg(s);if(o<=0)return;const l=e_(o),c=new rr({map:M1(),color:a,transparent:!0,opacity:i_(o),blending:ya,depthWrite:!1,fog:!1}),h=new Pr(c);h.position.set(t,n,r),h.scale.set(l*2,l*2,1),this.scene.add(h),this.glareSprites.set(e,h)}disposeGlare(e){const t=this.glareSprites.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.glareSprites.delete(e))}buildPlanets(e){const t=new Set(["sun","moon"]);for(const n of e){t.add(n.body);const r=gc(n.magnitude),s=_c(r),a=_1[n.body]??new Oe(1,1,1),o=new Oe(a.r*s,a.g*s,a.b*s),l=f1*(.5+.5*r);this.setBodyMesh(n.body,n.position,l,o,n.magnitude)}for(const n of[...this.bodyMeshes.keys()])t.has(n)||(this.disposeMesh(this.bodyMeshes.get(n)),this.bodyMeshes.delete(n),this.disposeHitArea(n),this.disposeGlare(n))}buildStars(e,t){if(this.disposeStarTiers(),!e||e.catalog.count===0){this.stopTwinkle();return}const{catalog:n,date:r,observer:s}=e,a=Hg(t),o=y1(1337),l=[];for(let c=0;c<n.count;c++){const h=n.mag[c];if(h>a)continue;const{altitudeDeg:f,azimuthDeg:u}=r1(n.ra[c],n.dec[c],r,s);if(f<d1)continue;const{x:g,y:_,z:S}=Kr(f,u,h1);l.push({x:g,y:_,z:S,brightness:gc(h),phase:o()*Math.PI*2,speedFactor:.7+o()*.6})}this.starTiers=y0.map((c,h)=>{const f=l.filter(M=>s_(M.brightness)===h),u=new Float32Array(f.length*3),g=new Float32Array(f.length),_=new Float32Array(f.length),S=new Float32Array(f.length);f.forEach((M,T)=>{u[T*3]=M.x,u[T*3+1]=M.y,u[T*3+2]=M.z,g[T]=M.brightness,_[T]=M.phase,S[T]=M.speedFactor});const m=new Ft;m.setAttribute("position",new Gt(u,3));const d=new Gt(new Float32Array(f.length*3),3);m.setAttribute("color",d);const A=new o0({vertexColors:!0,size:c.size,sizeAttenuation:!1,fog:!1}),w=new Uh(m,A);return this.scene.add(w),{points:w,colorAttribute:d,brightness:g,phase:_,speedFactor:S}}),this.updateTwinkle(0),this.startTwinkle()}updateTwinkle(e){for(const t of this.starTiers){const n=t.colorAttribute.array;for(let r=0;r<t.brightness.length;r++){const s=l_(t.brightness[r],{phase:t.phase[r],speedFactor:t.speedFactor[r]},e),a=_c(t.brightness[r])*s;n[r*3]=a,n[r*3+1]=a,n[r*3+2]=a}t.colorAttribute.needsUpdate=!0}}buildCompassLabels(){this.compassSprites=m1.map(({azimuthDeg:e,label:t})=>{const n=new rr({map:E1(t),depthTest:!1,fog:!1}),r=new Pr(n),{x:s,y:a,z:o}=Kr(0,e,g1);return r.position.set(s,a,o),r.scale.set(Ic,Ic,1),this.scene.add(r),r})}disposeCompassLabels(){for(const e of this.compassSprites)this.scene.remove(e),e.material.map?.dispose(),e.material.dispose();this.compassSprites=[]}disposeStarTiers(){for(const e of this.starTiers)this.disposeMesh(e.points);this.starTiers=[]}disposeMesh(e){if(!e)return;this.scene.remove(e),"geometry"in e&&e.geometry.dispose();const t=e.material;Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose()}}const xa=Math.PI/180;function v1(i,e,t){return Math.max(e,Math.min(t,i))}let es;function M1(){if(es)return es;const i=128,e=document.createElement("canvas");e.width=i,e.height=i;const t=e.getContext("2d"),n=t.createRadialGradient(i/2,i/2,0,i/2,i/2,i/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.4,"rgba(255,255,255,0.35)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,i,i),es=new Zo(e),es}function S1(i){const t=document.createElement("canvas");t.width=128,t.height=128;const n=t.getContext("2d"),r=128/2-2,s=128/2,a=128/2,o="#2e2b26",l="#f4f1e2";n.fillStyle=o,n.beginPath(),n.arc(s,a,r,0,Math.PI*2),n.fill();const c=v1(i.illuminatedFraction,0,1),h=i.phaseFraction<.5,f=r*Math.abs(1-2*c),u=c<.5;return n.save(),n.beginPath(),n.arc(s,a,r,0,Math.PI*2),n.clip(),n.fillStyle=l,n.beginPath(),h?(n.arc(s,a,r,-Math.PI/2,Math.PI/2,!1),n.ellipse(s,a,f,r,0,Math.PI/2,-Math.PI/2,u)):(n.arc(s,a,r,Math.PI/2,-Math.PI/2,!1),n.ellipse(s,a,f,r,0,-Math.PI/2,Math.PI/2,u)),n.fill(),n.restore(),new Zo(t)}function E1(i){const e=document.createElement("canvas");e.width=128,e.height=128;const t=e.getContext("2d");return t.fillStyle="rgba(0, 0, 0, 0.55)",t.beginPath(),t.arc(64,64,60,0,Math.PI*2),t.fill(),t.fillStyle="#ffffff",t.font="bold 52px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(i,64,68),new Zo(e)}function y1(i){let e=i;return function(){e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const Lc=new Map;function b1(i){const e=i.byteLength/(4*Float32Array.BYTES_PER_ELEMENT),t=e,n=t*Float32Array.BYTES_PER_ELEMENT;return{count:e,ra:new Float32Array(i,0*n,t),dec:new Float32Array(i,1*n,t),mag:new Float32Array(i,2*n,t),ci:new Float32Array(i,3*n,t)}}function T1(i){let e=Lc.get(i);return e||(e=fetch(i).then(t=>t.arrayBuffer()).then(b1),Lc.set(i,e)),e}Oc();const A1={sun:{en:"Sun",fr:"Soleil"},moon:{en:"Moon",fr:"Lune"},Venus:{en:"Venus",fr:"Vénus"},Mars:{en:"Mars",fr:"Mars"},Jupiter:{en:"Jupiter",fr:"Jupiter"},Saturn:{en:"Saturn",fr:"Saturne"}},w1=["en","fr"],R1=new URL(""+new URL("assets/stars-mag7.5-DDr9QasD.bin",import.meta.url).href,import.meta.url).href,C1={sun:{altitudeDeg:-3,azimuthDeg:180,magnitude:-26.7},moon:{altitudeDeg:-90,azimuthDeg:0,phase:{phaseFraction:0,illuminatedFraction:0},magnitude:-12.7},planets:[]},va={lat:0,lng:0,elevationM:0,headingDeg:void 0,pitchDeg:0,fovDeg:60};class P1 extends HTMLElement{static get observedAttributes(){return["src","star-catalog-src","show-compass"]}shadow;stageElement;frameElement;sceneCanvas;ufoElement;sceneRenderer;bodyTooltip;resizeObserver;lastTimeMs=0;starCatalog;handleFullscreenChange=()=>this.resizeToStage();handlePointerMove=e=>{const n=this.ufoElement.canvasElement.getBoundingClientRect();if(n.width===0||n.height===0)return;const r=(e.clientX-n.left)/n.width*2-1,s=-((e.clientY-n.top)/n.height*2-1),a=this.sceneRenderer.pickBodyAt(r,s);if(!a){this.bodyTooltip.hidden=!0;return}const o=Nc(navigator.languages,w1);this.bodyTooltip.textContent=A1[a]?.[o]??a,this.bodyTooltip.hidden=!1;const l=this.stageElement.getBoundingClientRect();this.bodyTooltip.style.left=`${e.clientX-l.left+12}px`,this.bodyTooltip.style.top=`${e.clientY-l.top+12}px`};handlePointerLeave=()=>{this.bodyTooltip.hidden=!0};handleTimeUpdate=e=>{this.lastTimeMs=e.detail.time,this.updateAstronomy(this.lastTimeMs)};constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${Z0}</style>${K0}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.frameElement=this.shadow.getElementById("frame"),this.sceneCanvas=this.shadow.getElementById("scene-canvas"),this.sceneRenderer=new x1(this.sceneCanvas),this.bodyTooltip=this.shadow.getElementById("body-tooltip"),this.ufoElement=document.createElement(Ea),this.ufoElement.classList.add("ufo-overlay"),this.ufoElement.style.setProperty("--ufo-canvas-background","transparent"),this.ufoElement.style.setProperty("--ufo-canvas-border","none"),this.ufoElement.fullscreenTarget=this.stageElement,this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.ufoElement.addEventListener("timeupdate",this.handleTimeUpdate),this.ufoElement.canvasElement.addEventListener("pointermove",this.handlePointerMove),this.ufoElement.canvasElement.addEventListener("pointerleave",this.handlePointerLeave)}connectedCallback(){this.resizeToStage(),this.updateAstronomy(this.lastTimeMs),this.loadStars(),this.resizeObserver=new ResizeObserver(()=>this.resizeToStage()),this.resizeObserver.observe(this.frameElement),document.addEventListener("fullscreenchange",this.handleFullscreenChange);const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){this.resizeObserver?.disconnect(),document.removeEventListener("fullscreenchange",this.handleFullscreenChange),this.sceneRenderer.stopTwinkle()}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),e==="star-catalog-src"&&n!==t&&this.isConnected&&this.loadStars(),e==="show-compass"&&n!==t&&this.sceneRenderer.setShowCompass(this.hasAttribute("show-compass"))}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.ufoElement.sightingData=e,this.lastTimeMs=0,this.updateAstronomy(0)}resizeToStage(){const e=this.frameElement.getBoundingClientRect(),t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height));this.sceneCanvas.width=t,this.sceneCanvas.height=n,this.sceneRenderer.resize(t,n)}async loadStars(){const e=this.getAttribute("star-catalog-src")??R1;this.starCatalog=await T1(e),this.updateAstronomy(this.lastTimeMs)}updateAstronomy(e){const t=this.ufoElement.sighting,n=cu(t,e);this.sceneRenderer.setObserverPose(n??va);const r=n?.lat??va.lat,s=n?.lng??va.lng,a=c1(t.event.time??{},s);if(!a){this.sceneRenderer.setAstronomy(C1);return}const o=new Date(a.getTime()+e),l={lat:r,lng:s,elevationM:n?.elevationM??0},c={...ma("Sun",o,l),magnitude:ga("Sun",o)},h={...ma("Moon",o,l),phase:s1(o),magnitude:ga("Moon",o)},f=i1.map(u=>({body:u,position:ma(u,o,l),magnitude:ga(u,o)}));this.sceneRenderer.setAstronomy({sun:c,moon:h,planets:f,stars:this.starCatalog?{catalog:this.starCatalog,date:o,observer:l}:void 0})}}const Uc="rr0-scene";function D1(){Oc(),customElements.get(Uc)||customElements.define(Uc,P1)}D1();
4354
+ */const b0=173.1446326846693,ei=14959787069098932e-8,it=.017453292519943295,Mc=.26179938779914946,Wn=57.29577951308232,T0=3.819718634205488,c_=365.24217,Sc=new Date("2000-01-01T12:00:00Z"),Mn=2*Math.PI,zn=3600*(180/Math.PI),Di=484813681109536e-20,A0=10800*60,u_=2*A0,Ec=7292115e-11,h_=A0/Math.PI,f_=-.17-5*Math.log10(h_),vo=.996647180302104,d_=vo*vo,Mo=6378.1366,p_=Mo/ei,w0=81.30056,Jo=.0002959122082855911,So=2825345909524226e-22,Eo=8459715185680659e-23,yo=1292024916781969e-23,bo=1524358900784276e-23;function xs(i){if(i!==!0&&i!==!1)throw console.trace(),`Value is not boolean: ${i}`;return i}function Et(i){if(!Number.isFinite(i))throw console.trace(),`Value is not a finite number: ${i}`;return i}function Pi(i){return i-Math.floor(i)}function m_(i,e){const t=i.x*i.x+i.y*i.y+i.z*i.z;if(Math.abs(t)<1e-8)throw"AngleBetween: first vector is too short.";const n=e.x*e.x+e.y*e.y+e.z*e.z;if(Math.abs(n)<1e-8)throw"AngleBetween: second vector is too short.";const r=(i.x*e.x+i.y*e.y+i.z*e.z)/Math.sqrt(t*n);return r<=-1?180:r>=1?0:Wn*Math.acos(r)}var Ee;(function(i){i.Sun="Sun",i.Moon="Moon",i.Mercury="Mercury",i.Venus="Venus",i.Earth="Earth",i.Mars="Mars",i.Jupiter="Jupiter",i.Saturn="Saturn",i.Uranus="Uranus",i.Neptune="Neptune",i.Pluto="Pluto",i.SSB="SSB",i.EMB="EMB",i.Star1="Star1",i.Star2="Star2",i.Star3="Star3",i.Star4="Star4",i.Star5="Star5",i.Star6="Star6",i.Star7="Star7",i.Star8="Star8"})(Ee||(Ee={}));const g_=[Ee.Star1,Ee.Star2,Ee.Star3,Ee.Star4,Ee.Star5,Ee.Star6,Ee.Star7,Ee.Star8],__=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function x_(i){const e=g_.indexOf(i);return e>=0?__[e]:null}function Qo(i){const e=x_(i);return e&&e.dist>0?e:null}var Zt;(function(i){i[i.From2000=0]="From2000",i[i.Into2000=1]="Into2000"})(Zt||(Zt={}));const bn={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[85831e-11,1.27079125277,161000.6857376741],[57056e-11,2.01374292245,83996.84731811189],[55736e-11,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function v_(i){var e,t,n,r,s,a,o;const l=2e3+(i-14)/c_;return l<-500?(e=(l-1820)/100,-20+32*e*e):l<500?(e=l/100,t=e*e,n=e*t,r=t*t,s=t*n,a=n*n,10583.6-1014.41*e+33.78311*t-5.952053*n-.1798452*r+.022174192*s+.0090316521*a):l<1600?(e=(l-1e3)/100,t=e*e,n=e*t,r=t*t,s=t*n,a=n*n,1574.2-556.01*e+71.23472*t+.319781*n-.8503463*r-.005050998*s+.0083572073*a):l<1700?(e=l-1600,t=e*e,n=e*t,120-.9808*e-.01532*t+n/7129):l<1800?(e=l-1700,t=e*e,n=e*t,r=t*t,8.83+.1603*e-.0059285*t+13336e-8*n-r/1174e3):l<1860?(e=l-1800,t=e*e,n=e*t,r=t*t,s=t*n,a=n*n,o=n*r,13.72-.332447*e+.0068612*t+.0041116*n-37436e-8*r+121272e-10*s-1699e-10*a+875e-12*o):l<1900?(e=l-1860,t=e*e,n=e*t,r=t*t,s=t*n,7.62+.5737*e-.251754*t+.01680668*n-.0004473624*r+s/233174):l<1920?(e=l-1900,t=e*e,n=e*t,r=t*t,-2.79+1.494119*e-.0598939*t+.0061966*n-197e-6*r):l<1941?(e=l-1920,t=e*e,n=e*t,21.2+.84493*e-.0761*t+.0020936*n):l<1961?(e=l-1950,t=e*e,n=e*t,29.07+.407*e-t/233+n/2547):l<1986?(e=l-1975,t=e*e,n=e*t,45.45+1.067*e-t/260-n/718):l<2005?(e=l-2e3,t=e*e,n=e*t,r=t*t,s=t*n,63.86+.3345*e-.060374*t+.0017275*n+651814e-9*r+2373599e-11*s):l<2050?(e=l-2e3,62.92+.32217*e+.005589*e*e):l<2150?(e=(l-1820)/100,-20+32*e*e-.5628*(2150-l)):(e=(l-1820)/100,-20+32*e*e)}let M_=v_;function yc(i){return i+M_(i)/86400}class Fi{constructor(e){if(e instanceof Fi){this.date=e.date,this.ut=e.ut,this.tt=e.tt;return}const t=1e3*3600*24;if(e instanceof Date&&Number.isFinite(e.getTime())){this.date=e,this.ut=(e.getTime()-Sc.getTime())/t,this.tt=yc(this.ut);return}if(Number.isFinite(e)){this.date=new Date(Sc.getTime()+e*t),this.ut=e,this.tt=yc(this.ut);return}throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date."}static FromTerrestrialTime(e){let t=new Fi(e);for(;;){const n=e-t.tt;if(Math.abs(n)<1e-12)return t;t=t.AddDays(n)}}toString(){return this.date.toISOString()}AddDays(e){return new Fi(this.ut+e)}}function $t(i){return i instanceof Fi?i:new Fi(i)}function S_(i){function e(u){return u%u_*Di}const t=i.tt/36525,n=e(128710479305e-5+t*1295965810481e-4),r=e(335779.526232+t*17395272628478e-4),s=e(107226070369e-5+t*1602961601209e-3),a=e(450160.398036-t*69628905431e-4);let o=Math.sin(a),l=Math.cos(a),c=(-172064161-174666*t)*o+33386*l,h=(92052331+9086*t)*l+15377*o,f=2*(r-s+a);return o=Math.sin(f),l=Math.cos(f),c+=(-13170906-1675*t)*o-13696*l,h+=(5730336-3015*t)*l-4587*o,f=2*(r+a),o=Math.sin(f),l=Math.cos(f),c+=(-2276413-234*t)*o+2796*l,h+=(978459-485*t)*l+1374*o,f=2*a,o=Math.sin(f),l=Math.cos(f),c+=(2074554+207*t)*o-698*l,h+=(-897492+470*t)*l-291*o,o=Math.sin(n),l=Math.cos(n),c+=(1475877-3633*t)*o+11817*l,h+=(73871-184*t)*l-1924*o,{dpsi:-135e-6+c*1e-7,deps:388e-6+h*1e-7}}function R0(i){var e=i.tt/36525,t=((((-434e-10*e-576e-9)*e+.0020034)*e-1831e-7)*e-46.836769)*e+84381.406;return t/3600}var Zr;function jo(i){if(!Zr||Math.abs(Zr.tt-i.tt)>1e-6){const e=S_(i),t=R0(i),n=t+e.deps/3600;Zr={tt:i.tt,dpsi:e.dpsi,deps:e.deps,ee:e.dpsi*Math.cos(t*it)/15,mobl:t,tobl:n}}return Zr}function E_(i,e){const t=i*it,n=Math.cos(t),r=Math.sin(t);return[e[0],e[1]*n-e[2]*r,e[1]*r+e[2]*n]}function y_(i,e){return E_(R0(i),e)}function b_(i){const e=i.tt/36525;function t(we,ve){const Ue=[];let De;for(De=0;De<=ve-we;++De)Ue.push(0);return{min:we,array:Ue}}function n(we,ve,Ue,De){const Ie=[];for(let Ze=0;Ze<=ve-we;++Ze)Ie.push(t(Ue,De));return{min:we,array:Ie}}function r(we,ve,Ue){const De=we.array[ve-we.min];return De.array[Ue-De.min]}function s(we,ve,Ue,De){const Ie=we.array[ve-we.min];Ie.array[Ue-Ie.min]=De}let a,o,l,c,h,f,u,g,_,S,m,d,A,w,M,T,y,R,x,b,I,C,N,Y=n(-6,6,1,4),K=n(-6,6,1,4);function O(we,ve){return r(Y,we,ve)}function W(we,ve){return r(K,we,ve)}function H(we,ve,Ue){return s(Y,we,ve,Ue)}function Q(we,ve,Ue){return s(K,we,ve,Ue)}function te(we,ve,Ue,De,Ie){Ie(we*Ue-ve*De,ve*Ue+we*De)}function ee(we){return Math.sin(Mn*we)}u=e*e,_=0,N=0,m=0,d=3422.7;var re=ee(.19833+.05611*e),ge=ee(.27869+.04508*e),He=ee(.16827-.36903*e),rt=ee(.34734-5.37261*e),We=ee(.10498-5.37899*e),Z=ee(.42681-.41855*e),se=ee(.14943-5.37511*e);for(R=.84*re+.31*ge+14.27*He+7.26*rt+.28*We+.24*Z,x=2.94*re+.31*ge+14.27*He+9.34*rt+1.12*We+.83*Z,b=-6.4*re-1.89*Z,I=.21*re+.31*ge+14.27*He-88.7*rt-15.3*We+.24*Z-1.86*se,C=R-b,g=-3332e-9*ee(.59734-5.37261*e)-539e-9*ee(.35498-5.37899*e)-64e-9*ee(.39943-5.37511*e),A=Mn*Pi(.60643382+1336.85522467*e-313e-8*u)+R/zn,w=Mn*Pi(.37489701+1325.55240982*e+2565e-8*u)+x/zn,M=Mn*Pi(.99312619+99.99735956*e-44e-8*u)+b/zn,T=Mn*Pi(.25909118+1342.2278298*e-892e-8*u)+I/zn,y=Mn*Pi(.82736186+1236.85308708*e-397e-8*u)+C/zn,h=1;h<=4;++h){switch(h){case 1:l=w,o=4,c=1.000002208;break;case 2:l=M,o=3,c=.997504612-.002495388*e;break;case 3:l=T,o=4,c=1.000002708+139.978*g;break;case 4:l=y,o=6,c=1;break;default:throw`Internal error: I = ${h}`}for(H(0,h,1),H(1,h,Math.cos(l)*c),Q(0,h,0),Q(1,h,Math.sin(l)*c),f=2;f<=o;++f)te(O(f-1,h),W(f-1,h),O(1,h),W(1,h),(we,ve)=>(H(f,h,we),Q(f,h,ve)));for(f=1;f<=o;++f)H(-f,h,O(f,h)),Q(-f,h,-W(f,h))}function ne(we,ve,Ue,De){for(var Ie={x:1,y:0},Ze=[0,we,ve,Ue,De],$e=1;$e<=4;++$e)Ze[$e]!==0&&te(Ie.x,Ie.y,O(Ze[$e],$e),W(Ze[$e],$e),(ct,ot)=>(Ie.x=ct,Ie.y=ot));return Ie}function G(we,ve,Ue,De,Ie,Ze,$e,ct){var ot=ne(Ie,Ze,$e,ct);_+=we*ot.y,N+=ve*ot.y,m+=Ue*ot.x,d+=De*ot.x}G(13.902,14.06,-.001,.2607,0,0,0,4),G(.403,-4.01,.394,.0023,0,0,0,3),G(2369.912,2373.36,.601,28.2333,0,0,0,2),G(-125.154,-112.79,-.725,-.9781,0,0,0,1),G(1.979,6.98,-.445,.0433,1,0,0,4),G(191.953,192.72,.029,3.0861,1,0,0,2),G(-8.466,-13.51,.455,-.1093,1,0,0,1),G(22639.5,22609.07,.079,186.5398,1,0,0,0),G(18.609,3.59,-.094,.0118,1,0,0,-1),G(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),G(3.215,5.44,.192,-.0386,1,0,0,-3),G(-38.428,-38.64,.001,.6008,1,0,0,-4),G(-.393,-1.43,-.092,.0086,1,0,0,-6),G(-.289,-1.59,.123,-.0053,0,1,0,4),G(-24.42,-25.1,.04,-.3,0,1,0,2),G(18.023,17.93,.007,.1494,0,1,0,1),G(-668.146,-126.98,-1.302,-.3997,0,1,0,0),G(.56,.32,-.001,-.0037,0,1,0,-1),G(-165.145,-165.06,.054,1.9178,0,1,0,-2),G(-1.877,-6.46,-.416,.0339,0,1,0,-4),G(.213,1.02,-.074,.0054,2,0,0,4),G(14.387,14.78,-.017,.2833,2,0,0,2),G(-.586,-1.2,.054,-.01,2,0,0,1),G(769.016,767.96,.107,10.1657,2,0,0,0),G(1.75,2.01,-.018,.0155,2,0,0,-1),G(-211.656,-152.53,5.679,-.3039,2,0,0,-2),G(1.225,.91,-.03,-.0088,2,0,0,-3),G(-30.773,-34.07,-.308,.3722,2,0,0,-4),G(-.57,-1.4,-.074,.0109,2,0,0,-6),G(-2.921,-11.75,.787,-.0484,1,1,0,2),G(1.267,1.52,-.022,.0164,1,1,0,1),G(-109.673,-115.18,.461,-.949,1,1,0,0),G(-205.962,-182.36,2.056,1.4437,1,1,0,-2),G(.233,.36,.012,-.0025,1,1,0,-3),G(-4.391,-9.66,-.471,.0673,1,1,0,-4),G(.283,1.53,-.111,.006,1,-1,0,4),G(14.577,31.7,-1.54,.2302,1,-1,0,2),G(147.687,138.76,.679,1.1528,1,-1,0,0),G(-1.089,.55,.021,0,1,-1,0,-1),G(28.475,23.59,-.443,-.2257,1,-1,0,-2),G(-.276,-.38,-.006,-.0036,1,-1,0,-3),G(.636,2.27,.146,-.0102,1,-1,0,-4),G(-.189,-1.68,.131,-.0028,0,2,0,2),G(-7.486,-.66,-.037,-.0086,0,2,0,0),G(-8.096,-16.35,-.74,.0918,0,2,0,-2),G(-5.741,-.04,0,-9e-4,0,0,2,2),G(.255,0,0,0,0,0,2,1),G(-411.608,-.2,0,-.0124,0,0,2,0),G(.584,.84,0,.0071,0,0,2,-1),G(-55.173,-52.14,0,-.1052,0,0,2,-2),G(.254,.25,0,-.0017,0,0,2,-3),G(.025,-1.67,0,.0031,0,0,2,-4),G(1.06,2.96,-.166,.0243,3,0,0,2),G(36.124,50.64,-1.3,.6215,3,0,0,0),G(-13.193,-16.4,.258,-.1187,3,0,0,-2),G(-1.187,-.74,.042,.0074,3,0,0,-4),G(-.293,-.31,-.002,.0046,3,0,0,-6),G(-.29,-1.45,.116,-.0051,2,1,0,2),G(-7.649,-10.56,.259,-.1038,2,1,0,0),G(-8.627,-7.59,.078,-.0192,2,1,0,-2),G(-2.74,-2.54,.022,.0324,2,1,0,-4),G(1.181,3.32,-.212,.0213,2,-1,0,2),G(9.703,11.67,-.151,.1268,2,-1,0,0),G(-.352,-.37,.001,-.0028,2,-1,0,-1),G(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),G(.36,.2,-.012,-.0043,2,-1,0,-4),G(-1.167,-1.25,.008,-.0106,1,2,0,0),G(-7.412,-6.12,.117,.0484,1,2,0,-2),G(-.311,-.65,-.032,.0044,1,2,0,-4),G(.757,1.82,-.105,.0112,1,-2,0,2),G(2.58,2.32,.027,.0196,1,-2,0,0),G(2.533,2.4,-.014,-.0212,1,-2,0,-2),G(-.344,-.57,-.025,.0036,0,3,0,-2),G(-.992,-.02,0,0,1,0,2,2),G(-45.099,-.02,0,-.001,1,0,2,0),G(-.179,-9.52,0,-.0833,1,0,2,-2),G(-.301,-.33,0,.0014,1,0,2,-4),G(-6.382,-3.37,0,-.0481,1,0,-2,2),G(39.528,85.13,0,-.7136,1,0,-2,0),G(9.366,.71,0,-.0112,1,0,-2,-2),G(.202,.02,0,0,1,0,-2,-4),G(.415,.1,0,.0013,0,1,2,0),G(-2.152,-2.26,0,-.0066,0,1,2,-2),G(-1.44,-1.3,0,.0014,0,1,-2,2),G(.384,-.04,0,0,0,1,-2,-2),G(1.938,3.6,-.145,.0401,4,0,0,0),G(-.952,-1.58,.052,-.013,4,0,0,-2),G(-.551,-.94,.032,-.0097,3,1,0,0),G(-.482,-.57,.005,-.0045,3,1,0,-2),G(.681,.96,-.026,.0115,3,-1,0,0),G(-.297,-.27,.002,-9e-4,2,2,0,-2),G(.254,.21,-.003,0,2,-2,0,-2),G(-.25,-.22,.004,.0014,1,3,0,-2),G(-3.996,0,0,4e-4,2,0,2,0),G(.557,-.75,0,-.009,2,0,2,-2),G(-.459,-.38,0,-.0053,2,0,-2,2),G(-1.298,.74,0,4e-4,2,0,-2,0),G(.538,1.14,0,-.0141,2,0,-2,-2),G(.263,.02,0,0,1,1,2,0),G(.426,.07,0,-6e-4,1,1,-2,-2),G(-.304,.03,0,3e-4,1,-1,2,0),G(-.372,-.19,0,-.0027,1,-1,-2,2),G(.418,0,0,0,0,0,4,0),G(-.33,-.04,0,0,3,0,2,0);function Ce(we,ve,Ue,De,Ie){return we*ne(ve,Ue,De,Ie).y}S=0,S+=Ce(-526.069,0,0,1,-2),S+=Ce(-3.352,0,0,1,-4),S+=Ce(44.297,1,0,1,-2),S+=Ce(-6,1,0,1,-4),S+=Ce(20.599,-1,0,1,0),S+=Ce(-30.598,-1,0,1,-2),S+=Ce(-24.649,-2,0,1,0),S+=Ce(-2,-2,0,1,-2),S+=Ce(-22.571,0,1,1,-2),S+=Ce(10.985,0,-1,1,-2),_+=.82*ee(.7736-62.5512*e)+.31*ee(.0466-125.1025*e)+.35*ee(.5785-25.1042*e)+.66*ee(.4591+1335.8075*e)+.64*ee(.313-91.568*e)+1.14*ee(.148+1331.2898*e)+.21*ee(.5918+1056.5859*e)+.44*ee(.5784+1322.8595*e)+.24*ee(.2275-5.7374*e)+.28*ee(.2965+2.6929*e)+.33*ee(.3132+6.3368*e),a=T+N/zn;let Pe=(1.000002708+139.978*g)*(18518.511+1.189+m)*Math.sin(a)-6.24*Math.sin(3*a)+S;return{geo_eclip_lon:Mn*Pi((A+_/zn)/Mn),geo_eclip_lat:Math.PI/(180*3600)*Pe,distance_au:zn*p_/(.999953253*d)}}function C0(i,e){return[i.rot[0][0]*e[0]+i.rot[1][0]*e[1]+i.rot[2][0]*e[2],i.rot[0][1]*e[0]+i.rot[1][1]*e[1]+i.rot[2][1]*e[2],i.rot[0][2]*e[0]+i.rot[1][2]*e[1]+i.rot[2][2]*e[2]]}function vs(i,e,t){const n=T_(e,t);return C0(n,i)}function T_(i,e){const t=i.tt/36525;let n=84381.406,r=((((-951e-10*t+132851e-9)*t-.00114045)*t-1.0790069)*t+5038.481507)*t,s=((((3337e-10*t-467e-9)*t-.00772503)*t+.0512623)*t-.025754)*t+n,a=((((-56e-9*t+170663e-9)*t-.00121197)*t-2.3814292)*t+10.556403)*t;n*=Di,r*=Di,s*=Di,a*=Di;const o=Math.sin(n),l=Math.cos(n),c=Math.sin(-r),h=Math.cos(-r),f=Math.sin(-s),u=Math.cos(-s),g=Math.sin(a),_=Math.cos(a),S=_*h-c*g*u,m=_*c*l+g*u*h*l-o*g*f,d=_*c*o+g*u*h*o+l*g*f,A=-g*h-c*_*u,w=-g*c*l+_*u*h*l-o*_*f,M=-g*c*o+_*u*h*o+l*_*f,T=c*f,y=-f*h*l-o*u,R=-f*h*o+u*l;if(e===Zt.Into2000)return new Ms([[S,m,d],[A,w,M],[T,y,R]]);if(e===Zt.From2000)return new Ms([[S,A,T],[m,w,y],[d,M,R]]);throw"Invalid precess direction"}function A_(i){const e=.779057273264+.00273781191135448*i.ut,t=i.ut%1;let n=360*((e+t)%1);return n<0&&(n+=360),n}let $r;function P0(i){if(!$r||$r.tt!==i.tt){const e=i.tt/36525;let t=15*jo(i).ee;const n=A_(i);let s=((t+.014506+((((-368e-10*e-29956e-9)*e-44e-8)*e+1.3915817)*e+4612.156534)*e)/3600+n)%360/15;s<0&&(s+=24),$r={tt:i.tt,st:s}}return $r.st}function w_(i,e){const t=i.latitude*it,n=Math.sin(t),r=Math.cos(t),s=1/Math.hypot(r,vo*n),a=d_*s,o=i.height/1e3,l=Mo*s+o,c=Mo*a+o,h=(15*e+i.longitude)*it,f=Math.sin(h),u=Math.cos(h);return{pos:[l*r*u/ei,l*r*f/ei,c*n/ei],vel:[-Ec*l*r*f*86400/ei,Ec*l*r*u*86400/ei,0]}}function To(i,e,t){const n=R_(e,t);return C0(n,i)}function R_(i,e){const t=jo(i),n=t.mobl*it,r=t.tobl*it,s=t.dpsi*Di,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),f=Math.sin(s),u=h,g=-f*a,_=-f*o,S=f*l,m=h*a*l+o*c,d=h*o*l-a*c,A=f*c,w=h*a*c-o*l,M=h*o*c+a*l;if(e===Zt.From2000)return new Ms([[u,S,A],[g,m,w],[_,d,M]]);if(e===Zt.Into2000)return new Ms([[u,g,_],[S,m,d],[A,w,M]]);throw"Invalid precess direction"}function D0(i,e,t){return t===Zt.Into2000?vs(To(i,e,t),e,t):To(vs(i,e,t),e,t)}function C_(i,e){const t=P0(i),n=w_(e,t).pos;return D0(n,i,Zt.Into2000)}class gt{constructor(e,t,n,r){this.x=e,this.y=t,this.z=n,this.t=r}Length(){return Math.hypot(this.x,this.y,this.z)}}class kn{constructor(e,t,n,r,s,a,o){this.x=e,this.y=t,this.z=n,this.vx=r,this.vy=s,this.vz=a,this.t=o}}class P_{constructor(e,t,n){this.lat=Et(e),this.lon=Et(t),this.dist=Et(n)}}class bc{constructor(e,t,n,r){this.ra=Et(e),this.dec=Et(t),this.dist=Et(n),this.vec=r}}class Ms{constructor(e){this.rot=e}}class D_{constructor(e,t,n,r){this.azimuth=Et(e),this.altitude=Et(t),this.ra=Et(n),this.dec=Et(r)}}class I_{constructor(e,t,n){this.vec=e,this.elat=Et(t),this.elon=Et(n)}}function L_(i,e){return new gt(i[0],i[1],i[2],e)}function U_(i,e){const t=L_(i,e),n=t.x*t.x+t.y*t.y,r=Math.sqrt(n+t.z*t.z);if(n===0){if(t.z===0)throw"Indeterminate sky coordinates";return new bc(0,t.z<0?-90:90,r,t)}let s=T0*Math.atan2(t.y,t.x);s<0&&(s+=24);const a=Wn*Math.atan2(i[2],Math.sqrt(n));return new bc(s,a,r,t)}function da(i,e){const t=i*it,n=Math.cos(t),r=Math.sin(t);return[n*e[0]+r*e[1],n*e[1]-r*e[0],e[2]]}function I0(i,e,t,n,r){let s=$t(i);el(e),Et(t),Et(n);const a=Math.sin(e.latitude*it),o=Math.cos(e.latitude*it),l=Math.sin(e.longitude*it),c=Math.cos(e.longitude*it),h=Math.sin(n*it),f=Math.cos(n*it),u=Math.sin(t*Mc),g=Math.cos(t*Mc);let _=[o*c,o*l,a],S=[-a*c,-a*l,o],m=[l,-c,0];const d=-15*P0(s);let A=da(d,_),w=da(d,S),M=da(d,m),T=[f*g,f*u,h];const y=T[0]*A[0]+T[1]*A[1]+T[2]*A[2],R=T[0]*w[0]+T[1]*w[1]+T[2]*w[2],x=T[0]*M[0]+T[1]*M[1]+T[2]*M[2];let b=Math.hypot(R,x),I;b>0?(I=-Wn*Math.atan2(x,R),I<0&&(I+=360)):I=0;let C=Wn*Math.atan2(b,y),N=t,Y=n;{let K=C,O=n1(r,90-C);if(C-=O,O>0&&C>3e-4){const W=Math.sin(C*it),H=Math.cos(C*it),Q=Math.sin(K*it),te=Math.cos(K*it),ee=[];for(let re=0;re<3;++re)ee.push((T[re]-te*A[re])/Q*W+A[re]*H);b=Math.hypot(ee[0],ee[1]),b>0?(N=T0*Math.atan2(ee[1],ee[0]),N<0&&(N+=24)):N=0,Y=Wn*Math.atan2(ee[2],b)}}return new D_(I,90-C,N,Y)}function el(i){if(!(i instanceof L0))throw`Not an instance of the Observer class: ${i}`;if(Et(i.latitude),Et(i.longitude),Et(i.height),i.latitude<-90||i.latitude>90)throw`Latitude ${i.latitude} is out of range. Must be -90..+90.`;return i}class L0{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,el(this)}}function N_(i,e,t,n,r){el(t),xs(n),xs(r);const s=$t(e),a=C_(s,t),o=No(i,s,r),l=[o.x-a[0],o.y-a[1],o.z-a[2]],c=D0(l,s,Zt.From2000);return U_(c,s)}function F_(i,e,t){const n=i.x,r=i.y*e+i.z*t,s=-i.y*t+i.z*e,a=Math.hypot(n,r);let o=0;a>0&&(o=Wn*Math.atan2(r,n),o<0&&(o+=360));let l=Wn*Math.atan2(s,a),c=new gt(n,r,s,i.t);return new I_(c,l,o)}function Ao(i){const e=jo(i.t),t=[i.x,i.y,i.z],n=vs(t,i.t,Zt.From2000),[r,s,a]=To(n,i.t,Zt.From2000),o=new gt(r,s,a,i.t),l=e.tobl*it;return F_(o,Math.cos(l),Math.sin(l))}function ki(i){const e=$t(i),t=b_(e),n=t.distance_au*Math.cos(t.geo_eclip_lat),r=[n*Math.cos(t.geo_eclip_lon),n*Math.sin(t.geo_eclip_lon),t.distance_au*Math.sin(t.geo_eclip_lat)],s=y_(e,r),a=vs(s,e,Zt.Into2000);return new gt(a[0],a[1],a[2],e)}function U0(i){const e=$t(i),t=1e-5,n=e.AddDays(-t),r=e.AddDays(+t),s=ki(n),a=ki(r);return new kn((s.x+a.x)/2,(s.y+a.y)/2,(s.z+a.z)/2,(a.x-s.x)/(2*t),(a.y-s.y)/(2*t),(a.z-s.z)/(2*t),e)}function O_(i){const e=$t(i),t=U0(e),n=1+w0;return new kn(t.x/n,t.y/n,t.z/n,t.vx/n,t.vy/n,t.vz/n,e)}function Oi(i,e,t){let n=1,r=0;for(let s of i){let a=0;for(let[l,c,h]of s)a+=l*Math.cos(c+e*h);let o=n*a;t&&(o%=Mn),r+=o,n*=e}return r}function pa(i,e){let t=1,n=0,r=0,s=0;for(let a of i){let o=0,l=0;for(let[c,h,f]of a){let u=h+e*f;o+=c*f*Math.sin(u),s>0&&(l+=c*Math.cos(u))}r+=s*n*l-t*o,n=t,t*=e,++s}return r}const ar=365250,wo=0,Ro=1,Co=2;function Po(i){return new wt(i[0]+44036e-11*i[1]-190919e-12*i[2],-479966e-12*i[0]+.917482137087*i[1]-.397776982902*i[2],.397776982902*i[1]+.917482137087*i[2])}function N0(i,e,t){const n=t*Math.cos(e),r=Math.cos(i),s=Math.sin(i);return[n*r,n*s,t*Math.sin(e)]}function lr(i,e){const t=e.tt/ar,n=Oi(i[wo],t,!0),r=Oi(i[Ro],t,!1),s=Oi(i[Co],t,!1),a=N0(n,r,s);return Po(a).ToAstroVector(e)}function Do(i,e){const t=e/ar,n=Oi(i[wo],t,!0),r=Oi(i[Ro],t,!1),s=Oi(i[Co],t,!1),a=pa(i[wo],t),o=pa(i[Ro],t),l=pa(i[Co],t),c=Math.cos(n),h=Math.sin(n),f=Math.cos(r),u=Math.sin(r),g=+(l*f*c)-s*u*c*o-s*f*h*a,_=+(l*f*h)-s*u*h*o+s*f*c*a,S=+(l*u)+s*f*o,m=N0(n,r,s),d=[g/ar,_/ar,S/ar],A=Po(m),w=Po(d);return new li(e,A,w)}function Jr(i,e,t,n){const r=n/(n+Jo),s=lr(bn[t],e);i.x+=r*s.x,i.y+=r*s.y,i.z+=r*s.z}function B_(i){const e=new gt(0,0,0,i);return Jr(e,i,Ee.Jupiter,So),Jr(e,i,Ee.Saturn,Eo),Jr(e,i,Ee.Uranus,yo),Jr(e,i,Ee.Neptune,bo),e}const Io=51,z_=29200,Ii=146,Sn=201,ii=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]];class wt{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new wt(this.x,this.y,this.z)}ToAstroVector(e){return new gt(this.x,this.y,this.z,e)}static zero(){return new wt(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(e){return new wt(this.x+e.x,this.y+e.y,this.z+e.z)}sub(e){return new wt(this.x-e.x,this.y-e.y,this.z-e.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(e){return new wt(e*this.x,e*this.y,e*this.z)}div(e){return new wt(this.x/e,this.y/e,this.z/e)}mean(e){return new wt((this.x+e.x)/2,(this.y+e.y)/2,(this.z+e.z)/2)}neg(){return new wt(-this.x,-this.y,-this.z)}}class li{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new li(this.tt,this.r,this.v)}sub(e){return new li(this.tt,this.r.sub(e.r),this.v.sub(e.v))}}function G_(i){let[e,[t,n,r],[s,a,o]]=i;return new li(e,new wt(t,n,r),new wt(s,a,o))}function Qr(i,e,t,n){const r=n/(n+Jo),s=Do(bn[t],e);return i.r.incr(s.r.mul(r)),i.v.incr(s.v.mul(r)),s}function nr(i,e,t){const n=t.sub(i),r=n.quadrature();return n.mul(e/(r*Math.sqrt(r)))}class Cs{constructor(e){let t=new li(e,new wt(0,0,0),new wt(0,0,0));this.Jupiter=Qr(t,e,Ee.Jupiter,So),this.Saturn=Qr(t,e,Ee.Saturn,Eo),this.Uranus=Qr(t,e,Ee.Uranus,yo),this.Neptune=Qr(t,e,Ee.Neptune,bo),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new li(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=nr(e,Jo,this.Sun.r);return t.incr(nr(e,So,this.Jupiter.r)),t.incr(nr(e,Eo,this.Saturn.r)),t.incr(nr(e,yo,this.Uranus.r)),t.incr(nr(e,bo,this.Neptune.r)),t}}class Ps{constructor(e,t,n,r){this.tt=e,this.r=t,this.v=n,this.a=r}clone(){return new Ps(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}}class F0{constructor(e,t){this.bary=e,this.grav=t}}function Ss(i,e,t,n){return new wt(e.x+i*(t.x+i*n.x/2),e.y+i*(t.y+i*n.y/2),e.z+i*(t.z+i*n.z/2))}function Tc(i,e,t){return new wt(e.x+i*t.x,e.y+i*t.y,e.z+i*t.z)}function Lo(i,e){const t=i-e.tt,n=new Cs(i),r=Ss(t,e.r,e.v,e.a),s=n.Acceleration(r).mean(e.a),a=Ss(t,e.r,e.v,s),o=e.v.add(s.mul(t)),l=n.Acceleration(a),c=new Ps(i,a,o,l);return new F0(n,c)}const V_=[];function O0(i,e){const t=Math.floor(i);return t<0?0:t>=e?e-1:t}function Uo(i){const e=G_(i),t=new Cs(e.tt),n=e.r.add(t.Sun.r),r=e.v.add(t.Sun.v),s=t.Acceleration(n),a=new Ps(e.tt,n,r,s);return new F0(t,a)}function k_(i,e){const t=ii[0][0];if(e<t||e>ii[Io-1][0])return null;const n=O0((e-t)/z_,Io-1);if(!i[n]){const s=i[n]=[];s[0]=Uo(ii[n]).grav,s[Sn-1]=Uo(ii[n+1]).grav;let a,o=s[0].tt;for(a=1;a<Sn-1;++a)s[a]=Lo(o+=Ii,s[a-1]).grav;o=s[Sn-1].tt;var r=[];for(r[Sn-1]=s[Sn-1],a=Sn-2;a>0;--a)r[a]=Lo(o-=Ii,r[a+1]).grav;for(a=Sn-2;a>0;--a){const l=a/(Sn-1);s[a].r=s[a].r.mul(1-l).add(r[a].r.mul(l)),s[a].v=s[a].v.mul(1-l).add(r[a].v.mul(l)),s[a].a=s[a].a.mul(1-l).add(r[a].a.mul(l))}}return i[n]}function Ac(i,e,t){let n=Uo(i);const r=Math.ceil((e-n.grav.tt)/t);for(let s=0;s<r;++s)n=Lo(s+1===r?e:n.grav.tt+t,n.grav);return n}function B0(i,e){let t,n,r;const s=k_(V_,i.tt);if(s){const a=O0((i.tt-s[0].tt)/Ii,Sn-1),o=s[a],l=s[a+1],c=o.a.mean(l.a),h=Ss(i.tt-o.tt,o.r,o.v,c),f=Tc(i.tt-o.tt,o.v,c),u=Ss(i.tt-l.tt,l.r,l.v,c),g=Tc(i.tt-l.tt,l.v,c),_=(i.tt-o.tt)/Ii;t=h.mul(1-_).add(u.mul(_)),n=f.mul(1-_).add(g.mul(_))}else{let a;i.tt<ii[0][0]?a=Ac(ii[0],i.tt,-Ii):a=Ac(ii[Io-1],i.tt,+Ii),t=a.grav.r,n=a.grav.v,r=a.bary}return r||(r=new Cs(i.tt)),t=t.sub(r.Sun.r),n=n.sub(r.Sun.v),new kn(t.x,t.y,t.z,n.x,n.y,n.z,i)}function ri(i,e){var t=$t(e);if(i in bn)return lr(bn[i],t);if(i===Ee.Pluto){const a=B0(t);return new gt(a.x,a.y,a.z,t)}if(i===Ee.Sun)return new gt(0,0,0,t);if(i===Ee.Moon){var n=lr(bn.Earth,t),r=ki(t);return new gt(n.x+r.x,n.y+r.y,n.z+r.z,t)}if(i===Ee.EMB){const a=lr(bn.Earth,t),o=ki(t),l=1+w0;return new gt(a.x+o.x/l,a.y+o.y/l,a.z+o.z/l,t)}if(i===Ee.SSB)return B_(t);const s=Qo(i);if(s){const a=new P_(s.dec,15*s.ra,s.dist);return t1(a,t)}throw`HelioVector: Unknown body "${i}"`}function H_(i,e){let t=e,n=0;for(let r=0;r<10;++r){const s=i(t),a=s.Length()/b0;if(a>1)throw"Object is too distant for light-travel solver.";const o=e.AddDays(-a);if(n=Math.abs(o.tt-t.tt),n<1e-9)return s;t=o}throw`Light-travel time solver did not converge: dt = ${n}`}class W_{constructor(e,t,n,r){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=r}Position(e){this.aberration&&(this.observerPos=ri(this.observerBody,e));const t=ri(this.targetBody,e);return new gt(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}}function X_(i,e,t,n){xs(n);const r=$t(i);if(Qo(t)){const o=ri(t,r);if(n){const c=Y_(e,r),h=new gt(o.x-c.x,o.y-c.y,o.z-c.z,r),f=b0/h.Length();return new gt(h.x+c.vx/f,h.y+c.vy/f,h.z+c.vz/f,r)}const l=ri(e,r);return new gt(o.x-l.x,o.y-l.y,o.z-l.z,r)}let s;n?s=new gt(0,0,0,r):s=ri(e,r);const a=new W_(e,t,n,s);return H_(o=>a.Position(o),r)}function No(i,e,t){xs(t);const n=$t(e);switch(i){case Ee.Earth:return new gt(0,0,0,n);case Ee.Moon:return ki(n);default:const r=X_(n,Ee.Earth,i,t);return r.t=n,r}}function q_(i,e){return new kn(i.r.x,i.r.y,i.r.z,i.v.x,i.v.y,i.v.z,e)}function Y_(i,e){const t=$t(e);switch(i){case Ee.Sun:return new kn(0,0,0,0,0,0,t);case Ee.SSB:const n=new Cs(t.tt);return new kn(-n.Sun.r.x,-n.Sun.r.y,-n.Sun.r.z,-n.Sun.v.x,-n.Sun.v.y,-n.Sun.v.z,t);case Ee.Mercury:case Ee.Venus:case Ee.Earth:case Ee.Mars:case Ee.Jupiter:case Ee.Saturn:case Ee.Uranus:case Ee.Neptune:const r=Do(bn[i],t.tt);return q_(r,t);case Ee.Pluto:return B0(t);case Ee.Moon:case Ee.EMB:const s=Do(bn.Earth,t.tt),a=i==Ee.Moon?U0(t):O_(t);return new kn(a.x+s.r.x,a.y+s.r.y,a.z+s.r.z,a.vx+s.v.x,a.vy+s.v.y,a.vz+s.v.z,t);default:if(Qo(i)){const o=ri(i,t);return new kn(o.x,o.y,o.z,0,0,0,t)}throw`HelioState: Unsupported body "${i}"`}}function K_(i){for(;i<0;)i+=360;for(;i>=360;)i-=360;return i}function Z_(i,e,t){if(i===Ee.Earth||e===Ee.Earth)throw"The Earth does not have a longitude as seen from itself.";const n=$t(t),r=No(i,n,!1),s=Ao(r),a=No(e,n,!1),o=Ao(a);return K_(s.elon-o.elon)}function $_(i,e,t,n){let r,s=0,a=0,o=0;switch(i){case Ee.Mercury:r=-.6,s=4.98,a=-4.88,o=3.02;break;case Ee.Venus:e<163.6?(r=-4.47,s=1.03,a=.57,o=.13):(r=.98,s=-1.02);break;case Ee.Mars:r=-1.52,s=1.6;break;case Ee.Jupiter:r=-9.4,s=.5;break;case Ee.Uranus:r=-7.19,s=.25;break;case Ee.Neptune:r=-6.87;break;case Ee.Pluto:r=-1,s=4;break;default:throw`VisualMagnitude: unsupported body ${i}`}const l=e/100;let c=r+l*(s+l*(a+l*o));return c+=5*Math.log10(t*n),c}function J_(i,e,t,n,r){const s=Ao(n),a=it*28.06,o=it*(169.51+382e-7*r.tt),l=it*s.elat,c=it*s.elon,h=Math.asin(Math.sin(l)*Math.cos(a)-Math.cos(l)*Math.sin(a)*Math.sin(c-o)),f=Math.sin(Math.abs(h));let u=-9+.044*i;return u+=f*(-2.6+1.2*f),u+=5*Math.log10(e*t),{mag:u,ring_tilt:Wn*h}}function Q_(i,e,t){let n=i*it,r=n*n,s=r*r,a=-12.717+1.49*Math.abs(n)+.0431*s;const o=385000.6/ei;let l=t/o;return a+=5*Math.log10(e*l),a}class j_{constructor(e,t,n,r,s,a,o,l){this.time=e,this.mag=t,this.phase_angle=n,this.helio_dist=r,this.geo_dist=s,this.gc=a,this.hc=o,this.ring_tilt=l,this.phase_fraction=(1+Math.cos(it*n))/2}}function z0(i,e){if(i===Ee.Earth)throw"The illumination of the Earth is not defined.";const t=$t(e),n=lr(bn.Earth,t);let r,s,a,o;i===Ee.Sun?(a=new gt(-n.x,-n.y,-n.z,t),s=new gt(0,0,0,t),r=0):(i===Ee.Moon?(a=ki(t),s=new gt(n.x+a.x,n.y+a.y,n.z+a.z,t)):(s=ri(i,e),a=new gt(s.x-n.x,s.y-n.y,s.z-n.z,t)),r=m_(a,s));let l=a.Length(),c=s.Length(),h;if(i===Ee.Sun)o=f_+5*Math.log10(l);else if(i===Ee.Moon)o=Q_(r,c,l);else if(i===Ee.Saturn){const f=J_(r,c,l,a,t);o=f.mag,h=f.ring_tilt}else o=$_(i,r,c,l);return new j_(t,o,r,c,l,a,s,h)}function e1(i){return Z_(Ee.Moon,Ee.Sun,i)}var wc;(function(i){i[i.Pericenter=0]="Pericenter",i[i.Apocenter=1]="Apocenter"})(wc||(wc={}));function t1(i,e){e=$t(e);const t=i.lat*it,n=i.lon*it,r=i.dist*Math.cos(t);return new gt(r*Math.cos(n),r*Math.sin(n),i.dist*Math.sin(t),e)}function n1(i,e){let t;if(Et(e),e<-90||e>90)return 0;{let n=e;n<-1&&(n=-1),t=1.02/Math.tan((n+10.3/(n+5.11))*it)/60,e<-1&&(t*=(e+90)/89)}return t}var Rc;(function(i){i.Penumbral="penumbral",i.Partial="partial",i.Annular="annular",i.Total="total"})(Rc||(Rc={}));var Cc;(function(i){i[i.Invalid=0]="Invalid",i[i.Ascending=1]="Ascending",i[i.Descending=-1]="Descending"})(Cc||(Cc={}));const i1=["Venus","Mars","Jupiter","Saturn"];function G0(i){return new L0(i.lat,i.lng,i.elevationM)}function r1(i,e,t,n){const r=I0(t,G0(n),i,e,"normal");return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}function ma(i,e,t){const n=G0(t),r=N_(Ee[i],e,n,!0,!0),s=I0(e,n,r.ra,r.dec,"normal");return{altitudeDeg:s.altitude,azimuthDeg:s.azimuth}}function ga(i,e){return z0(Ee[i],e).mag}function s1(i){const e=e1(i),t=z0(Ee.Moon,i);return{phaseFraction:e/360,illuminatedFraction:t.phase_fraction}}const a1=2e3,o1=3,l1=20;function c1(i,e){if(i.year===void 0&&i.month===void 0&&i.day===void 0&&i.hour===void 0)return;const t=i.year!==void 0,n=i.year??a1,r=i.month??(t?1:o1),s=i.day??(t?1:l1),a=Math.round(e/15);return new Date(Date.UTC(n,r-1,s,(i.hour??12)-a,i.minute??0,i.second??0))}const jr=900,u1=900,h1=850,Pc=850,_a=4,f1=1.5,d1=-1,p1=6,Dc=-4,m1=[{azimuthDeg:0,label:"N"},{azimuthDeg:45,label:"NE"},{azimuthDeg:90,label:"E"},{azimuthDeg:135,label:"SE"},{azimuthDeg:180,label:"S"},{azimuthDeg:225,label:"SO"},{azimuthDeg:270,label:"O"},{azimuthDeg:315,label:"NO"}],g1=880,Ic=40,_1={Venus:new Oe(1,.96,.85),Mars:new Oe(1,.55,.4),Jupiter:new Oe(.95,.87,.72),Saturn:new Oe(.92,.86,.68)};class x1{renderer;scene=new yh;camera;skyMesh;groundMesh;starTiers=[];bodyMeshes=new Map;hitAreas=new Map;glareSprites=new Map;compassSprites=[];showCompass=!1;animationFrameId=null;raycaster=new Xh;constructor(e){this.renderer=new kg({canvas:e,antialias:!0}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),this.camera=new Xt(60,e.width/Math.max(e.height,1),.1,jr*1.2),this.camera.position.set(0,1.6,0)}resize(e,t){this.renderer.setSize(e,t,!1),this.camera.aspect=e/Math.max(t,1),this.camera.updateProjectionMatrix(),this.render()}setObserverPose(e){e.headingDeg!==void 0?this.camera.rotation.set(e.pitchDeg*xa,-e.headingDeg*xa,0,"YXZ"):this.camera.rotation.set(e.pitchDeg*xa,this.camera.rotation.y,0,"YXZ"),this.camera.position.y=1.6+e.elevationM,this.camera.fov!==e.fovDeg&&(this.camera.fov=e.fovDeg,this.camera.updateProjectionMatrix())}setShowCompass(e){this.showCompass!==e&&(this.showCompass=e,this.disposeCompassLabels(),e&&this.buildCompassLabels(),this.render())}setAstronomy(e){const t=E0(e.sun.altitudeDeg).horizon;this.buildSky(e.sun),this.buildGround(t),this.buildStars(e.stars,e.sun.altitudeDeg),this.setBodyMesh("sun",e.sun,_a,new Oe(1,.96,.88),e.sun.magnitude),this.setMoonMesh(e.moon),this.buildPlanets(e.planets),this.scene.fog=new Yo(new Oe(...t),jr*.2,jr),this.render()}render(){this.renderer.render(this.scene,this.camera)}pickBodyAt(e,t){this.raycaster.setFromCamera(new Ve(e,t),this.camera);const n=[...this.hitAreas.entries()],r=this.raycaster.intersectObjects(n.map(([,s])=>s))[0];if(r)return n.find(([,s])=>s===r.object)?.[0]}dispose(){this.stopTwinkle(),this.disposeMesh(this.skyMesh),this.disposeMesh(this.groundMesh),this.disposeStarTiers();for(const e of this.bodyMeshes.values())this.disposeMesh(e);this.bodyMeshes.clear();for(const e of[...this.hitAreas.keys()])this.disposeHitArea(e);for(const e of[...this.glareSprites.keys()])this.disposeGlare(e);this.disposeCompassLabels(),this.renderer.dispose()}startTwinkle(){if(this.animationFrameId!==null||this.starTiers.length===0)return;const e=t=>{this.updateTwinkle(t/1e3),this.render(),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}stopTwinkle(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}buildSky(e){this.disposeMesh(this.skyMesh);const t=new gs(jr,32,16),n=t.attributes.position,r=[];for(let a=0;a<n.count;a++){const{altitudeDeg:o,azimuthDeg:l}=qg(n.getX(a),n.getY(a),n.getZ(a)),c=Zg(o,l,e.azimuthDeg,e.altitudeDeg);r.push(c[0],c[1],c[2])}t.setAttribute("color",new Pt(r,3));const s=new or({vertexColors:!0,side:Lt,fog:!1});this.skyMesh=new Kt(t,s),this.scene.add(this.skyMesh)}buildGround(e){this.disposeMesh(this.groundMesh);const t=new $o(u1,48),n=new Oe(e[0]*.35,e[1]*.35,e[2]*.35),r=new or({color:n,fog:!0});this.groundMesh=new Kt(t,r),this.groundMesh.rotation.x=-Math.PI/2,this.groundMesh.position.y=-.5,this.scene.add(this.groundMesh)}setBodyMesh(e,t,n,r,s){if(this.disposeMesh(this.bodyMeshes.get(e)),this.disposeHitArea(e),this.disposeGlare(e),t.altitudeDeg<Dc){this.bodyMeshes.delete(e);return}const{x:a,y:o,z:l}=Kr(t.altitudeDeg,t.azimuthDeg,Pc),c=xc(t.altitudeDeg),h=new Oe(r.r*c[0],r.g*c[1],r.b*c[2]),f=new gs(n,16,16),u=new or({color:h,fog:!1}),g=new Kt(f,u);g.position.set(a,o,l),this.scene.add(g),this.bodyMeshes.set(e,g),this.setHitArea(e,a,o,l,n),this.setGlare(e,a,o,l,s,h)}setMoonMesh(e){const t="moon";if(this.disposeMesh(this.bodyMeshes.get(t)),this.disposeHitArea(t),this.disposeGlare(t),e.altitudeDeg<Dc){this.bodyMeshes.delete(t);return}const{x:n,y:r,z:s}=Kr(e.altitudeDeg,e.azimuthDeg,Pc),a=xc(e.altitudeDeg),o=new Oe(a[0],a[1],a[2]),l=new rr({map:S1(e.phase),color:o,fog:!1}),c=new Pr(l);c.position.set(n,r,s);const h=_a*2;c.scale.set(h,h,1),this.scene.add(c),this.bodyMeshes.set(t,c),this.setHitArea(t,n,r,s,_a),this.setGlare(t,n,r,s,e.magnitude,o)}setHitArea(e,t,n,r,s){const a=new rr({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1}),o=new Pr(a);o.position.set(t,n,r);const l=s*p1;o.scale.set(l,l,1),this.scene.add(o),this.hitAreas.set(e,o)}disposeHitArea(e){const t=this.hitAreas.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.hitAreas.delete(e))}setGlare(e,t,n,r,s,a){this.disposeGlare(e);const o=Jg(s);if(o<=0)return;const l=e_(o),c=new rr({map:M1(),color:a,transparent:!0,opacity:i_(o),blending:ya,depthWrite:!1,fog:!1}),h=new Pr(c);h.position.set(t,n,r),h.scale.set(l*2,l*2,1),this.scene.add(h),this.glareSprites.set(e,h)}disposeGlare(e){const t=this.glareSprites.get(e);t&&(this.scene.remove(t),t.material.dispose(),this.glareSprites.delete(e))}buildPlanets(e){const t=new Set(["sun","moon"]);for(const n of e){t.add(n.body);const r=gc(n.magnitude),s=_c(r),a=_1[n.body]??new Oe(1,1,1),o=new Oe(a.r*s,a.g*s,a.b*s),l=f1*(.5+.5*r);this.setBodyMesh(n.body,n.position,l,o,n.magnitude)}for(const n of[...this.bodyMeshes.keys()])t.has(n)||(this.disposeMesh(this.bodyMeshes.get(n)),this.bodyMeshes.delete(n),this.disposeHitArea(n),this.disposeGlare(n))}buildStars(e,t){if(this.disposeStarTiers(),!e||e.catalog.count===0){this.stopTwinkle();return}const{catalog:n,date:r,observer:s}=e,a=Hg(t),o=y1(1337),l=[];for(let c=0;c<n.count;c++){const h=n.mag[c];if(h>a)continue;const{altitudeDeg:f,azimuthDeg:u}=r1(n.ra[c],n.dec[c],r,s);if(f<d1)continue;const{x:g,y:_,z:S}=Kr(f,u,h1);l.push({x:g,y:_,z:S,brightness:gc(h),phase:o()*Math.PI*2,speedFactor:.7+o()*.6})}this.starTiers=y0.map((c,h)=>{const f=l.filter(M=>s_(M.brightness)===h),u=new Float32Array(f.length*3),g=new Float32Array(f.length),_=new Float32Array(f.length),S=new Float32Array(f.length);f.forEach((M,T)=>{u[T*3]=M.x,u[T*3+1]=M.y,u[T*3+2]=M.z,g[T]=M.brightness,_[T]=M.phase,S[T]=M.speedFactor});const m=new Ft;m.setAttribute("position",new Gt(u,3));const d=new Gt(new Float32Array(f.length*3),3);m.setAttribute("color",d);const A=new o0({vertexColors:!0,size:c.size,sizeAttenuation:!1,fog:!1}),w=new Uh(m,A);return this.scene.add(w),{points:w,colorAttribute:d,brightness:g,phase:_,speedFactor:S}}),this.updateTwinkle(0),this.startTwinkle()}updateTwinkle(e){for(const t of this.starTiers){const n=t.colorAttribute.array;for(let r=0;r<t.brightness.length;r++){const s=l_(t.brightness[r],{phase:t.phase[r],speedFactor:t.speedFactor[r]},e),a=_c(t.brightness[r])*s;n[r*3]=a,n[r*3+1]=a,n[r*3+2]=a}t.colorAttribute.needsUpdate=!0}}buildCompassLabels(){this.compassSprites=m1.map(({azimuthDeg:e,label:t})=>{const n=new rr({map:E1(t),depthTest:!1,fog:!1}),r=new Pr(n),{x:s,y:a,z:o}=Kr(0,e,g1);return r.position.set(s,a,o),r.scale.set(Ic,Ic,1),this.scene.add(r),r})}disposeCompassLabels(){for(const e of this.compassSprites)this.scene.remove(e),e.material.map?.dispose(),e.material.dispose();this.compassSprites=[]}disposeStarTiers(){for(const e of this.starTiers)this.disposeMesh(e.points);this.starTiers=[]}disposeMesh(e){if(!e)return;this.scene.remove(e),"geometry"in e&&e.geometry.dispose();const t=e.material;Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose()}}const xa=Math.PI/180;function v1(i,e,t){return Math.max(e,Math.min(t,i))}let es;function M1(){if(es)return es;const i=128,e=document.createElement("canvas");e.width=i,e.height=i;const t=e.getContext("2d"),n=t.createRadialGradient(i/2,i/2,0,i/2,i/2,i/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.4,"rgba(255,255,255,0.35)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,i,i),es=new Zo(e),es}function S1(i){const t=document.createElement("canvas");t.width=128,t.height=128;const n=t.getContext("2d"),r=128/2-2,s=128/2,a=128/2,o="#2e2b26",l="#f4f1e2";n.fillStyle=o,n.beginPath(),n.arc(s,a,r,0,Math.PI*2),n.fill();const c=v1(i.illuminatedFraction,0,1),h=i.phaseFraction<.5,f=r*Math.abs(1-2*c),u=c<.5;return n.save(),n.beginPath(),n.arc(s,a,r,0,Math.PI*2),n.clip(),n.fillStyle=l,n.beginPath(),h?(n.arc(s,a,r,-Math.PI/2,Math.PI/2,!1),n.ellipse(s,a,f,r,0,Math.PI/2,-Math.PI/2,u)):(n.arc(s,a,r,Math.PI/2,-Math.PI/2,!1),n.ellipse(s,a,f,r,0,-Math.PI/2,Math.PI/2,u)),n.fill(),n.restore(),new Zo(t)}function E1(i){const e=document.createElement("canvas");e.width=128,e.height=128;const t=e.getContext("2d");return t.fillStyle="rgba(0, 0, 0, 0.55)",t.beginPath(),t.arc(64,64,60,0,Math.PI*2),t.fill(),t.fillStyle="#ffffff",t.font="bold 52px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(i,64,68),new Zo(e)}function y1(i){let e=i;return function(){e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const Lc=new Map;function b1(i){const e=i.byteLength/(4*Float32Array.BYTES_PER_ELEMENT),t=e,n=t*Float32Array.BYTES_PER_ELEMENT;return{count:e,ra:new Float32Array(i,0*n,t),dec:new Float32Array(i,1*n,t),mag:new Float32Array(i,2*n,t),ci:new Float32Array(i,3*n,t)}}function T1(i){let e=Lc.get(i);return e||(e=fetch(i).then(t=>t.arrayBuffer()).then(b1),Lc.set(i,e)),e}Oc();const A1={sun:{en:"Sun",fr:"Soleil"},moon:{en:"Moon",fr:"Lune"},Venus:{en:"Venus",fr:"Vénus"},Mars:{en:"Mars",fr:"Mars"},Jupiter:{en:"Jupiter",fr:"Jupiter"},Saturn:{en:"Saturn",fr:"Saturne"}},w1=["en","fr"],R1=new URL(""+new URL("stars-mag7.5-DDr9QasD.bin",import.meta.url).href,import.meta.url).href,C1={sun:{altitudeDeg:-3,azimuthDeg:180,magnitude:-26.7},moon:{altitudeDeg:-90,azimuthDeg:0,phase:{phaseFraction:0,illuminatedFraction:0},magnitude:-12.7},planets:[]},va={lat:0,lng:0,elevationM:0,headingDeg:void 0,pitchDeg:0,fovDeg:60};class P1 extends HTMLElement{static get observedAttributes(){return["src","star-catalog-src","show-compass"]}shadow;stageElement;frameElement;sceneCanvas;ufoElement;sceneRenderer;bodyTooltip;resizeObserver;lastTimeMs=0;starCatalog;handleFullscreenChange=()=>this.resizeToStage();handlePointerMove=e=>{const n=this.ufoElement.canvasElement.getBoundingClientRect();if(n.width===0||n.height===0)return;const r=(e.clientX-n.left)/n.width*2-1,s=-((e.clientY-n.top)/n.height*2-1),a=this.sceneRenderer.pickBodyAt(r,s);if(!a){this.bodyTooltip.hidden=!0;return}const o=Nc(navigator.languages,w1);this.bodyTooltip.textContent=A1[a]?.[o]??a,this.bodyTooltip.hidden=!1;const l=this.stageElement.getBoundingClientRect();this.bodyTooltip.style.left=`${e.clientX-l.left+12}px`,this.bodyTooltip.style.top=`${e.clientY-l.top+12}px`};handlePointerLeave=()=>{this.bodyTooltip.hidden=!0};handleTimeUpdate=e=>{this.lastTimeMs=e.detail.time,this.updateAstronomy(this.lastTimeMs)};constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${Z0}</style>${K0}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.frameElement=this.shadow.getElementById("frame"),this.sceneCanvas=this.shadow.getElementById("scene-canvas"),this.sceneRenderer=new x1(this.sceneCanvas),this.bodyTooltip=this.shadow.getElementById("body-tooltip"),this.ufoElement=document.createElement(Ea),this.ufoElement.classList.add("ufo-overlay"),this.ufoElement.style.setProperty("--ufo-canvas-background","transparent"),this.ufoElement.style.setProperty("--ufo-canvas-border","none"),this.ufoElement.fullscreenTarget=this.stageElement,this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.ufoElement.addEventListener("timeupdate",this.handleTimeUpdate),this.ufoElement.canvasElement.addEventListener("pointermove",this.handlePointerMove),this.ufoElement.canvasElement.addEventListener("pointerleave",this.handlePointerLeave)}connectedCallback(){this.resizeToStage(),this.updateAstronomy(this.lastTimeMs),this.loadStars(),this.resizeObserver=new ResizeObserver(()=>this.resizeToStage()),this.resizeObserver.observe(this.frameElement),document.addEventListener("fullscreenchange",this.handleFullscreenChange);const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){this.resizeObserver?.disconnect(),document.removeEventListener("fullscreenchange",this.handleFullscreenChange),this.sceneRenderer.stopTwinkle()}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),e==="star-catalog-src"&&n!==t&&this.isConnected&&this.loadStars(),e==="show-compass"&&n!==t&&this.sceneRenderer.setShowCompass(this.hasAttribute("show-compass"))}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.ufoElement.sightingData=e,this.lastTimeMs=0,this.updateAstronomy(0)}resizeToStage(){const e=this.frameElement.getBoundingClientRect(),t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height));this.sceneCanvas.width=t,this.sceneCanvas.height=n,this.sceneRenderer.resize(t,n)}async loadStars(){const e=this.getAttribute("star-catalog-src")??R1;this.starCatalog=await T1(e),this.updateAstronomy(this.lastTimeMs)}updateAstronomy(e){const t=this.ufoElement.sighting,n=cu(t,e);this.sceneRenderer.setObserverPose(n??va);const r=n?.lat??va.lat,s=n?.lng??va.lng,a=c1(t.event.time??{},s);if(!a){this.sceneRenderer.setAstronomy(C1);return}const o=new Date(a.getTime()+e),l={lat:r,lng:s,elevationM:n?.elevationM??0},c={...ma("Sun",o,l),magnitude:ga("Sun",o)},h={...ma("Moon",o,l),phase:s1(o),magnitude:ga("Moon",o)},f=i1.map(u=>({body:u,position:ma(u,o,l),magnitude:ga(u,o)}));this.sceneRenderer.setAstronomy({sun:c,moon:h,planets:f,stars:this.starCatalog?{catalog:this.starCatalog,date:o,observer:l}:void 0})}}const Uc="rr0-scene";function D1(){Oc(),customElements.get(Uc)||customElements.define(Uc,P1)}D1();
@@ -130,4 +130,4 @@ input[type=range] {
130
130
  min-width: 3em;
131
131
  text-align: center;
132
132
  }
133
- `;function C(n,e,t){const{bounds:s}=n;return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function l(n,e,t){return n+(e-n)*t}function T(n){const e=/^#([0-9a-f]{6})$/i.exec(n);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function O(n){return`#${n.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function _(n,e,t){const s=T(n),i=T(e);return!s||!i?t<1?n:e:O([l(s[0],i[0],t),l(s[1],i[1],t),l(s[2],i[2],t)])}function R(n,e,t){const s={x:l(n.bounds.x,e.bounds.x,t),y:l(n.bounds.y,e.bounds.y,t),width:l(n.bounds.width,e.bounds.width,t),height:l(n.bounds.height,e.bounds.height,t)},i=l(n.angle,e.angle,t),r=l(n.transparency,e.transparency,t),a=l(n.haloScale,e.haloScale,t),o=_(n.color,e.color,t);return n.kind==="polygon"&&e.kind==="polygon"&&n.points.length===e.points.length?{...n,bounds:s,angle:i,transparency:r,haloScale:a,color:o,points:n.points.map((c,f)=>({x:l(c.x,e.points[f].x,t),y:l(c.y,e.points[f].y,t)}))}:{...t<1?n:e,bounds:s,angle:i,transparency:r,haloScale:a,color:o}}class k{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);if(this.keyframes[s]?.t===e){const i=new Set(t.map(r=>r.sourceId));this.keyframes[s]={t:e,shapes:[...this.keyframes[s].shapes.filter(r=>!i.has(r.sourceId)),...t]}}else this.keyframes.splice(s,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t];return s?.t===e?s:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(s=>s.sourceId===t)?.shape}getLatestShapeAt(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return i.shape}}getInterpolatedShapeAt(e,t){const s=this.findShapeAtOrBefore(e,t);if(s?.t===e)return s.shape;const i=this.findShapeAtOrAfter(e,t);return s?i?R(s.shape,i.shape,(e-s.t)/(i.t-s.t)):s.shape:i?.shape}findShapeAtOrBefore(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}findShapeAtOrAfter(e,t){for(let s=this.findInsertIndex(e);s<this.keyframes.length;s++){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}hitTest(e,t,s){const i=this.sourceIds;for(let r=i.length-1;r>=0;r--){const a=this.getInterpolatedShapeAt(e,i[r]);if(a&&C(a,t,s))return{sourceId:i[r],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const s of t.shapes)e.add(s.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new k;for(const s of e.keyframes)t.addKeyframe(s.t,s.shapes);return t}}function N(n,e,t){return Math.max(e,Math.min(t,n))}function U(n,e,t){const s=((e-n)%360+540)%360-180;return((n+s*t)%360+360)%360}function m(n,e,t){return n+(e-n)*t}function H(n,e,t){return{lat:n.lat===void 0||e.lat===void 0?void 0:m(n.lat,e.lat,t),lng:n.lng===void 0||e.lng===void 0?void 0:m(n.lng,e.lng,t),elevationM:m(n.elevationM,e.elevationM,t),headingDeg:n.headingDeg===void 0||e.headingDeg===void 0?void 0:U(n.headingDeg,e.headingDeg,t),pitchDeg:m(n.pitchDeg,e.pitchDeg,t),fovDeg:m(n.fovDeg,e.fovDeg,t)}}class y{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,pose:t}:this.keyframes.splice(s,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.pose;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return s?i?H(s.pose,i.pose,N((e-s.t)/(i.t-s.t),0,1)):s.pose:i?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new y;for(const s of e.keyframes)t.addKeyframe(s.t,s.pose);return t}}function S(n){if(n.year!==void 0)return Date.UTC(n.year,(n.month??1)-1,n.day??1,n.hour??0,n.minute??0,n.second??0)}function $(n){if(n.durationSeconds!==void 0)return n.durationSeconds*1e3;const e=n.time?S(n.time):void 0,t=n.endTime?S(n.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class w{constructor(e,t,s,i,r,a){this.event=e,this.timeline=t,this.observerTrack=s,this.witnessId=i,this.witnessName=r,this.caseId=a}static create(e,t,s){return new w({eventType:"sighting",time:e,place:t},new k,new y,s)}}class J{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const s of this.timeline.sourceIds){const i=this.timeline.getInterpolatedShapeAt(e,s);i&&t.set(s,i)}this.onFrame(e,t)}}const K=["nw","n","ne","e","se","s","sw","w"],q=24;function z(n,e,t){const s=n.x-e.x,i=n.y-e.y,r=Math.cos(t),a=Math.sin(t);return{x:e.x+s*r-i*a,y:e.y+s*a+i*r}}function W(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function j(n){const{x:e,y:t,width:s,height:i}=n.bounds,r={nw:{x:e,y:t},n:{x:e+s/2,y:t},ne:{x:e+s,y:t},e:{x:e+s,y:t+i/2},se:{x:e+s,y:t+i},s:{x:e+s/2,y:t+i},sw:{x:e,y:t+i},w:{x:e,y:t+i/2},rotate:{x:e+s/2,y:t-q}},a=W(n.bounds),o={};for(const c of Object.keys(r))o[c]=z(r[c],a,n.angle);return o}const I=6,b=I/2,Z=20;class G{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:s,width:i,height:r}=e.bounds,a=i/2,o=r/2;this.ctx.ellipse(t+a,s+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:s,width:i,height:r}=e.bounds;this.ctx.save(),this.ctx.translate(t+i/2,s+r/2),this.ctx.rotate(e.angle),this.ctx.translate(-i/2,-r/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=Z*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=j(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const s of K){const i=t[s];this.ctx.fillRect(i.x-b,i.y-b,I,I)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,b+1,b+1,0,0,2*Math.PI),this.ctx.fill()}}function Q(n){return{version:1,time:n.event.time,endTime:n.event.endTime,durationSeconds:n.event.durationSeconds,place:n.event.place,witnessId:n.witnessId,witnessName:n.witnessName,caseId:n.caseId,timeline:n.timeline.toJSON(),observerTrack:n.observerTrack.toJSON()}}function V(n){return new w({eventType:"sighting",time:n.time,endTime:n.endTime,durationSeconds:n.durationSeconds,place:n.place},k.fromJSON(n.timeline),n.observerTrack?y.fromJSON(n.observerTrack):new y,n.witnessId,n.witnessName,n.caseId)}function X(n,e){for(const t of n){const s=t.toLowerCase().split("-")[0];if(e.includes(s))return s}return"en"}const Y="modulepreload",ee=function(n,e){return new URL(n,e).href},E={},P=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const o=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");i=a(t.map(h=>{if(h=ee(h,s),h in E)return;E[h]=!0;const d=h.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(!!s)for(let g=o.length-1;g>=0;g--){const v=o[g];if(v.href===h&&(!d||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${p}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":Y,d||(u.as="script"),u.crossOrigin="",u.href=h,f&&u.setAttribute("nonce",f),document.head.appendChild(u),d)return new Promise((g,v)=>{u.addEventListener("load",g),u.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},te=["en","fr"],se={en:()=>P(()=>Promise.resolve().then(()=>ie),void 0,import.meta.url).then(n=>n.ufoMessages_en),fr:()=>P(()=>import("./assets/UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(n=>n.ufoMessages_fr)};function ne(n){return se[n]()}const A={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},ie=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:A},Symbol.toStringTag,{value:"Module"}));class re extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=w.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=A;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${F}</style>${L}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new G(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,s){e==="src"&&s&&s!==t&&this.isConnected&&this.loadFromSrc(s)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return Q(this.currentSighting)}set sightingData(e){this.currentSighting=V(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const s=this.playbackState!=="playing";for(const[i,r]of t){const a=s&&i===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...r,selected:!0}:r)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new J(this.currentSighting.timeline,(t,s)=>this.onFrame(t,s));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=X(navigator.languages,te);e!=="en"&&this.applyMessages(await ne(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=$(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?S(e.time):void 0;const s=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&s>0?s/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return x(e);const t=this.currentSighting.timeline.duration,s=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?B(M(this.realStartMs+s)):x(s)}formatEndOfTimeline(){return this.realDurationMs===void 0?x(this.currentSighting.timeline.duration):this.realStartMs!==void 0?B(M(this.realStartMs+this.realDurationMs)):x(this.realDurationMs)}}function M(n){const e=new Date(n);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function B(n){if(n.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return n.second?`${e(n.hour)}:${e(n.minute??0)}:${e(n.second)}`:`${e(n.hour)}:${e(n.minute??0)}`}function x(n){const e=Math.round(n/1e3),t=Math.floor(e/60),s=e%60;return`${t}:${String(s).padStart(2,"0")}`}const D="rr0-ufo";function ae(){customElements.get(D)||customElements.define(D,re)}ae();
133
+ `;function C(n,e,t){const{bounds:s}=n;return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function l(n,e,t){return n+(e-n)*t}function T(n){const e=/^#([0-9a-f]{6})$/i.exec(n);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function O(n){return`#${n.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function _(n,e,t){const s=T(n),i=T(e);return!s||!i?t<1?n:e:O([l(s[0],i[0],t),l(s[1],i[1],t),l(s[2],i[2],t)])}function R(n,e,t){const s={x:l(n.bounds.x,e.bounds.x,t),y:l(n.bounds.y,e.bounds.y,t),width:l(n.bounds.width,e.bounds.width,t),height:l(n.bounds.height,e.bounds.height,t)},i=l(n.angle,e.angle,t),r=l(n.transparency,e.transparency,t),a=l(n.haloScale,e.haloScale,t),o=_(n.color,e.color,t);return n.kind==="polygon"&&e.kind==="polygon"&&n.points.length===e.points.length?{...n,bounds:s,angle:i,transparency:r,haloScale:a,color:o,points:n.points.map((c,f)=>({x:l(c.x,e.points[f].x,t),y:l(c.y,e.points[f].y,t)}))}:{...t<1?n:e,bounds:s,angle:i,transparency:r,haloScale:a,color:o}}class k{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);if(this.keyframes[s]?.t===e){const i=new Set(t.map(r=>r.sourceId));this.keyframes[s]={t:e,shapes:[...this.keyframes[s].shapes.filter(r=>!i.has(r.sourceId)),...t]}}else this.keyframes.splice(s,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t];return s?.t===e?s:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(s=>s.sourceId===t)?.shape}getLatestShapeAt(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return i.shape}}getInterpolatedShapeAt(e,t){const s=this.findShapeAtOrBefore(e,t);if(s?.t===e)return s.shape;const i=this.findShapeAtOrAfter(e,t);return s?i?R(s.shape,i.shape,(e-s.t)/(i.t-s.t)):s.shape:i?.shape}findShapeAtOrBefore(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}findShapeAtOrAfter(e,t){for(let s=this.findInsertIndex(e);s<this.keyframes.length;s++){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}hitTest(e,t,s){const i=this.sourceIds;for(let r=i.length-1;r>=0;r--){const a=this.getInterpolatedShapeAt(e,i[r]);if(a&&C(a,t,s))return{sourceId:i[r],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const s of t.shapes)e.add(s.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new k;for(const s of e.keyframes)t.addKeyframe(s.t,s.shapes);return t}}function N(n,e,t){return Math.max(e,Math.min(t,n))}function U(n,e,t){const s=((e-n)%360+540)%360-180;return((n+s*t)%360+360)%360}function m(n,e,t){return n+(e-n)*t}function H(n,e,t){return{lat:n.lat===void 0||e.lat===void 0?void 0:m(n.lat,e.lat,t),lng:n.lng===void 0||e.lng===void 0?void 0:m(n.lng,e.lng,t),elevationM:m(n.elevationM,e.elevationM,t),headingDeg:n.headingDeg===void 0||e.headingDeg===void 0?void 0:U(n.headingDeg,e.headingDeg,t),pitchDeg:m(n.pitchDeg,e.pitchDeg,t),fovDeg:m(n.fovDeg,e.fovDeg,t)}}class y{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,pose:t}:this.keyframes.splice(s,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.pose;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return s?i?H(s.pose,i.pose,N((e-s.t)/(i.t-s.t),0,1)):s.pose:i?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new y;for(const s of e.keyframes)t.addKeyframe(s.t,s.pose);return t}}function S(n){if(n.year!==void 0)return Date.UTC(n.year,(n.month??1)-1,n.day??1,n.hour??0,n.minute??0,n.second??0)}function $(n){if(n.durationSeconds!==void 0)return n.durationSeconds*1e3;const e=n.time?S(n.time):void 0,t=n.endTime?S(n.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class w{constructor(e,t,s,i,r,a){this.event=e,this.timeline=t,this.observerTrack=s,this.witnessId=i,this.witnessName=r,this.caseId=a}static create(e,t,s){return new w({eventType:"sighting",time:e,place:t},new k,new y,s)}}class J{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const s of this.timeline.sourceIds){const i=this.timeline.getInterpolatedShapeAt(e,s);i&&t.set(s,i)}this.onFrame(e,t)}}const K=["nw","n","ne","e","se","s","sw","w"],q=24;function z(n,e,t){const s=n.x-e.x,i=n.y-e.y,r=Math.cos(t),a=Math.sin(t);return{x:e.x+s*r-i*a,y:e.y+s*a+i*r}}function W(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function j(n){const{x:e,y:t,width:s,height:i}=n.bounds,r={nw:{x:e,y:t},n:{x:e+s/2,y:t},ne:{x:e+s,y:t},e:{x:e+s,y:t+i/2},se:{x:e+s,y:t+i},s:{x:e+s/2,y:t+i},sw:{x:e,y:t+i},w:{x:e,y:t+i/2},rotate:{x:e+s/2,y:t-q}},a=W(n.bounds),o={};for(const c of Object.keys(r))o[c]=z(r[c],a,n.angle);return o}const I=6,b=I/2,Z=20;class G{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:s,width:i,height:r}=e.bounds,a=i/2,o=r/2;this.ctx.ellipse(t+a,s+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:s,width:i,height:r}=e.bounds;this.ctx.save(),this.ctx.translate(t+i/2,s+r/2),this.ctx.rotate(e.angle),this.ctx.translate(-i/2,-r/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=Z*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=j(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const s of K){const i=t[s];this.ctx.fillRect(i.x-b,i.y-b,I,I)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,b+1,b+1,0,0,2*Math.PI),this.ctx.fill()}}function Q(n){return{version:1,time:n.event.time,endTime:n.event.endTime,durationSeconds:n.event.durationSeconds,place:n.event.place,witnessId:n.witnessId,witnessName:n.witnessName,caseId:n.caseId,timeline:n.timeline.toJSON(),observerTrack:n.observerTrack.toJSON()}}function V(n){return new w({eventType:"sighting",time:n.time,endTime:n.endTime,durationSeconds:n.durationSeconds,place:n.place},k.fromJSON(n.timeline),n.observerTrack?y.fromJSON(n.observerTrack):new y,n.witnessId,n.witnessName,n.caseId)}function X(n,e){for(const t of n){const s=t.toLowerCase().split("-")[0];if(e.includes(s))return s}return"en"}const Y="modulepreload",ee=function(n,e){return new URL(n,e).href},E={},P=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const o=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");i=a(t.map(h=>{if(h=ee(h,s),h in E)return;E[h]=!0;const d=h.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(!!s)for(let g=o.length-1;g>=0;g--){const v=o[g];if(v.href===h&&(!d||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${p}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":Y,d||(u.as="script"),u.crossOrigin="",u.href=h,f&&u.setAttribute("nonce",f),document.head.appendChild(u),d)return new Promise((g,v)=>{u.addEventListener("load",g),u.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},te=["en","fr"],se={en:()=>P(()=>Promise.resolve().then(()=>ie),void 0,import.meta.url).then(n=>n.ufoMessages_en),fr:()=>P(()=>import("./UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(n=>n.ufoMessages_fr)};function ne(n){return se[n]()}const A={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},ie=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:A},Symbol.toStringTag,{value:"Module"}));class re extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=w.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=A;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${F}</style>${L}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new G(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,s){e==="src"&&s&&s!==t&&this.isConnected&&this.loadFromSrc(s)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return Q(this.currentSighting)}set sightingData(e){this.currentSighting=V(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const s=this.playbackState!=="playing";for(const[i,r]of t){const a=s&&i===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...r,selected:!0}:r)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new J(this.currentSighting.timeline,(t,s)=>this.onFrame(t,s));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=X(navigator.languages,te);e!=="en"&&this.applyMessages(await ne(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=$(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?S(e.time):void 0;const s=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&s>0?s/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return x(e);const t=this.currentSighting.timeline.duration,s=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?B(M(this.realStartMs+s)):x(s)}formatEndOfTimeline(){return this.realDurationMs===void 0?x(this.currentSighting.timeline.duration):this.realStartMs!==void 0?B(M(this.realStartMs+this.realDurationMs)):x(this.realDurationMs)}}function M(n){const e=new Date(n);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function B(n){if(n.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return n.second?`${e(n.hour)}:${e(n.minute??0)}:${e(n.second)}`:`${e(n.hour)}:${e(n.minute??0)}`}function x(n){const e=Math.round(n/1e3),t=Math.floor(e/60),s=e%60;return`${t}:${String(s).padStart(2,"0")}`}const D="rr0-ufo";function ae(){customElements.get(D)||customElements.define(D,re)}ae();
@@ -143,4 +143,4 @@ input[type=range] {
143
143
  min-width: 3em;
144
144
  text-align: center;
145
145
  }
146
- `;function W(n,e,t){const{bounds:s}=n;return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function l(n,e,t){return n+(e-n)*t}function M(n){const e=/^#([0-9a-f]{6})$/i.exec(n);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function $(n){return`#${n.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function H(n,e,t){const s=M(n),i=M(e);return!s||!i?t<1?n:e:$([l(s[0],i[0],t),l(s[1],i[1],t),l(s[2],i[2],t)])}function J(n,e,t){const s={x:l(n.bounds.x,e.bounds.x,t),y:l(n.bounds.y,e.bounds.y,t),width:l(n.bounds.width,e.bounds.width,t),height:l(n.bounds.height,e.bounds.height,t)},i=l(n.angle,e.angle,t),r=l(n.transparency,e.transparency,t),a=l(n.haloScale,e.haloScale,t),o=H(n.color,e.color,t);return n.kind==="polygon"&&e.kind==="polygon"&&n.points.length===e.points.length?{...n,bounds:s,angle:i,transparency:r,haloScale:a,color:o,points:n.points.map((c,f)=>({x:l(c.x,e.points[f].x,t),y:l(c.y,e.points[f].y,t)}))}:{...t<1?n:e,bounds:s,angle:i,transparency:r,haloScale:a,color:o}}class S{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);if(this.keyframes[s]?.t===e){const i=new Set(t.map(r=>r.sourceId));this.keyframes[s]={t:e,shapes:[...this.keyframes[s].shapes.filter(r=>!i.has(r.sourceId)),...t]}}else this.keyframes.splice(s,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t];return s?.t===e?s:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(s=>s.sourceId===t)?.shape}getLatestShapeAt(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return i.shape}}getInterpolatedShapeAt(e,t){const s=this.findShapeAtOrBefore(e,t);if(s?.t===e)return s.shape;const i=this.findShapeAtOrAfter(e,t);return s?i?J(s.shape,i.shape,(e-s.t)/(i.t-s.t)):s.shape:i?.shape}findShapeAtOrBefore(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}findShapeAtOrAfter(e,t){for(let s=this.findInsertIndex(e);s<this.keyframes.length;s++){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}hitTest(e,t,s){const i=this.sourceIds;for(let r=i.length-1;r>=0;r--){const a=this.getInterpolatedShapeAt(e,i[r]);if(a&&W(a,t,s))return{sourceId:i[r],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const s of t.shapes)e.add(s.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new S;for(const s of e.keyframes)t.addKeyframe(s.t,s.shapes);return t}}function z(n,e,t){return Math.max(e,Math.min(t,n))}function K(n,e,t){const s=((e-n)%360+540)%360-180;return((n+s*t)%360+360)%360}function p(n,e,t){return n+(e-n)*t}function q(n,e,t){return{lat:n.lat===void 0||e.lat===void 0?void 0:p(n.lat,e.lat,t),lng:n.lng===void 0||e.lng===void 0?void 0:p(n.lng,e.lng,t),elevationM:p(n.elevationM,e.elevationM,t),headingDeg:n.headingDeg===void 0||e.headingDeg===void 0?void 0:K(n.headingDeg,e.headingDeg,t),pitchDeg:p(n.pitchDeg,e.pitchDeg,t),fovDeg:p(n.fovDeg,e.fovDeg,t)}}class y{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,pose:t}:this.keyframes.splice(s,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.pose;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return s?i?q(s.pose,i.pose,z((e-s.t)/(i.t-s.t),0,1)):s.pose:i?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new y;for(const s of e.keyframes)t.addKeyframe(s.t,s.pose);return t}}function E(n){if(n.year!==void 0)return Date.UTC(n.year,(n.month??1)-1,n.day??1,n.hour??0,n.minute??0,n.second??0)}function j(n){if(n.durationSeconds!==void 0)return n.durationSeconds*1e3;const e=n.time?E(n.time):void 0,t=n.endTime?E(n.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class k{constructor(e,t,s,i,r,a){this.event=e,this.timeline=t,this.observerTrack=s,this.witnessId=i,this.witnessName=r,this.caseId=a}static create(e,t,s){return new k({eventType:"sighting",time:e,place:t},new S,new y,s)}}class Z{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const s of this.timeline.sourceIds){const i=this.timeline.getInterpolatedShapeAt(e,s);i&&t.set(s,i)}this.onFrame(e,t)}}const G=["nw","n","ne","e","se","s","sw","w"],Q=24;function V(n,e,t){const s=n.x-e.x,i=n.y-e.y,r=Math.cos(t),a=Math.sin(t);return{x:e.x+s*r-i*a,y:e.y+s*a+i*r}}function X(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function Y(n){const{x:e,y:t,width:s,height:i}=n.bounds,r={nw:{x:e,y:t},n:{x:e+s/2,y:t},ne:{x:e+s,y:t},e:{x:e+s,y:t+i/2},se:{x:e+s,y:t+i},s:{x:e+s/2,y:t+i},sw:{x:e,y:t+i},w:{x:e,y:t+i/2},rotate:{x:e+s/2,y:t-Q}},a=X(n.bounds),o={};for(const c of Object.keys(r))o[c]=V(r[c],a,n.angle);return o}const I=6,b=I/2,ee=20;class te{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:s,width:i,height:r}=e.bounds,a=i/2,o=r/2;this.ctx.ellipse(t+a,s+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:s,width:i,height:r}=e.bounds;this.ctx.save(),this.ctx.translate(t+i/2,s+r/2),this.ctx.rotate(e.angle),this.ctx.translate(-i/2,-r/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=ee*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=Y(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const s of G){const i=t[s];this.ctx.fillRect(i.x-b,i.y-b,I,I)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,b+1,b+1,0,0,2*Math.PI),this.ctx.fill()}}function se(n){return{version:1,time:n.event.time,endTime:n.event.endTime,durationSeconds:n.event.durationSeconds,place:n.event.place,witnessId:n.witnessId,witnessName:n.witnessName,caseId:n.caseId,timeline:n.timeline.toJSON(),observerTrack:n.observerTrack.toJSON()}}function ne(n){return new k({eventType:"sighting",time:n.time,endTime:n.endTime,durationSeconds:n.durationSeconds,place:n.place},S.fromJSON(n.timeline),n.observerTrack?y.fromJSON(n.observerTrack):new y,n.witnessId,n.witnessName,n.caseId)}function C(n,e){for(const t of n){const s=t.toLowerCase().split("-")[0];if(e.includes(s))return s}return"en"}const ie="modulepreload",re=function(n,e){return new URL(n,e).href},P={},x=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};const o=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");i=a(t.map(h=>{if(h=re(h,s),h in P)return;P[h]=!0;const d=h.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(!!s)for(let g=o.length-1;g>=0;g--){const v=o[g];if(v.href===h&&(!d||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${m}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":ie,d||(u.as="script"),u.crossOrigin="",u.href=h,f&&u.setAttribute("nonce",f),document.head.appendChild(u),d)return new Promise((g,v)=>{u.addEventListener("load",g),u.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},D=["en","fr"],ae={en:()=>x(()=>Promise.resolve().then(()=>ce),void 0,import.meta.url).then(n=>n.ufoMessages_en),fr:()=>x(()=>import("./assets/UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(n=>n.ufoMessages_fr)};function oe(n){return ae[n]()}const le={en:()=>x(()=>import("./assets/WitnessSelectorMessages_en-D8xgZDfY.js"),[],import.meta.url).then(n=>n.witnessSelectorMessages_en),fr:()=>x(()=>import("./assets/WitnessSelectorMessages_fr-C0GHqC_J.js"),[],import.meta.url).then(n=>n.witnessSelectorMessages_fr)};function he(n){return le[n]()}const F={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},ce=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:F},Symbol.toStringTag,{value:"Module"}));class ue extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=k.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=F;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${U}</style>${N}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new te(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,s){e==="src"&&s&&s!==t&&this.isConnected&&this.loadFromSrc(s)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return se(this.currentSighting)}set sightingData(e){this.currentSighting=ne(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const s=this.playbackState!=="playing";for(const[i,r]of t){const a=s&&i===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...r,selected:!0}:r)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new Z(this.currentSighting.timeline,(t,s)=>this.onFrame(t,s));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=C(navigator.languages,D);e!=="en"&&this.applyMessages(await oe(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=j(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?E(e.time):void 0;const s=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&s>0?s/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return w(e);const t=this.currentSighting.timeline.duration,s=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?B(L(this.realStartMs+s)):w(s)}formatEndOfTimeline(){return this.realDurationMs===void 0?w(this.currentSighting.timeline.duration):this.realStartMs!==void 0?B(L(this.realStartMs+this.realDurationMs)):w(this.realDurationMs)}}function L(n){const e=new Date(n);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function B(n){if(n.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return n.second?`${e(n.hour)}:${e(n.minute??0)}:${e(n.second)}`:`${e(n.hour)}:${e(n.minute??0)}`}function w(n){const e=Math.round(n/1e3),t=Math.floor(e/60),s=e%60;return`${t}:${String(s).padStart(2,"0")}`}const T="rr0-ufo";function _(){customElements.get(T)||customElements.define(T,ue)}_();class de extends HTMLElement{static get observedAttributes(){return["src"]}shadow;ufoElement;selectorContainer;witnessSelect;labelWitness;entries=[];currentSrc;constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${R}</style>${O}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.ufoElement=document.createElement(T),this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.selectorContainer=this.shadow.getElementById("witness-selector"),this.witnessSelect=this.shadow.getElementById("witness"),this.labelWitness=this.shadow.getElementById("label-witness"),this.witnessSelect.addEventListener("change",()=>this.selectWitness(this.witnessSelect.value)),this.loadLocaleMessages()}async loadLocaleMessages(){const e=C(navigator.languages,D);if(e==="en")return;const t=await he(e);this.labelWitness.textContent=t.witness}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}attributeChangedCallback(e,t,s){e==="src"&&s&&s!==t&&this.isConnected&&this.loadFromSrc(s)}async loadFromSrc(e){const s=await(await fetch(e)).json();await this.loadWitnessUrls(s)}get witnessUrls(){return this.entries.map(e=>e.src)}set witnessUrls(e){this.loadWitnessUrls(e)}async loadWitnessUrls(e){const t=await Promise.all(e.map(async s=>{const i=await fetch(s);return{src:s,sighting:await i.json()}}));this.setEntries(t)}setEntries(e){this.entries=e,this.warnOnMismatchedCaseIds(e),this.selectorContainer.hidden=e.length<=1,this.witnessSelect.innerHTML="";for(const s of e){const i=document.createElement("option");i.value=s.src,i.textContent=s.sighting.witnessName??s.sighting.witnessId??s.src,this.witnessSelect.appendChild(i)}const t=e.find(s=>s.src===this.currentSrc)??e[0];t&&this.selectWitness(t.src)}warnOnMismatchedCaseIds(e){const t=new Set(e.map(s=>s.sighting.caseId).filter(s=>s!==void 0));t.size>1&&console.warn(`<rr0-ufo-witnesses>: witnesses declare different case ids (${[...t].join(", ")}) — they may not belong to the same case.`)}selectWitness(e){const t=this.entries.find(s=>s.src===e);t&&(this.currentSrc=e,this.witnessSelect.value=e,this.ufoElement.sightingData=t.sighting)}}const A="rr0-ufo-witnesses";function fe(){_(),customElements.get(A)||customElements.define(A,de)}fe();
146
+ `;function W(n,e,t){const{bounds:s}=n;return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function l(n,e,t){return n+(e-n)*t}function M(n){const e=/^#([0-9a-f]{6})$/i.exec(n);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function $(n){return`#${n.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function H(n,e,t){const s=M(n),i=M(e);return!s||!i?t<1?n:e:$([l(s[0],i[0],t),l(s[1],i[1],t),l(s[2],i[2],t)])}function J(n,e,t){const s={x:l(n.bounds.x,e.bounds.x,t),y:l(n.bounds.y,e.bounds.y,t),width:l(n.bounds.width,e.bounds.width,t),height:l(n.bounds.height,e.bounds.height,t)},i=l(n.angle,e.angle,t),r=l(n.transparency,e.transparency,t),a=l(n.haloScale,e.haloScale,t),o=H(n.color,e.color,t);return n.kind==="polygon"&&e.kind==="polygon"&&n.points.length===e.points.length?{...n,bounds:s,angle:i,transparency:r,haloScale:a,color:o,points:n.points.map((c,f)=>({x:l(c.x,e.points[f].x,t),y:l(c.y,e.points[f].y,t)}))}:{...t<1?n:e,bounds:s,angle:i,transparency:r,haloScale:a,color:o}}class S{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);if(this.keyframes[s]?.t===e){const i=new Set(t.map(r=>r.sourceId));this.keyframes[s]={t:e,shapes:[...this.keyframes[s].shapes.filter(r=>!i.has(r.sourceId)),...t]}}else this.keyframes.splice(s,0,{t:e,shapes:[...t]})}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t];return s?.t===e?s:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(s=>s.sourceId===t)?.shape}getLatestShapeAt(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return i.shape}}getInterpolatedShapeAt(e,t){const s=this.findShapeAtOrBefore(e,t);if(s?.t===e)return s.shape;const i=this.findShapeAtOrAfter(e,t);return s?i?J(s.shape,i.shape,(e-s.t)/(i.t-s.t)):s.shape:i?.shape}findShapeAtOrBefore(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}findShapeAtOrAfter(e,t){for(let s=this.findInsertIndex(e);s<this.keyframes.length;s++){const i=this.keyframes[s].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[s].t,shape:i.shape}}}hitTest(e,t,s){const i=this.sourceIds;for(let r=i.length-1;r>=0;r--){const a=this.getInterpolatedShapeAt(e,i[r]);if(a&&W(a,t,s))return{sourceId:i[r],shape:a}}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){const e=new Set;for(const t of this.keyframes)for(const s of t.shapes)e.add(s.sourceId);return[...e]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new S;for(const s of e.keyframes)t.addKeyframe(s.t,s.shapes);return t}}function z(n,e,t){return Math.max(e,Math.min(t,n))}function K(n,e,t){const s=((e-n)%360+540)%360-180;return((n+s*t)%360+360)%360}function p(n,e,t){return n+(e-n)*t}function q(n,e,t){return{lat:n.lat===void 0||e.lat===void 0?void 0:p(n.lat,e.lat,t),lng:n.lng===void 0||e.lng===void 0?void 0:p(n.lng,e.lng,t),elevationM:p(n.elevationM,e.elevationM,t),headingDeg:n.headingDeg===void 0||e.headingDeg===void 0?void 0:K(n.headingDeg,e.headingDeg,t),pitchDeg:p(n.pitchDeg,e.pitchDeg,t),fovDeg:p(n.fovDeg,e.fovDeg,t)}}class y{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,pose:t}:this.keyframes.splice(s,0,{t:e,pose:t})}clear(){this.keyframes.length=0}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const i=t+s>>>1;this.keyframes[i].t<e?t=i+1:s=i}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.pose;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return s?i?q(s.pose,i.pose,z((e-s.t)/(i.t-s.t),0,1)):s.pose:i?.pose}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new y;for(const s of e.keyframes)t.addKeyframe(s.t,s.pose);return t}}function E(n){if(n.year!==void 0)return Date.UTC(n.year,(n.month??1)-1,n.day??1,n.hour??0,n.minute??0,n.second??0)}function j(n){if(n.durationSeconds!==void 0)return n.durationSeconds*1e3;const e=n.time?E(n.time):void 0,t=n.endTime?E(n.endTime):void 0;return e!==void 0&&t!==void 0?t-e:void 0}class k{constructor(e,t,s,i,r,a){this.event=e,this.timeline=t,this.observerTrack=s,this.witnessId=i,this.witnessName=r,this.caseId=a}static create(e,t,s){return new k({eventType:"sighting",time:e,place:t},new S,new y,s)}}class Z{constructor(e,t){this.timeline=e,this.onFrame=t}rafId=null;state="stopped";currentT=0;lastWallTime=0;playbackRate=1;loop=!1;durationOverrideMs=0;get seekableDuration(){return Math.max(this.timeline.duration,this.durationOverrideMs)}play(){if(this.state==="playing")return;this.currentT>=this.seekableDuration&&(this.currentT=0,this.resolveFrame(0)),this.state="playing",this.lastWallTime=performance.now();const e=()=>{if(this.state!=="playing")return;const t=performance.now();if(this.currentT+=(t-this.lastWallTime)*this.playbackRate,this.lastWallTime=t,this.currentT>=this.seekableDuration){if(this.loop&&this.seekableDuration>0){this.currentT%=this.seekableDuration,this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e);return}this.currentT=this.seekableDuration,this.stop(),this.resolveFrame(this.currentT);return}this.resolveFrame(this.currentT),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}pause(){this.state==="playing"&&(this.state="paused",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null))}stop(){this.state="stopped",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}seek(e){this.currentT=Math.max(0,Math.min(e,this.seekableDuration)),this.resolveFrame(this.currentT)}get playbackState(){return this.state}get time(){return this.currentT}resolveFrame(e){const t=new Map;for(const s of this.timeline.sourceIds){const i=this.timeline.getInterpolatedShapeAt(e,s);i&&t.set(s,i)}this.onFrame(e,t)}}const G=["nw","n","ne","e","se","s","sw","w"],Q=24;function V(n,e,t){const s=n.x-e.x,i=n.y-e.y,r=Math.cos(t),a=Math.sin(t);return{x:e.x+s*r-i*a,y:e.y+s*a+i*r}}function X(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function Y(n){const{x:e,y:t,width:s,height:i}=n.bounds,r={nw:{x:e,y:t},n:{x:e+s/2,y:t},ne:{x:e+s,y:t},e:{x:e+s,y:t+i/2},se:{x:e+s,y:t+i},s:{x:e+s/2,y:t+i},sw:{x:e,y:t+i},w:{x:e,y:t+i/2},rotate:{x:e+s/2,y:t-Q}},a=X(n.bounds),o={};for(const c of Object.keys(r))o[c]=V(r[c],a,n.angle);return o}const I=6,b=I/2,ee=20;class te{constructor(e){this.ctx=e}clear(e,t){this.ctx.clearRect(0,0,e,t)}paintShape(e){this.ctx.save(),this.ctx.globalAlpha=1-e.transparency,e.haloScale>0&&this.paintHalo(e),this.paintBase(e),this.ctx.restore(),e.selected&&this.paintSelectionHandles(e)}paintBase(e){if(this.ctx.fillStyle=e.color,this.ctx.beginPath(),e.kind==="oval"){const{x:t,y:s,width:i,height:r}=e.bounds,a=i/2,o=r/2;this.ctx.ellipse(t+a,s+o,a,o,e.angle,0,2*Math.PI)}else{const{x:t,y:s,width:i,height:r}=e.bounds;this.ctx.save(),this.ctx.translate(t+i/2,s+r/2),this.ctx.rotate(e.angle),this.ctx.translate(-i/2,-r/2),e.points.forEach((a,o)=>{o===0?this.ctx.moveTo(a.x,a.y):this.ctx.lineTo(a.x,a.y)}),this.ctx.closePath(),this.ctx.restore()}this.ctx.fill()}paintHalo(e){this.ctx.save(),this.ctx.shadowColor=e.color,this.ctx.shadowBlur=ee*e.haloScale,this.paintBase(e),this.ctx.restore()}paintSelectionHandles(e){const t=Y(e);this.ctx.strokeStyle="lightgray",this.ctx.beginPath(),this.ctx.moveTo(t.nw.x,t.nw.y),this.ctx.lineTo(t.ne.x,t.ne.y),this.ctx.lineTo(t.se.x,t.se.y),this.ctx.lineTo(t.sw.x,t.sw.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fillStyle="lightgray";for(const s of G){const i=t[s];this.ctx.fillRect(i.x-b,i.y-b,I,I)}this.ctx.beginPath(),this.ctx.moveTo(t.n.x,t.n.y),this.ctx.lineTo(t.rotate.x,t.rotate.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.ellipse(t.rotate.x,t.rotate.y,b+1,b+1,0,0,2*Math.PI),this.ctx.fill()}}function se(n){return{version:1,time:n.event.time,endTime:n.event.endTime,durationSeconds:n.event.durationSeconds,place:n.event.place,witnessId:n.witnessId,witnessName:n.witnessName,caseId:n.caseId,timeline:n.timeline.toJSON(),observerTrack:n.observerTrack.toJSON()}}function ne(n){return new k({eventType:"sighting",time:n.time,endTime:n.endTime,durationSeconds:n.durationSeconds,place:n.place},S.fromJSON(n.timeline),n.observerTrack?y.fromJSON(n.observerTrack):new y,n.witnessId,n.witnessName,n.caseId)}function C(n,e){for(const t of n){const s=t.toLowerCase().split("-")[0];if(e.includes(s))return s}return"en"}const ie="modulepreload",re=function(n,e){return new URL(n,e).href},P={},x=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};const o=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");i=a(t.map(h=>{if(h=re(h,s),h in P)return;P[h]=!0;const d=h.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(!!s)for(let g=o.length-1;g>=0;g--){const v=o[g];if(v.href===h&&(!d||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${m}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":ie,d||(u.as="script"),u.crossOrigin="",u.href=h,f&&u.setAttribute("nonce",f),document.head.appendChild(u),d)return new Promise((g,v)=>{u.addEventListener("load",g),u.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},D=["en","fr"],ae={en:()=>x(()=>Promise.resolve().then(()=>ce),void 0,import.meta.url).then(n=>n.ufoMessages_en),fr:()=>x(()=>import("./UfoMessages_fr-COCxf8Q_.js"),[],import.meta.url).then(n=>n.ufoMessages_fr)};function oe(n){return ae[n]()}const le={en:()=>x(()=>import("./WitnessSelectorMessages_en-D8xgZDfY.js"),[],import.meta.url).then(n=>n.witnessSelectorMessages_en),fr:()=>x(()=>import("./WitnessSelectorMessages_fr-C0GHqC_J.js"),[],import.meta.url).then(n=>n.witnessSelectorMessages_fr)};function he(n){return le[n]()}const F={play:"Play",pause:"Pause",autoReplay:"Auto-replay",currentPosition:"Current position",duration:"Duration",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen"},ce=Object.freeze(Object.defineProperty({__proto__:null,ufoMessages_en:F},Symbol.toStringTag,{value:"Module"}));class ue extends HTMLElement{static get observedAttributes(){return["src"]}shadow;stageElement;canvas;canvasRenderer;toolbar;playPauseButton;loopButton;fullscreenButton;seekInput;timeStartLabel;timeEndLabel;currentSighting=k.create();player;loopEnabled=!0;highlightedSourceId;enableClickToPlay=!0;fullscreenTarget;messages=F;realDurationMs;realStartMs;handleFullscreenChange=()=>this.updateFullscreenButton();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${U}</style>${N}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.canvas=this.shadow.getElementById("canvas"),this.canvasRenderer=new te(this.canvas.getContext("2d")),this.toolbar=this.shadow.getElementById("toolbar"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.loopButton=this.shadow.getElementById("loop"),this.fullscreenButton=this.shadow.getElementById("fullscreen"),this.seekInput=this.shadow.getElementById("seek"),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end"),this.fullscreenTarget=this.stageElement,this.playPauseButton.addEventListener("click",()=>this.togglePlayPause()),this.loopButton.addEventListener("click",()=>this.toggleLoop()),this.fullscreenButton.addEventListener("click",()=>this.toggleFullscreen()),this.seekInput.addEventListener("input",()=>this.player.seek(Number(this.seekInput.value))),this.canvas.addEventListener("click",()=>{this.enableClickToPlay&&this.togglePlayPause()}),document.addEventListener("fullscreenchange",this.handleFullscreenChange),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.updateFullscreenButton(),this.refresh(),this.loadLocaleMessages()}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.handleFullscreenChange)}attributeChangedCallback(e,t,s){e==="src"&&s&&s!==t&&this.isConnected&&this.loadFromSrc(s)}async loadFromSrc(e){const t=await fetch(e);this.sightingData=await t.json()}get sightingData(){return se(this.currentSighting)}set sightingData(e){this.currentSighting=ne(e),this.player=this.createPlayer(),this.updateTimeLabels(),this.updatePlayPauseButton(),this.refresh()}get sighting(){return this.currentSighting}get canvasElement(){return this.canvas}get renderer(){return this.canvasRenderer}get currentTime(){return this.player.time}get playbackState(){return this.player.playbackState}get selectedSourceId(){return this.highlightedSourceId}get durationSeconds(){return this.currentSighting.event.durationSeconds}set durationSeconds(e){this.currentSighting.event.durationSeconds=e,this.updateTimeLabels(),this.refresh()}set selectedSourceId(e){e!==this.highlightedSourceId&&(this.highlightedSourceId=e,this.refresh())}refresh(){this.seekInput.max=String(this.player.seekableDuration),this.player.seek(this.player.time)}onFrame(e,t){this.canvasRenderer.clear(this.canvas.width,this.canvas.height);const s=this.playbackState!=="playing";for(const[i,r]of t){const a=s&&i===this.highlightedSourceId;this.canvasRenderer.paintShape(a?{...r,selected:!0}:r)}this.seekInput.value=String(e),this.timeStartLabel.textContent=this.formatPosition(e),this.updatePlayPauseButton(),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{time:e}}))}createPlayer(){const e=new Z(this.currentSighting.timeline,(t,s)=>this.onFrame(t,s));return e.loop=this.loopEnabled,e}togglePlayPause(){this.player.playbackState==="playing"?(this.player.pause(),this.refresh()):this.player.play(),this.updatePlayPauseButton()}updatePlayPauseButton(){const e=this.player.playbackState==="playing";this.playPauseButton.textContent=e?"⏸":"▶",this.playPauseButton.title=e?this.messages.pause:this.messages.play,this.playPauseButton.setAttribute("aria-label",e?this.messages.pause:this.messages.play),this.toolbar.classList.toggle("auto-hide",e),this.fullscreenButton.classList.toggle("auto-hide",e)}toggleLoop(){this.loopEnabled=!this.loopEnabled,this.loopButton.setAttribute("aria-pressed",String(this.loopEnabled)),this.player.loop=this.loopEnabled}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.fullscreenTarget.requestFullscreen().catch(e=>{console.error("<rr0-ufo>: requestFullscreen() failed —",e)})}updateFullscreenButton(){const e=document.fullscreenElement===this.fullscreenTarget;this.fullscreenButton.title=e?this.messages.exitFullscreen:this.messages.fullscreen,this.fullscreenButton.setAttribute("aria-label",this.fullscreenButton.title)}async loadLocaleMessages(){const e=C(navigator.languages,D);e!=="en"&&this.applyMessages(await oe(e))}applyMessages(e){this.messages=e,this.timeStartLabel.title=e.currentPosition,this.timeEndLabel.title=e.duration,this.loopButton.title=e.autoReplay,this.loopButton.setAttribute("aria-label",e.autoReplay),this.updatePlayPauseButton(),this.updateFullscreenButton()}updateTimeLabels(){const e=this.currentSighting.event,t=j(e);this.realDurationMs=t!==void 0&&t>0?t:void 0,this.realStartMs=e.time?E(e.time):void 0;const s=this.currentSighting.timeline.duration;this.player.playbackRate=this.realDurationMs!==void 0&&s>0?s/this.realDurationMs:1,this.player.durationOverrideMs=this.realDurationMs??0,this.timeEndLabel.textContent=this.formatEndOfTimeline(),this.timeStartLabel.textContent=this.formatPosition(this.player.time)}formatPosition(e){if(this.realDurationMs===void 0)return w(e);const t=this.currentSighting.timeline.duration,s=t>0&&e<=t?e/t*this.realDurationMs:e;return this.realStartMs!==void 0?B(L(this.realStartMs+s)):w(s)}formatEndOfTimeline(){return this.realDurationMs===void 0?w(this.currentSighting.timeline.duration):this.realStartMs!==void 0?B(L(this.realStartMs+this.realDurationMs)):w(this.realDurationMs)}}function L(n){const e=new Date(n);return{hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}function B(n){if(n.hour===void 0)return"0:00";const e=t=>String(t).padStart(2,"0");return n.second?`${e(n.hour)}:${e(n.minute??0)}:${e(n.second)}`:`${e(n.hour)}:${e(n.minute??0)}`}function w(n){const e=Math.round(n/1e3),t=Math.floor(e/60),s=e%60;return`${t}:${String(s).padStart(2,"0")}`}const T="rr0-ufo";function _(){customElements.get(T)||customElements.define(T,ue)}_();class de extends HTMLElement{static get observedAttributes(){return["src"]}shadow;ufoElement;selectorContainer;witnessSelect;labelWitness;entries=[];currentSrc;constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${R}</style>${O}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.ufoElement=document.createElement(T),this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.selectorContainer=this.shadow.getElementById("witness-selector"),this.witnessSelect=this.shadow.getElementById("witness"),this.labelWitness=this.shadow.getElementById("label-witness"),this.witnessSelect.addEventListener("change",()=>this.selectWitness(this.witnessSelect.value)),this.loadLocaleMessages()}async loadLocaleMessages(){const e=C(navigator.languages,D);if(e==="en")return;const t=await he(e);this.labelWitness.textContent=t.witness}connectedCallback(){const e=this.getAttribute("src");e&&this.loadFromSrc(e)}attributeChangedCallback(e,t,s){e==="src"&&s&&s!==t&&this.isConnected&&this.loadFromSrc(s)}async loadFromSrc(e){const s=await(await fetch(e)).json();await this.loadWitnessUrls(s)}get witnessUrls(){return this.entries.map(e=>e.src)}set witnessUrls(e){this.loadWitnessUrls(e)}async loadWitnessUrls(e){const t=await Promise.all(e.map(async s=>{const i=await fetch(s);return{src:s,sighting:await i.json()}}));this.setEntries(t)}setEntries(e){this.entries=e,this.warnOnMismatchedCaseIds(e),this.selectorContainer.hidden=e.length<=1,this.witnessSelect.innerHTML="";for(const s of e){const i=document.createElement("option");i.value=s.src,i.textContent=s.sighting.witnessName??s.sighting.witnessId??s.src,this.witnessSelect.appendChild(i)}const t=e.find(s=>s.src===this.currentSrc)??e[0];t&&this.selectWitness(t.src)}warnOnMismatchedCaseIds(e){const t=new Set(e.map(s=>s.sighting.caseId).filter(s=>s!==void 0));t.size>1&&console.warn(`<rr0-ufo-witnesses>: witnesses declare different case ids (${[...t].join(", ")}) — they may not belong to the same case.`)}selectWitness(e){const t=this.entries.find(s=>s.src===e);t&&(this.currentSrc=e,this.witnessSelect.value=e,this.ufoElement.sightingData=t.sighting)}}const A="rr0-ufo-witnesses";function fe(){_(),customElements.get(A)||customElements.define(A,de)}fe();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rr0/ufoathome",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
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",