@rr0/ufoathome 0.60.0 → 0.60.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.
|
@@ -376,7 +376,7 @@ const Lg=`
|
|
|
376
376
|
margin: 0.4em 0 0;
|
|
377
377
|
padding-left: 1.2em;
|
|
378
378
|
}
|
|
379
|
-
`;class Js extends Error{constructor(e,t,n){super(`${e}: ${t}${n===void 0?"":` (HTTP ${n})`}`),this.kind=e,this.url=t,this.status=n,this.name="SightingFetchError"}}class fl{static async json(e){const t=new URL(e,location.href);if(location.protocol==="https:"&&t.protocol==="http:")throw new Js("mixed-content",e);let n;try{n=await fetch(e)}catch{throw await this.diagnose(e,t)}if(!n.ok)throw new Js("status",e,n.status);try{return await n.json()}catch{throw new Js("malformed",e)}}static async diagnose(e,t){if(t.origin===location.origin)return new Js("unreachable",e);try{return await fetch(e,{mode:"no-cors"}),new Js("cors",e)}catch{return new Js("unreachable",e)}}}class mt{static MOON_ANGULAR_WIDTH_DEG=.5237;static CANVAS_WIDTH_PX=640;static CANVAS_HEIGHT_PX=360;static angularWidthDeg(e){return 2*Math.atan(e.sizeM/(2*e.distanceM))*180/Math.PI}static inMoons(e){return e/mt.MOON_ANGULAR_WIDTH_DEG}static lerpAngular(e,t,n){if(!(!e||!t))return{widthDeg:e.widthDeg+(t.widthDeg-e.widthDeg)*n,heightDeg:e.heightDeg+(t.heightDeg-e.heightDeg)*n}}static sizeMAt(e,t){return 2*e*Math.tan(t*Math.PI/360)}static distanceMAt(e,t){return e/(2*Math.tan(t*Math.PI/360))}}function Og(s,e,t){if(!s||!e)return t<1?s:e;const n=((e.azimuthDeg-s.azimuthDeg)%360+540)%360-180;return{azimuthDeg:((s.azimuthDeg+n*t)%360+360)%360,altitudeDeg:s.altitudeDeg+(e.altitudeDeg-s.altitudeDeg)*t}}function Ug(s,e,t){const{bounds:n}=s;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function bn(s,e,t){return s+(e-s)*t}function Rd(s){const e=/^#([0-9a-f]{6})$/i.exec(s);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function Fg(s){return`#${s.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function kg(s,e,t){const n=Rd(s),i=Rd(e);return!n||!i?t<1?s:e:Fg([bn(n[0],i[0],t),bn(n[1],i[1],t),bn(n[2],i[2],t)])}function zg(s,e,t){const n={x:bn(s.bounds.x,e.bounds.x,t),y:bn(s.bounds.y,e.bounds.y,t),width:bn(s.bounds.width,e.bounds.width,t),height:bn(s.bounds.height,e.bounds.height,t)},i=bn(s.angle,e.angle,t),r=bn(s.transparency,e.transparency,t),a=bn(s.haloScale,e.haloScale,t),o=bn(s.blur??0,e.blur??0,t),l=bn(s.brightness??0,e.brightness??0,t),c=kg(s.color,e.color,t),h=mt.lerpAngular(s.angular,e.angular,t),u=Og(s.aim,e.aim,t);return s.kind==="polygon"&&e.kind==="polygon"&&s.points.length===e.points.length?{...s,bounds:n,angle:i,transparency:r,haloScale:a,blur:o,brightness:l,color:c,angular:h,aim:u,points:s.points.map((d,f)=>({x:bn(d.x,e.points[f].x,t),y:bn(d.y,e.points[f].y,t)}))}:{...t<1?s:e,bounds:n,angle:i,transparency:r,haloScale:a,blur:o,brightness:l,color:c,angular:h,aim:u}}class Fl{keyframes=[];order=[];groups=[];addKeyframe(e,t){const n=this.findInsertIndex(e);if(this.keyframes[n]?.t===e){const i=new Set(t.map(r=>r.sourceId));this.keyframes[n]={t:e,shapes:[...this.keyframes[n].shapes.filter(r=>!i.has(r.sourceId)),...t]}}else this.keyframes.splice(n,0,{t:e,shapes:[...t]});for(const i of t)this.order.includes(i.sourceId)||this.order.push(i.sourceId)}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=i}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 i=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(i)return i.shape}}getInterpolatedShapeAt(e,t){const n=this.findShapeAtOrBefore(e,t);if(n?.t===e)return n.shape;const i=this.findShapeAtOrAfter(e,t);return n?i?zg(n.shape,i.shape,(e-n.t)/(i.t-n.t)):n.shape:i?.shape}findShapeAtOrBefore(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const i=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[n].t,shape:i.shape}}}findShapeAtOrAfter(e,t){for(let n=this.findInsertIndex(e);n<this.keyframes.length;n++){const i=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[n].t,shape:i.shape}}}hitTest(e,t,n,i){const r=this.sourceIds;for(let a=r.length-1;a>=0;a--){if(i?.has(r[a]))continue;const o=this.getInterpolatedShapeAt(e,r[a]);if(o&&Ug(o,t,n))return{sourceId:r[a],shape:o}}}removeSource(e){for(let t=this.keyframes.length-1;t>=0;t--){const n=this.keyframes[t].shapes.filter(i=>i.sourceId!==e);n.length===0?this.keyframes.splice(t,1):n.length!==this.keyframes[t].shapes.length&&(this.keyframes[t]={t:this.keyframes[t].t,shapes:n})}this.order=this.order.filter(t=>t!==e),this.removeFromGroup(e)}group(e){if(!(e.length<2)){for(const t of e)this.removeFromGroup(t);this.groups.push([...e])}}ungroup(e){const t=this.groups.findIndex(n=>n.includes(e));t!==-1&&this.groups.splice(t,1)}groupMembers(e){return this.groups.find(t=>t.includes(e))}removeFromGroup(e){const t=this.groups.findIndex(i=>i.includes(e));if(t===-1)return;const n=this.groups[t].filter(i=>i!==e);n.length<2?this.groups.splice(t,1):this.groups[t]=n}bringToFront(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.push(e))}sendToBack(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.unshift(e))}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){return[...this.order]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes,order:this.order,groups:this.groups}}static fromJSON(e){const t=new Fl;for(const n of e.keyframes)t.addKeyframe(n.t,n.shapes);if(e.order){const n=t.order.filter(i=>!e.order.includes(i));t.order=[...e.order,...n]}return e.groups&&(t.groups=e.groups.map(n=>n.filter(i=>t.order.includes(i))).filter(n=>n.length>=2)),t}}function Bg(s,e,t){return Math.max(e,Math.min(t,s))}function Hg(s,e,t){const n=((e-s)%360+540)%360-180;return((s+n*t)%360+360)%360}function js(s,e,t){return s+(e-s)*t}function Gg(s,e,t){return{lat:s.lat===void 0||e.lat===void 0?void 0:js(s.lat,e.lat,t),lng:s.lng===void 0||e.lng===void 0?void 0:js(s.lng,e.lng,t),elevationM:js(s.elevationM,e.elevationM,t),headingDeg:s.headingDeg===void 0||e.headingDeg===void 0?void 0:Hg(s.headingDeg,e.headingDeg,t),pitchDeg:js(s.pitchDeg,e.pitchDeg,t),rollDeg:js(s.rollDeg??0,e.rollDeg??0,t),fovDeg:js(s.fovDeg,e.fovDeg,t),fNumber:s.fNumber,focusDistanceM:s.focusDistanceM}}class Da{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}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=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),n=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(n?.t===e)return n.pose;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?i?Gg(n.pose,i.pose,Bg((e-n.t)/(i.t-n.t),0,1)):n.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 Da;for(const n of e.keyframes)t.addKeyframe(n.t,n.pose);return t}}const Bu=1e3,Vg=.65,kp={cloudCover:0,cloudDarkness:0,precipitationType:"none",precipitationIntensity:0,windDirectionDeg:0,windSpeed:0,storm:!1};function pl(s){if(s.cloudLayers!==void 0)return s.cloudLayers;const e=[],t=s.lowerCloudCover??s.cloudCover;return t>0&&e.push({id:"lower",type:"cumulus",baseM:s.cloudBaseM??Bu,thicknessM:650,coverage:t,sizeM:1400,density:1,darkness:s.cloudDarkness}),(s.highCloudCover??0)>0&&e.push({id:"cirrus",type:"cirrus",baseM:8e3,thicknessM:400,coverage:s.highCloudCover,sizeM:2200,density:.35,darkness:s.cloudDarkness,iceCrystalAlignment:s.iceCrystalAlignment}),e}function bt(s,e,t){return s+(e-s)*t}function Hu(s,e,t){const n=((e-s)%360+540)%360-180;return((s+n*t)%360+360)%360}function Wg(s,e,t){return Math.max(e,Math.min(t,s))}function Xg(s=[],e=[],t){if(!(!s.length&&!e.length))return[...new Set([...s.map(n=>n.id),...e.map(n=>n.id)])].map(n=>{const i=s.find(l=>l.id===n),r=e.find(l=>l.id===n),a=i??{...r,density:0},o=r??{...i,density:0};return{...a,eastM:bt(a.eastM,o.eastM,t),northM:bt(a.northM,o.northM,t),baseM:bt(a.baseM,o.baseM,t),thicknessM:bt(a.thicknessM,o.thicknessM,t),widthM:bt(a.widthM,o.widthM,t),depthM:bt(a.depthM,o.depthM,t),rotationDeg:Hu(a.rotationDeg,o.rotationDeg,t),density:bt(a.density,o.density,t),darkness:bt(a.darkness??0,o.darkness??0,t)}})}function qg(s,e,t){if(s.cloudLayers===void 0&&e.cloudLayers===void 0)return;const n=pl(s),i=pl(e);return t>=1?i.map(a=>({...a})):[...new Set([...n.map(a=>a.id),...i.map(a=>a.id)])].map(a=>{const o=n.find(u=>u.id===a),l=i.find(u=>u.id===a),c=o??{...l,coverage:0},h=l??{...o,coverage:0};return{...c,instances:Xg(o?.instances,l?.instances,t),baseM:bt(c.baseM,h.baseM,t),thicknessM:bt(c.thicknessM,h.thicknessM,t),coverage:bt(c.coverage,h.coverage,t),sizeM:bt(c.sizeM,h.sizeM,t),density:bt(c.density,h.density,t),darkness:bt(c.darkness??s.cloudDarkness,h.darkness??e.cloudDarkness,t),iceCrystalAlignment:c.iceCrystalAlignment===void 0||h.iceCrystalAlignment===void 0?void 0:bt(c.iceCrystalAlignment,h.iceCrystalAlignment,t),windSpeed:c.windSpeed===void 0&&h.windSpeed===void 0?void 0:bt(c.windSpeed??s.windSpeed,h.windSpeed??e.windSpeed,t),windDirectionDeg:c.windDirectionDeg===void 0&&h.windDirectionDeg===void 0?void 0:Hu(c.windDirectionDeg??s.windDirectionDeg,h.windDirectionDeg??e.windDirectionDeg,t)}})}function Yg(s,e,t){return{cloudLayers:qg(s,e,t),cloudCover:bt(s.cloudCover,e.cloudCover,t),cloudDarkness:bt(s.cloudDarkness,e.cloudDarkness,t),highCloudCover:s.highCloudCover===void 0||e.highCloudCover===void 0?void 0:bt(s.highCloudCover,e.highCloudCover,t),iceCrystalAlignment:s.iceCrystalAlignment===void 0||e.iceCrystalAlignment===void 0?void 0:bt(s.iceCrystalAlignment,e.iceCrystalAlignment,t),lowerCloudCover:s.lowerCloudCover===void 0||e.lowerCloudCover===void 0?void 0:bt(s.lowerCloudCover,e.lowerCloudCover,t),cloudBaseM:s.cloudBaseM===void 0||e.cloudBaseM===void 0?void 0:bt(s.cloudBaseM,e.cloudBaseM,t),precipitationType:t<1?s.precipitationType:e.precipitationType,precipitationIntensity:bt(s.precipitationIntensity,e.precipitationIntensity,t),windDirectionDeg:Hu(s.windDirectionDeg,e.windDirectionDeg,t),windSpeed:bt(s.windSpeed,e.windSpeed,t),storm:t<1?s.storm:e.storm}}class Pa{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,weather:t}:this.keyframes.splice(n,0,{t:e,weather:t})}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=i}return t}getLatestWeatherAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].weather:void 0}getInterpolatedWeatherAt(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.weather;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?i?Yg(n.weather,i.weather,Wg((e-n.t)/(i.t-n.t),0,1)):n.weather:i?.weather}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 Pa;for(const n of e.keyframes)t.addKeyframe(n.t,n.weather);return t}}class Ia{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,sound:t}:this.keyframes.splice(n,0,{t:e,sound:t})}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}getLatestSoundAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].sound:void 0}getInterpolatedSoundAt(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.sound;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];if(!n)return i?.sound;if(!i)return n.sound;const r=(e-n.t)/(i.t-n.t);return this.lerp(n.sound,i.sound,Math.max(0,Math.min(1,r)))}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 Ia;for(const n of e.keyframes)t.addKeyframe(n.t,n.sound);return t}lerp(e,t,n){return{kind:n<1?e.kind:t.kind,volume:e.volume+(t.volume-e.volume)*n,pitchHz:e.pitchHz+(t.pitchHz-e.pitchHz)*n,src:n<1?e.src:t.src}}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=i}return t}}const Kg=100,$g={kind:"none",volume:0,pitchHz:Kg},Ja=[{id:"eye",name:{en:"Naked eye",fr:"Œil nu"},flare:0,projection:"equidistant",stabilization:.97},{id:"rectilinear-lens",name:{en:"Camera, unknown device",fr:"Appareil, modèle inconnu"},projection:"rectilinear",fNumber:8,fNumberRange:{min:2,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:8},apertureBlades:6},{id:"instamatic-126",name:{en:"Instamatic, 126 film",fr:"Instamatic, film 126"},projection:"rectilinear",frame:{widthMm:28,heightMm:28,focalLengthMm:43},fNumber:11,exposureSeconds:1/90,years:{from:1963,to:1988},apertureBlades:5,detailUm:20},{id:"slr-35mm-50",name:{en:"35 mm SLR, 50 mm lens",fr:"Reflex 35 mm, objectif 50 mm"},projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:50},fNumber:8,fNumberRange:{min:2,max:16},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},years:{from:1959},apertureBlades:6,detailUm:20},{id:"slr-35mm-zoom",name:{en:"35 mm SLR, 70-210 mm zoom",fr:"Reflex 35 mm, zoom 70-210 mm"},projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:135,focalRangeMm:{minMm:70,maxMm:210}},fNumber:8,fNumberRange:{min:4,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},apertureBlades:8,years:{from:1975},detailUm:20},{id:"phone-landscape",name:{en:"Phone, held sideways",fr:"Téléphone, tenu couché"},projection:"rectilinear",frame:{widthMm:7.6,heightMm:5.7,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4},{id:"phone-portrait",name:{en:"Phone, held upright",fr:"Téléphone, tenu debout"},projection:"rectilinear",frame:{widthMm:5.7,heightMm:7.6,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4}];class kt{static get default(){return Ja[0]}static byId(e){return Ja.find(t=>t.id===e)??this.default}static UNAIDED_FIELD_DEG=60;static UNAIDED_ASPECT=16/9;static fieldOfViewDeg(e){const t=e.frame;return t?2*Math.atan(t.heightMm/(2*t.focalLengthMm))*180/Math.PI:kt.UNAIDED_FIELD_DEG}static aspectOf(e){const t=e.frame;return t?t.widthMm/t.heightMm:kt.UNAIDED_ASPECT}static frameWidthPx(e,t){return Math.round(t*kt.aspectOf(e))}static availableAt(e){return e===void 0?Ja:Ja.filter(t=>!t.years||e>=t.years.from&&(t.years.to===void 0||e<=t.years.to))}static fieldOfViewDegAt(e,t){const n=e.frame;if(!(!n||t<=0))return 2*Math.atan(n.heightMm/(2*t))*180/Math.PI}static focalLengthMmFor(e,t){const n=e.frame;if(!(!n||t<=0||t>=180))return n.heightMm/(2*Math.tan(t*Math.PI/360))}static bladesShowing(e,t){const n=t??e.fNumber;if(n===void 0||e.apertureBlades===void 0)return 0;const i=e.fNumberRange;return!i||i.max<=i.min?1:Math.max(0,Math.min(1,(n-i.min)/(i.max-i.min)))}static LENS_FLARE_ARTIFACTS=1;static flareArtifactsOf(e){return e.flare??kt.LENS_FLARE_ARTIFACTS}static starPointsOf(e){const t=e.apertureBlades;return t===void 0||t<3?0:t%2===0?t:t*2}}class Bn{constructor(e){this.entries=e}static empty(){return new Bn(new Map)}get size(){return this.entries.size}at(e){return this.entries.get(e)}paths(){return[...this.entries.keys()]}set(e,t){t.basis==="stated"&&t.rationale===void 0?this.entries.delete(e):this.entries.set(e,t)}clear(e){for(const t of this.entries.keys())(t===e||t.startsWith(`${e}.`))&&this.entries.delete(t)}static strip(e){const t=new Bn(new Map);return{recording:Bn.stripValue(e,[],t),provenance:t}}static restore(e,t){if(t.size===0)return e;const n=structuredClone(e);for(const i of t.paths()){const r=t.at(i),a=i.split("."),o=Bn.holderOf(n,a);if(!o)continue;const l=a[a.length-1],c=o[l];c!==void 0&&(r.of!==void 0&&JSON.stringify(r.of)!==JSON.stringify(c)||(o[l]={value:c,...r.basis==="stated"?{}:{basis:r.basis},...r.rationale===void 0?{}:{rationale:r.rationale}}))}return n}static isWrapper(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&"value"in e}static stripValue(e,t,n){return Bn.isWrapper(e)?(n.set(t.join("."),{basis:e.basis??"stated",...e.rationale===void 0?{}:{rationale:e.rationale},of:e.value}),Bn.stripValue(e.value,t,n)):Array.isArray(e)?e.map((i,r)=>Bn.stripValue(i,[...t,String(r)],n)):typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e).map(([i,r])=>[i,Bn.stripValue(r,[...t,i],n)])):e}static holderOf(e,t){let n=e;for(const i of t.slice(0,-1)){if(typeof n!="object"||n===null)return;n=n[i]}return typeof n=="object"&&n!==null?n:void 0}}function Cd(s){if(s.raw!==void 0)return s.raw;if(s.year===void 0){if(s.hour===void 0)return"";let t=`${String(s.hour).padStart(2,"0")}:${String(s.minute??0).padStart(2,"0")}`;return s.second!==void 0&&(t+=`:${String(s.second).padStart(2,"0")}`),t}let e=String(s.year).padStart(4,"0");return s.month===void 0||(e+=`-${String(s.month).padStart(2,"0")}`,s.day===void 0)||(e+=`-${String(s.day).padStart(2,"0")}`,s.hour===void 0)||(e+=`T${String(s.hour).padStart(2,"0")}:${String(s.minute??0).padStart(2,"0")}`,s.second!==void 0&&(e+=`:${String(s.second).padStart(2,"0")}`)),e}function fh(s){if(s.year!==void 0)return Date.UTC(s.year,(s.month??1)-1,s.day??1,s.hour??0,s.minute??0,s.second??0)}function Dd(s){return(((s.day??0)*24+(s.hour??0))*60+(s.minute??0))*6e4+(s.second??0)*1e3}const Zg=["year","month","day","hour","minute"],Jg=["day","hour","minute"];function Pd(s,e){return e.filter(t=>s[t]!==void 0).join(",")}function zp(s){if(s.durationSeconds!==void 0)return s.durationSeconds*1e3;if(!s.time||!s.endTime)return;const e=s.time.year!==void 0&&s.endTime.year!==void 0,t=e?Zg:Jg,n=Pd(s.time,t);if(!(n===""||n!==Pd(s.endTime,t)))return e?fh(s.endTime)-fh(s.time):Dd(s.endTime)-Dd(s.time)}class kl{constructor(e,t,n,i,r,a,o,l,c=[],h,u,d,f=[],p=[]){this.event=e,this.timeline=t,this.witnessTrack=n,this.weatherTrack=i,this.soundTrack=r,this.witness=a,this.caseId=o,this.weather=l,this.decor=c,this.weatherSource=h,this.instrumentId=u,this.exposureSeconds=d,this.milestones=f,this.references=p}provenance=Bn.empty();testimony;get witnessCount(){return 1+this.decor.filter(e=>e.kind==="witness").length}get exposure(){return this.exposureSeconds??this.instrument.exposureSeconds}get instrument(){return kt.byId(this.instrumentId)}static create(e,t,n){return new kl({eventType:"sighting",time:e,place:t},new Fl,new Da,new Pa,new Ia,n)}}const jg=0,Qg=0;function Wt(s,e){const t=s.witnessTrack.getInterpolatedPoseAt(e);if(t)return t;const n=s.event.place?.[0];if(n)return{lat:n.lat,lng:n.lng,elevationM:jg,headingDeg:void 0,pitchDeg:Qg,fovDeg:kt.fieldOfViewDeg(s.instrument)}}function pa(s,e){return s.weatherTrack.getInterpolatedWeatherAt(e)??s.weather??kp}function Bp(s,e){return s.soundTrack.getInterpolatedSoundAt(e)??$g}const Id=2;function Hp(s){return s==="building"||s==="vehicle"}function Gp(s,e){const t=s.litKeyframes;if(!t||t.length===0)return s.lit??!1;let n=t[0];for(const i of t){if(i.t>e)break;n=i}return n.lit}function e1(s,e){return s.pattern.kind==="steady"?!0:Vp(s,e,e+1)>.5}function Vp(s,e,t){if(s.pattern.kind==="steady")return 1;const{perMinute:n,dutyCycle:i,phase:r=0}=s.pattern,a=Math.min(Math.max(i,0),1);if(a===0||n<=0)return 0;const o=6e4/n,l=e/o+r,c=t/o+r;if(c<=l)return Math.min(Math.max(l-Math.floor(l),0),a)<a?1:0;const h=u=>Math.floor(u)*a+Math.min(u-Math.floor(u),a);return(h(c)-h(l))/(c-l)}function zl(s,e){const t=s.track,n={eastM:s.eastM,northM:s.northM,altitudeM:0,headingDeg:s.headingDeg};if(!t||t.length===0)return n;if(t.length===1||e<=t[0].t)return Ld(t[0],s);const i=t[t.length-1];if(e>=i.t)return Ld(i,s);for(let r=0;r<t.length-1;r++){const a=t[r],o=t[r+1];if(e<a.t||e>o.t)continue;const l=o.t-a.t,c=l===0?0:(e-a.t)/l;return{eastM:a.eastM+(o.eastM-a.eastM)*c,northM:a.northM+(o.northM-a.northM)*c,altitudeM:(a.altitudeM??0)+((o.altitudeM??0)-(a.altitudeM??0))*c,headingDeg:a.headingDeg??s.headingDeg}}return n}function Ld(s,e){return{eastM:s.eastM,northM:s.northM,altitudeM:s.altitudeM??0,headingDeg:s.headingDeg??e.headingDeg}}const Nd="#ff2200",Od="#00ff44",Ss="#ffffff",ja="#ffa500",Qs="#ff0000",t1="#2244ff",n1=[{id:"airliner",name:"Airliner",kinds:["aircraft"],create:()=>[{id:"nav-port",offsetM:{x:-17,y:0,z:0},color:Nd,pattern:{kind:"steady"}},{id:"nav-starboard",offsetM:{x:17,y:0,z:0},color:Od,pattern:{kind:"steady"}},{id:"nav-tail",offsetM:{x:0,y:1,z:-18},color:Ss,pattern:{kind:"steady"}},{id:"beacon-top",offsetM:{x:0,y:2,z:0},color:Qs,intensity:1.5,pattern:{kind:"flash",perMinute:45,dutyCycle:.18}},{id:"beacon-bottom",offsetM:{x:0,y:-2,z:0},color:Qs,intensity:1.5,pattern:{kind:"flash",perMinute:45,dutyCycle:.18}},{id:"strobe-port",offsetM:{x:-17,y:0,z:-1},color:Ss,intensity:20,pattern:{kind:"flash",perMinute:60,dutyCycle:.01}},{id:"strobe-starboard",offsetM:{x:17,y:0,z:-1},color:Ss,intensity:20,pattern:{kind:"flash",perMinute:60,dutyCycle:.01,phase:.08}}]},{id:"helicopter",name:"Helicopter",kinds:["aircraft"],create:()=>[{id:"nav-port",offsetM:{x:-5,y:0,z:0},color:Nd,pattern:{kind:"steady"}},{id:"nav-starboard",offsetM:{x:5,y:0,z:0},color:Od,pattern:{kind:"steady"}},{id:"nav-tail",offsetM:{x:0,y:1,z:-7},color:Ss,pattern:{kind:"steady"}},{id:"beacon",offsetM:{x:0,y:2,z:-2},color:Qs,intensity:1.5,pattern:{kind:"flash",perMinute:45,dutyCycle:.2}},{id:"strobe",offsetM:{x:0,y:-1,z:0},color:Ss,intensity:15,pattern:{kind:"flash",perMinute:75,dutyCycle:.015}}]},{id:"car-headlights",name:"Car, headlights on",kinds:["vehicle"],create:()=>[{id:"head-left",offsetM:{x:-.7,y:.6,z:2},color:Ss,intensity:2,pattern:{kind:"steady"}},{id:"head-right",offsetM:{x:.7,y:.6,z:2},color:Ss,intensity:2,pattern:{kind:"steady"}},{id:"tail-left",offsetM:{x:-.7,y:.6,z:-2},color:Qs,pattern:{kind:"steady"}},{id:"tail-right",offsetM:{x:.7,y:.6,z:-2},color:Qs,pattern:{kind:"steady"}}]},{id:"car-hazards",name:"Car, hazard flashers",kinds:["vehicle"],create:()=>[{id:"hazard-front-left",offsetM:{x:-.8,y:.6,z:2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}},{id:"hazard-front-right",offsetM:{x:.8,y:.6,z:2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}},{id:"hazard-rear-left",offsetM:{x:-.8,y:.6,z:-2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}},{id:"hazard-rear-right",offsetM:{x:.8,y:.6,z:-2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}}]},{id:"emergency-beacons",name:"Emergency vehicle beacons",kinds:["vehicle"],create:()=>[{id:"beacon-blue",offsetM:{x:-.4,y:1.6,z:0},color:t1,intensity:2.5,pattern:{kind:"flash",perMinute:120,dutyCycle:.1}},{id:"beacon-red",offsetM:{x:.4,y:1.6,z:0},color:Qs,intensity:2.5,pattern:{kind:"flash",perMinute:120,dutyCycle:.1,phase:.5}}]},{id:"streetlamp",name:"Streetlamp",kinds:["streetlight"],create:()=>[{id:"lamp",offsetM:{x:0,y:5,z:0},color:"#ffd9a0",intensity:2,pattern:{kind:"steady"}}]}];class tl{constructor(e){this.names=e}name(e){return this.names[e.toLowerCase()]??e}stored(e){const t=e.trim().toLowerCase();for(const[n,i]of Object.entries(this.names))if(i.toLowerCase()===t)return n;return e.trim()}}class Ud{constructor(e,t,n,i=new tl({})){this.labels=e,this.language=t,this.said=n,this.tags=i}entriesFor(e,t,n={}){const i=[];return this.addObservation(i,e),this.addWitness(i,e,t),this.addLocation(i,e,t,n.groundElevationM),this.addDecor(i,e,t,n),this.addTemporal(i,e),this.addWeather(i,e,t),this.addSound(i,e,t),i}push(e,t,n,i,r,a="",o={}){r===void 0||r===""||e.push({group:t,field:n,label:i,value:String(r),unit:a,color:o.color,fromSource:o.fromSource===!0})}percent(e){return e===void 0?void 0:`${Math.round(e*100)} %`}rounded(e,t=0){return e===void 0?void 0:String(Number(e.toFixed(t)))}shows(e,t=0){return e!==void 0&&Number(e.toFixed(t))!==0}showsPercent(e){return this.shows(e===void 0?void 0:e*100)}percentShown(e){return this.showsPercent(e)?this.percent(e):void 0}roundedShown(e,t=0){return this.shows(e,t)?this.rounded(e,t):void 0}addObservation(e,t){this.push(e,"observation","caseId",this.labels.caseId,t.caseId);const n=t.event.tags;this.push(e,"observation","tags",this.labels.tags,n&&n.length>0?n.map(i=>this.tags.name(i)).join(", "):void 0)}addWitness(e,t,n){const i=t.witness;this.push(e,"witness","witnessId",this.labels.witnessId,i?.id),this.push(e,"witness","witnessTitle",this.labels.witnessTitle,i?.title),this.push(e,"witness","witnessLastName",this.labels.witnessLastName,i?.lastName);const r=i?.firstNames;this.push(e,"witness","witnessFirstNames",this.labels.witnessFirstNames,r&&r.length>0?r.join(", "):void 0);const a=t.instrument;this.push(e,"witness","instrument",this.labels.instrument,a.name[this.language]);const o=t.exposure;this.push(e,"witness","exposureSeconds",this.labels.exposure,o===void 0?void 0:o<1?`1/${Math.round(1/o)}`:this.rounded(o,2),"s");const l=Wt(t,n);if(l){const c=kt.focalLengthMmFor(a,l.fovDeg);c===void 0?this.push(e,"witness","focalLength",this.labels.fieldOfView,this.rounded(l.fovDeg,1),"°"):this.push(e,"witness","focalLength",this.labels.focalLength,this.rounded(c,1),"mm"),this.push(e,"witness","fNumber",this.labels.aperture,this.rounded(l.fNumber??a.fNumber,1)),this.push(e,"witness","focusDistance",this.labels.focusDistance,this.rounded(l.focusDistanceM,1),"m"),this.push(e,"witness","roll",this.labels.roll,this.roundedShown(l.rollDeg),"°")}}addLocation(e,t,n,i){const r=t.event.place?.[0];this.push(e,"location","placeName",this.labels.placeName,r?.name);const a=Wt(t,n);a&&(this.push(e,"location","lat",this.labels.latitude,this.rounded(a.lat,6)),this.push(e,"location","lng",this.labels.longitude,this.rounded(a.lng,6)),this.push(e,"location","heading",this.labels.heading,this.rounded(a.headingDeg),"°"),this.push(e,"location","pitch",this.labels.pitch,this.rounded(a.pitchDeg),"°"),i===void 0?this.push(e,"location","elevation",this.labels.heightAboveGround,this.roundedShown(a.elevationM),"m"):this.push(e,"location","elevation",this.labels.elevation,this.rounded(i+a.elevationM),"m"))}addDecor(e,t,n,i){const r=t.decor.find(c=>c.id===i.decorId);if(!r){if(i.decorPicker===!0)for(const c of t.decor)this.push(e,"decor",`decor:${c.id}`,this.decorLabel(c),this.decorKindName(c.kind));return}this.push(e,"decor","decorTitle",this.labels.decorTitle,this.said.read(r.title));const a=zl(r,n);this.push(e,"decor","decorEast",this.labels.decorEast,this.rounded(a.eastM,1),"m"),this.push(e,"decor","decorNorth",this.labels.decorNorth,this.rounded(a.northM,1),"m"),this.push(e,"decor","decorAltitude",this.labels.decorAltitude,this.roundedShown(a.altitudeM),"m"),this.push(e,"decor","decorHeading",this.labels.decorHeading,this.rounded(a.headingDeg),"°"),Gp(r,n)&&this.push(e,"decor","decorLit",this.labels.decorLit,"✓");const o=r.lights?.map(c=>c.id).join()??"",l=o===""?void 0:n1.find(c=>c.create().map(h=>h.id).join()===o);this.push(e,"decor","decorLightRig",this.labels.decorLights,l?.name),this.push(e,"decor","decorFloors",this.labels.decorFloors,r.floors),this.push(e,"decor","decorOccupiedFloor",this.labels.decorOccupiedFloor,r.occupiedFloor),this.push(e,"decor","decorWitnessSide",this.labels.decorWitnessSide,this.decorSideName(r.witnessSide));for(const[c,h]of Object.entries(r.windows??{}))this.push(e,"decor",`decorWindow${this.capitalise(c)}`,`${this.labels.decorWindows} ${this.decorSideName(c)}`,h,"%")}addTemporal(e,t){const n=t.event;this.push(e,"temporal","obs-time",this.labels.observationTime,n.time&&Cd(n.time)),this.push(e,"temporal","obs-end-time",this.labels.observationEndTime,n.endTime&&Cd(n.endTime));const i=zp(n);this.push(e,"temporal","durationSeconds",this.labels.duration,this.roundedShown(i&&i/1e3,1),"s"),this.push(e,"temporal","timeZone",this.labels.utcOffset,n.timeZone),this.push(e,"temporal","utcOffsetHours",this.labels.utcOffset,this.rounded(n.utcOffsetHours,1),"UTC±h")}addWeather(e,t,n){const i=pa(t,n),a={fromSource:t.weatherSource!==void 0},o=this.showsPercent(i.cloudCover)||this.showsPercent(i.lowerCloudCover)||this.showsPercent(i.highCloudCover);this.push(e,"weather","cloudCover",this.labels.cloudCover,this.percentShown(i.cloudCover),"",a),this.push(e,"weather","highCloudCover",this.labels.highCloudCover,this.percentShown(i.highCloudCover),"",a),this.push(e,"weather","iceCrystalAlignment",this.labels.iceCrystalAlignment,this.showsPercent(i.highCloudCover)?this.percent(i.iceCrystalAlignment):void 0),this.push(e,"weather","cloudDarkness",this.labels.cloudDarkness,o?this.percent(i.cloudDarkness):void 0,"",a),this.push(e,"weather","cloudBase",this.labels.cloudBase,o?this.rounded(i.cloudBaseM):void 0,"m",a);const l=i.precipitationType!=="none"&&this.showsPercent(i.precipitationIntensity);this.push(e,"weather","precipitationType",this.labels.precipitationType,l?this.precipitationName(i.precipitationType):void 0,"",a),this.push(e,"weather","precipitationIntensity",this.labels.precipitationIntensity,l?this.percent(i.precipitationIntensity):void 0,"",a),this.push(e,"weather","windDirection",this.labels.windDirection,this.shows(i.windSpeed,2)?this.rounded(i.windDirectionDeg):void 0,"°",a),this.push(e,"weather","windSpeed",this.labels.windSpeed,this.roundedShown(i.windSpeed,2),"m/s",a),i.storm&&this.push(e,"weather","storm",this.labels.storm,"✓","",a)}addSound(e,t,n){const i=Bp(t,n);i.kind!=="none"&&(this.push(e,"sound","soundKind",this.labels.soundKind,this.soundKindName(i.kind)),this.push(e,"sound","soundVolume",this.labels.soundVolume,this.percentShown(i.volume)),this.push(e,"sound","soundPitch",this.labels.soundPitch,this.roundedShown(i.pitchHz),"Hz"),this.push(e,"sound","soundSrc",this.labels.soundSrc,i.src))}decorLabel(e){return this.said.read(e.title)??this.decorKindName(e.kind)}decorKindName(e){switch(e){case"building":return this.labels.decorBuilding;case"tree":return this.labels.decorTree;case"crop":return this.labels.decorCrop;case"mound":return this.labels.decorMound;case"streetlight":return this.labels.decorStreetlight;case"vehicle":return this.labels.decorVehicle;case"aircraft":return this.labels.decorAircraft;default:return this.labels.decorWitness}}decorSideName(e){switch(e){case"front":return this.labels.decorSideFront;case"behind":return this.labels.decorSideBehind;case"left":return this.labels.decorSideLeft;case"right":return this.labels.decorSideRight;case"front-left":return this.labels.decorSideFrontLeft;case"front-right":return this.labels.decorSideFrontRight;case"behind-left":return this.labels.decorSideBehindLeft;case"behind-right":return this.labels.decorSideBehindRight;default:return}}precipitationName(e){switch(e){case"rain":return this.labels.precipitationRain;case"snow":return this.labels.precipitationSnow;case"hail":return this.labels.precipitationHail;default:return this.labels.precipitationNone}}soundKindName(e){switch(e){case"hum":return this.labels.soundHum;case"whistle":return this.labels.soundWhistle;case"rumble":return this.labels.soundRumble;case"crackle":return this.labels.soundCrackle;default:return this.labels.soundNone}}capitalise(e){return e.replace(/(^|-)([a-z])/g,(t,n,i)=>i.toUpperCase())}}const i1="modulepreload",s1=function(s,e){return new URL(s,e).href},Fd={},Xi=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");i=a(t.map(h=>{if(h=s1(h,n),h in Fd)return;Fd[h]=!0;const u=h.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!n)for(let v=o.length-1;v>=0;v--){const m=o[v];if(m.href===h&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":i1,u||(p.as="script"),p.crossOrigin="",p.href=h,c&&p.setAttribute("nonce",c),document.head.appendChild(p),u)return new Promise((v,m)=>{p.addEventListener("load",v),p.addEventListener("error",()=>m(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)})},r1=[{id:"coverage",name:"Coverage",credit:"UFO@home",creditUrl:"https://ufoathome.org",create:()=>({about:"witness",assess:async s=>{const{CoverageAssessor:e}=await Xi(async()=>{const{CoverageAssessor:t}=await import("./CoverageAssessor-mVlehblF.js");return{CoverageAssessor:t}},[],import.meta.url);return new e().assess(s)}})},{id:"hynek",name:"Hynek",credit:"J. Allen Hynek",creditUrl:"https://rr0.org/science/crypto/ufo/enquete/methode/",create:()=>({about:"temporal",assess:async s=>{const{HynekAssessor:e}=await Xi(async()=>{const{HynekAssessor:t}=await import("./HynekAssessor-BiP2di32.js");return{HynekAssessor:t}},[],import.meta.url);return new e().assess(s)}})}];class a1{constructor(e){this.labels=e}async read(e){const t=[],n=new Set;for(const i of r1){let r;try{r=await i.create().assess(e)}catch{continue}for(const o of r.criteria)o.basis===void 0&&!o.unsupported&&n.add(o.id);const a=r.score===void 0?r.verdict===void 0?"":this.verdictName(i.id,r.verdict):`${Math.round(r.score*100)}%`;a!==""&&t.push({group:"assessment",field:i.id,label:this.labels.assessmentNames[i.id]??i.name,value:a,unit:"",fromSource:!1,about:i.create().about})}return{entries:t,unanswered:n}}verdictName(e,t){return this.labels.assessmentVerdicts[`${e}.${t}`]??t.toUpperCase()}}const Wp=Math.PI/180,ml=111320;function tn(s,e,t,n){const i=ml*Math.cos(t*Wp),r=(s-t)*ml;return{x:(e-n)*i,z:-r}}function zi(s,e,t,n){const i=ml*Math.cos(t*Wp),r=-e,a=s;return{lat:t+r/ml,lng:n+a/i}}function kd(s,e,t,n,i,r){const a=n?.lat!==void 0&&n.lng!==void 0&&i?.lat!==void 0&&i.lng!==void 0?tn(i.lat,i.lng,n.lat,n.lng):{x:0,z:0},o=Math.max(0,s),l=[0,...e.allKeyframes.map(c=>c.t).filter(c=>c>0&&c<o),o];for(let c=1;c<l.length;c++){const h=l[c-1],u=l[c]-h;if(u===0)continue;const d=32;for(let f=0;f<=d;f++){const p=e.getInterpolatedWeatherAt(h+u*f/d)??t,v=r===void 0?void 0:p.cloudLayers?.find(w=>w.id===r),m=(v?.windDirectionDeg??p.windDirectionDeg)*Math.PI/180,g=f===0||f===d?1:f%2===0?2:4,S=(v?.windSpeed??p.windSpeed)*u/1e3/d/3*g;a.x-=Math.sin(m)*S,a.z+=Math.cos(m)*S}}return a}const o1=`
|
|
379
|
+
`;class Js extends Error{constructor(e,t,n){super(`${e}: ${t}${n===void 0?"":` (HTTP ${n})`}`),this.kind=e,this.url=t,this.status=n,this.name="SightingFetchError"}}class fl{static async json(e){const t=new URL(e,location.href);if(location.protocol==="https:"&&t.protocol==="http:")throw new Js("mixed-content",e);let n;try{n=await fetch(e)}catch{throw await this.diagnose(e,t)}if(!n.ok)throw new Js("status",e,n.status);try{return await n.json()}catch{throw new Js("malformed",e)}}static async diagnose(e,t){if(t.origin===location.origin)return new Js("unreachable",e);try{return await fetch(e,{mode:"no-cors"}),new Js("cors",e)}catch{return new Js("unreachable",e)}}}class mt{static MOON_ANGULAR_WIDTH_DEG=.5237;static CANVAS_WIDTH_PX=640;static CANVAS_HEIGHT_PX=360;static angularWidthDeg(e){return 2*Math.atan(e.sizeM/(2*e.distanceM))*180/Math.PI}static inMoons(e){return e/mt.MOON_ANGULAR_WIDTH_DEG}static lerpAngular(e,t,n){if(!(!e||!t))return{widthDeg:e.widthDeg+(t.widthDeg-e.widthDeg)*n,heightDeg:e.heightDeg+(t.heightDeg-e.heightDeg)*n}}static sizeMAt(e,t){return 2*e*Math.tan(t*Math.PI/360)}static distanceMAt(e,t){return e/(2*Math.tan(t*Math.PI/360))}}function Og(s,e,t){if(!s||!e)return t<1?s:e;const n=((e.azimuthDeg-s.azimuthDeg)%360+540)%360-180;return{azimuthDeg:((s.azimuthDeg+n*t)%360+360)%360,altitudeDeg:s.altitudeDeg+(e.altitudeDeg-s.altitudeDeg)*t}}function Ug(s,e,t){const{bounds:n}=s;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function bn(s,e,t){return s+(e-s)*t}function Rd(s){const e=/^#([0-9a-f]{6})$/i.exec(s);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function Fg(s){return`#${s.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function kg(s,e,t){const n=Rd(s),i=Rd(e);return!n||!i?t<1?s:e:Fg([bn(n[0],i[0],t),bn(n[1],i[1],t),bn(n[2],i[2],t)])}function zg(s,e,t){const n={x:bn(s.bounds.x,e.bounds.x,t),y:bn(s.bounds.y,e.bounds.y,t),width:bn(s.bounds.width,e.bounds.width,t),height:bn(s.bounds.height,e.bounds.height,t)},i=bn(s.angle,e.angle,t),r=bn(s.transparency,e.transparency,t),a=bn(s.haloScale,e.haloScale,t),o=bn(s.blur??0,e.blur??0,t),l=bn(s.brightness??0,e.brightness??0,t),c=kg(s.color,e.color,t),h=mt.lerpAngular(s.angular,e.angular,t),u=Og(s.aim,e.aim,t);return s.kind==="polygon"&&e.kind==="polygon"&&s.points.length===e.points.length?{...s,bounds:n,angle:i,transparency:r,haloScale:a,blur:o,brightness:l,color:c,angular:h,aim:u,points:s.points.map((d,f)=>({x:bn(d.x,e.points[f].x,t),y:bn(d.y,e.points[f].y,t)}))}:{...t<1?s:e,bounds:n,angle:i,transparency:r,haloScale:a,blur:o,brightness:l,color:c,angular:h,aim:u}}class Fl{keyframes=[];order=[];groups=[];addKeyframe(e,t){const n=this.findInsertIndex(e);if(this.keyframes[n]?.t===e){const i=new Set(t.map(r=>r.sourceId));this.keyframes[n]={t:e,shapes:[...this.keyframes[n].shapes.filter(r=>!i.has(r.sourceId)),...t]}}else this.keyframes.splice(n,0,{t:e,shapes:[...t]});for(const i of t)this.order.includes(i.sourceId)||this.order.push(i.sourceId)}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=i}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 i=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(i)return i.shape}}getInterpolatedShapeAt(e,t){const n=this.findShapeAtOrBefore(e,t);if(n?.t===e)return n.shape;const i=this.findShapeAtOrAfter(e,t);return n?i?zg(n.shape,i.shape,(e-n.t)/(i.t-n.t)):n.shape:i?.shape}findShapeAtOrBefore(e,t){let n=this.findInsertIndex(e);for(this.keyframes[n]?.t!==e&&(n-=1);n>=0;n--){const i=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[n].t,shape:i.shape}}}findShapeAtOrAfter(e,t){for(let n=this.findInsertIndex(e);n<this.keyframes.length;n++){const i=this.keyframes[n].shapes.find(r=>r.sourceId===t);if(i)return{t:this.keyframes[n].t,shape:i.shape}}}hitTest(e,t,n,i){const r=this.sourceIds;for(let a=r.length-1;a>=0;a--){if(i?.has(r[a]))continue;const o=this.getInterpolatedShapeAt(e,r[a]);if(o&&Ug(o,t,n))return{sourceId:r[a],shape:o}}}removeSource(e){for(let t=this.keyframes.length-1;t>=0;t--){const n=this.keyframes[t].shapes.filter(i=>i.sourceId!==e);n.length===0?this.keyframes.splice(t,1):n.length!==this.keyframes[t].shapes.length&&(this.keyframes[t]={t:this.keyframes[t].t,shapes:n})}this.order=this.order.filter(t=>t!==e),this.removeFromGroup(e)}group(e){if(!(e.length<2)){for(const t of e)this.removeFromGroup(t);this.groups.push([...e])}}ungroup(e){const t=this.groups.findIndex(n=>n.includes(e));t!==-1&&this.groups.splice(t,1)}groupMembers(e){return this.groups.find(t=>t.includes(e))}removeFromGroup(e){const t=this.groups.findIndex(i=>i.includes(e));if(t===-1)return;const n=this.groups[t].filter(i=>i!==e);n.length<2?this.groups.splice(t,1):this.groups[t]=n}bringToFront(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.push(e))}sendToBack(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.unshift(e))}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get sourceIds(){return[...this.order]}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes,order:this.order,groups:this.groups}}static fromJSON(e){const t=new Fl;for(const n of e.keyframes)t.addKeyframe(n.t,n.shapes);if(e.order){const n=t.order.filter(i=>!e.order.includes(i));t.order=[...e.order,...n]}return e.groups&&(t.groups=e.groups.map(n=>n.filter(i=>t.order.includes(i))).filter(n=>n.length>=2)),t}}function Bg(s,e,t){return Math.max(e,Math.min(t,s))}function Hg(s,e,t){const n=((e-s)%360+540)%360-180;return((s+n*t)%360+360)%360}function js(s,e,t){return s+(e-s)*t}function Gg(s,e,t){return{lat:s.lat===void 0||e.lat===void 0?void 0:js(s.lat,e.lat,t),lng:s.lng===void 0||e.lng===void 0?void 0:js(s.lng,e.lng,t),elevationM:js(s.elevationM,e.elevationM,t),headingDeg:s.headingDeg===void 0||e.headingDeg===void 0?void 0:Hg(s.headingDeg,e.headingDeg,t),pitchDeg:js(s.pitchDeg,e.pitchDeg,t),rollDeg:js(s.rollDeg??0,e.rollDeg??0,t),fovDeg:js(s.fovDeg,e.fovDeg,t),fNumber:s.fNumber,focusDistanceM:s.focusDistanceM}}class Da{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}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=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),n=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(n?.t===e)return n.pose;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?i?Gg(n.pose,i.pose,Bg((e-n.t)/(i.t-n.t),0,1)):n.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 Da;for(const n of e.keyframes)t.addKeyframe(n.t,n.pose);return t}}const Bu=1e3,Vg=.65,kp={cloudCover:0,cloudDarkness:0,precipitationType:"none",precipitationIntensity:0,windDirectionDeg:0,windSpeed:0,storm:!1};function pl(s){if(s.cloudLayers!==void 0)return s.cloudLayers;const e=[],t=s.lowerCloudCover??s.cloudCover;return t>0&&e.push({id:"lower",type:"cumulus",baseM:s.cloudBaseM??Bu,thicknessM:650,coverage:t,sizeM:1400,density:1,darkness:s.cloudDarkness}),(s.highCloudCover??0)>0&&e.push({id:"cirrus",type:"cirrus",baseM:8e3,thicknessM:400,coverage:s.highCloudCover,sizeM:2200,density:.35,darkness:s.cloudDarkness,iceCrystalAlignment:s.iceCrystalAlignment}),e}function bt(s,e,t){return s+(e-s)*t}function Hu(s,e,t){const n=((e-s)%360+540)%360-180;return((s+n*t)%360+360)%360}function Wg(s,e,t){return Math.max(e,Math.min(t,s))}function Xg(s=[],e=[],t){if(!(!s.length&&!e.length))return[...new Set([...s.map(n=>n.id),...e.map(n=>n.id)])].map(n=>{const i=s.find(l=>l.id===n),r=e.find(l=>l.id===n),a=i??{...r,density:0},o=r??{...i,density:0};return{...a,eastM:bt(a.eastM,o.eastM,t),northM:bt(a.northM,o.northM,t),baseM:bt(a.baseM,o.baseM,t),thicknessM:bt(a.thicknessM,o.thicknessM,t),widthM:bt(a.widthM,o.widthM,t),depthM:bt(a.depthM,o.depthM,t),rotationDeg:Hu(a.rotationDeg,o.rotationDeg,t),density:bt(a.density,o.density,t),darkness:bt(a.darkness??0,o.darkness??0,t)}})}function qg(s,e,t){if(s.cloudLayers===void 0&&e.cloudLayers===void 0)return;const n=pl(s),i=pl(e);return t>=1?i.map(a=>({...a})):[...new Set([...n.map(a=>a.id),...i.map(a=>a.id)])].map(a=>{const o=n.find(u=>u.id===a),l=i.find(u=>u.id===a),c=o??{...l,coverage:0},h=l??{...o,coverage:0};return{...c,instances:Xg(o?.instances,l?.instances,t),baseM:bt(c.baseM,h.baseM,t),thicknessM:bt(c.thicknessM,h.thicknessM,t),coverage:bt(c.coverage,h.coverage,t),sizeM:bt(c.sizeM,h.sizeM,t),density:bt(c.density,h.density,t),darkness:bt(c.darkness??s.cloudDarkness,h.darkness??e.cloudDarkness,t),iceCrystalAlignment:c.iceCrystalAlignment===void 0||h.iceCrystalAlignment===void 0?void 0:bt(c.iceCrystalAlignment,h.iceCrystalAlignment,t),windSpeed:c.windSpeed===void 0&&h.windSpeed===void 0?void 0:bt(c.windSpeed??s.windSpeed,h.windSpeed??e.windSpeed,t),windDirectionDeg:c.windDirectionDeg===void 0&&h.windDirectionDeg===void 0?void 0:Hu(c.windDirectionDeg??s.windDirectionDeg,h.windDirectionDeg??e.windDirectionDeg,t)}})}function Yg(s,e,t){return{cloudLayers:qg(s,e,t),cloudCover:bt(s.cloudCover,e.cloudCover,t),cloudDarkness:bt(s.cloudDarkness,e.cloudDarkness,t),highCloudCover:s.highCloudCover===void 0||e.highCloudCover===void 0?void 0:bt(s.highCloudCover,e.highCloudCover,t),iceCrystalAlignment:s.iceCrystalAlignment===void 0||e.iceCrystalAlignment===void 0?void 0:bt(s.iceCrystalAlignment,e.iceCrystalAlignment,t),lowerCloudCover:s.lowerCloudCover===void 0||e.lowerCloudCover===void 0?void 0:bt(s.lowerCloudCover,e.lowerCloudCover,t),cloudBaseM:s.cloudBaseM===void 0||e.cloudBaseM===void 0?void 0:bt(s.cloudBaseM,e.cloudBaseM,t),precipitationType:t<1?s.precipitationType:e.precipitationType,precipitationIntensity:bt(s.precipitationIntensity,e.precipitationIntensity,t),windDirectionDeg:Hu(s.windDirectionDeg,e.windDirectionDeg,t),windSpeed:bt(s.windSpeed,e.windSpeed,t),storm:t<1?s.storm:e.storm}}class Pa{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,weather:t}:this.keyframes.splice(n,0,{t:e,weather:t})}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=i}return t}getLatestWeatherAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].weather:void 0}getInterpolatedWeatherAt(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.weather;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return n?i?Yg(n.weather,i.weather,Wg((e-n.t)/(i.t-n.t),0,1)):n.weather:i?.weather}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 Pa;for(const n of e.keyframes)t.addKeyframe(n.t,n.weather);return t}}class Ia{keyframes=[];addKeyframe(e,t){const n=this.findInsertIndex(e);this.keyframes[n]?.t===e?this.keyframes[n]={t:e,sound:t}:this.keyframes.splice(n,0,{t:e,sound:t})}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}getLatestSoundAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].sound:void 0}getInterpolatedSoundAt(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.sound;const i=this.keyframes[t]?.t===e?void 0:this.keyframes[t];if(!n)return i?.sound;if(!i)return n.sound;const r=(e-n.t)/(i.t-n.t);return this.lerp(n.sound,i.sound,Math.max(0,Math.min(1,r)))}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 Ia;for(const n of e.keyframes)t.addKeyframe(n.t,n.sound);return t}lerp(e,t,n){return{kind:n<1?e.kind:t.kind,volume:e.volume+(t.volume-e.volume)*n,pitchHz:e.pitchHz+(t.pitchHz-e.pitchHz)*n,src:n<1?e.src:t.src}}findInsertIndex(e){let t=0,n=this.keyframes.length;for(;t<n;){const i=t+n>>>1;this.keyframes[i].t<e?t=i+1:n=i}return t}}const Kg=100,$g={kind:"none",volume:0,pitchHz:Kg},Ja=[{id:"eye",name:{en:"Naked eye",fr:"Œil nu"},flare:0,projection:"equidistant",stabilization:.97},{id:"rectilinear-lens",name:{en:"Camera, unknown device",fr:"Appareil, modèle inconnu"},projection:"rectilinear",fNumber:8,fNumberRange:{min:2,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:8},apertureBlades:6},{id:"instamatic-126",name:{en:"Instamatic, 126 film",fr:"Instamatic, film 126"},projection:"rectilinear",frame:{widthMm:28,heightMm:28,focalLengthMm:43},fNumber:11,exposureSeconds:1/90,years:{from:1963,to:1988},apertureBlades:5,detailUm:20},{id:"slr-35mm-50",name:{en:"35 mm SLR, 50 mm lens",fr:"Reflex 35 mm, objectif 50 mm"},projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:50},fNumber:8,fNumberRange:{min:2,max:16},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},years:{from:1959},apertureBlades:6,detailUm:20},{id:"slr-35mm-zoom",name:{en:"35 mm SLR, 70-210 mm zoom",fr:"Reflex 35 mm, zoom 70-210 mm"},projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:135,focalRangeMm:{minMm:70,maxMm:210}},fNumber:8,fNumberRange:{min:4,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},apertureBlades:8,years:{from:1975},detailUm:20},{id:"phone-landscape",name:{en:"Phone, held sideways",fr:"Téléphone, tenu couché"},projection:"rectilinear",frame:{widthMm:7.6,heightMm:5.7,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4},{id:"phone-portrait",name:{en:"Phone, held upright",fr:"Téléphone, tenu debout"},projection:"rectilinear",frame:{widthMm:5.7,heightMm:7.6,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4}];class kt{static get default(){return Ja[0]}static byId(e){return Ja.find(t=>t.id===e)??this.default}static UNAIDED_FIELD_DEG=60;static UNAIDED_ASPECT=16/9;static fieldOfViewDeg(e){const t=e.frame;return t?2*Math.atan(t.heightMm/(2*t.focalLengthMm))*180/Math.PI:kt.UNAIDED_FIELD_DEG}static aspectOf(e){const t=e.frame;return t?t.widthMm/t.heightMm:kt.UNAIDED_ASPECT}static frameWidthPx(e,t){return Math.round(t*kt.aspectOf(e))}static availableAt(e){return e===void 0?Ja:Ja.filter(t=>!t.years||e>=t.years.from&&(t.years.to===void 0||e<=t.years.to))}static fieldOfViewDegAt(e,t){const n=e.frame;if(!(!n||t<=0))return 2*Math.atan(n.heightMm/(2*t))*180/Math.PI}static focalLengthMmFor(e,t){const n=e.frame;if(!(!n||t<=0||t>=180))return n.heightMm/(2*Math.tan(t*Math.PI/360))}static bladesShowing(e,t){const n=t??e.fNumber;if(n===void 0||e.apertureBlades===void 0)return 0;const i=e.fNumberRange;return!i||i.max<=i.min?1:Math.max(0,Math.min(1,(n-i.min)/(i.max-i.min)))}static LENS_FLARE_ARTIFACTS=1;static flareArtifactsOf(e){return e.flare??kt.LENS_FLARE_ARTIFACTS}static starPointsOf(e){const t=e.apertureBlades;return t===void 0||t<3?0:t%2===0?t:t*2}}class Bn{constructor(e){this.entries=e}static empty(){return new Bn(new Map)}get size(){return this.entries.size}at(e){return this.entries.get(e)}paths(){return[...this.entries.keys()]}set(e,t){t.basis==="stated"&&t.rationale===void 0?this.entries.delete(e):this.entries.set(e,t)}clear(e){for(const t of this.entries.keys())(t===e||t.startsWith(`${e}.`))&&this.entries.delete(t)}static strip(e){const t=new Bn(new Map);return{recording:Bn.stripValue(e,[],t),provenance:t}}static restore(e,t){if(t.size===0)return e;const n=structuredClone(e);for(const i of t.paths()){const r=t.at(i),a=i.split("."),o=Bn.holderOf(n,a);if(!o)continue;const l=a[a.length-1],c=o[l];c!==void 0&&(r.of!==void 0&&JSON.stringify(r.of)!==JSON.stringify(c)||(o[l]={value:c,...r.basis==="stated"?{}:{basis:r.basis},...r.rationale===void 0?{}:{rationale:r.rationale}}))}return n}static isWrapper(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&"value"in e}static stripValue(e,t,n){return Bn.isWrapper(e)?(n.set(t.join("."),{basis:e.basis??"stated",...e.rationale===void 0?{}:{rationale:e.rationale},of:e.value}),Bn.stripValue(e.value,t,n)):Array.isArray(e)?e.map((i,r)=>Bn.stripValue(i,[...t,String(r)],n)):typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e).map(([i,r])=>[i,Bn.stripValue(r,[...t,i],n)])):e}static holderOf(e,t){let n=e;for(const i of t.slice(0,-1)){if(typeof n!="object"||n===null)return;n=n[i]}return typeof n=="object"&&n!==null?n:void 0}}function Cd(s){if(s.raw!==void 0)return s.raw;if(s.year===void 0){if(s.hour===void 0)return"";let t=`${String(s.hour).padStart(2,"0")}:${String(s.minute??0).padStart(2,"0")}`;return s.second!==void 0&&(t+=`:${String(s.second).padStart(2,"0")}`),t}let e=String(s.year).padStart(4,"0");return s.month===void 0||(e+=`-${String(s.month).padStart(2,"0")}`,s.day===void 0)||(e+=`-${String(s.day).padStart(2,"0")}`,s.hour===void 0)||(e+=`T${String(s.hour).padStart(2,"0")}:${String(s.minute??0).padStart(2,"0")}`,s.second!==void 0&&(e+=`:${String(s.second).padStart(2,"0")}`)),e}function fh(s){if(s.year!==void 0)return Date.UTC(s.year,(s.month??1)-1,s.day??1,s.hour??0,s.minute??0,s.second??0)}function Dd(s){return(((s.day??0)*24+(s.hour??0))*60+(s.minute??0))*6e4+(s.second??0)*1e3}const Zg=["year","month","day","hour","minute"],Jg=["day","hour","minute"];function Pd(s,e){return e.filter(t=>s[t]!==void 0).join(",")}function zp(s){if(s.durationSeconds!==void 0)return s.durationSeconds*1e3;if(!s.time||!s.endTime)return;const e=s.time.year!==void 0&&s.endTime.year!==void 0,t=e?Zg:Jg,n=Pd(s.time,t);if(!(n===""||n!==Pd(s.endTime,t)))return e?fh(s.endTime)-fh(s.time):Dd(s.endTime)-Dd(s.time)}class kl{constructor(e,t,n,i,r,a,o,l,c=[],h,u,d,f=[],p=[]){this.event=e,this.timeline=t,this.witnessTrack=n,this.weatherTrack=i,this.soundTrack=r,this.witness=a,this.caseId=o,this.weather=l,this.decor=c,this.weatherSource=h,this.instrumentId=u,this.exposureSeconds=d,this.milestones=f,this.references=p}provenance=Bn.empty();testimony;get witnessCount(){return 1+this.decor.filter(e=>e.kind==="witness").length}get exposure(){return this.exposureSeconds??this.instrument.exposureSeconds}get instrument(){return kt.byId(this.instrumentId)}static create(e,t,n){return new kl({eventType:"sighting",time:e,place:t},new Fl,new Da,new Pa,new Ia,n)}}const jg=0,Qg=0;function Wt(s,e){const t=s.witnessTrack.getInterpolatedPoseAt(e);if(t)return t;const n=s.event.place?.[0];if(n)return{lat:n.lat,lng:n.lng,elevationM:jg,headingDeg:void 0,pitchDeg:Qg,fovDeg:kt.fieldOfViewDeg(s.instrument)}}function pa(s,e){return s.weatherTrack.getInterpolatedWeatherAt(e)??s.weather??kp}function Bp(s,e){return s.soundTrack.getInterpolatedSoundAt(e)??$g}const Id=2;function Hp(s){return s==="building"||s==="vehicle"}function Gp(s,e){const t=s.litKeyframes;if(!t||t.length===0)return s.lit??!1;let n=t[0];for(const i of t){if(i.t>e)break;n=i}return n.lit}function e1(s,e){return s.pattern.kind==="steady"?!0:Vp(s,e,e+1)>.5}function Vp(s,e,t){if(s.pattern.kind==="steady")return 1;const{perMinute:n,dutyCycle:i,phase:r=0}=s.pattern,a=Math.min(Math.max(i,0),1);if(a===0||n<=0)return 0;const o=6e4/n,l=e/o+r,c=t/o+r;if(c<=l)return Math.min(Math.max(l-Math.floor(l),0),a)<a?1:0;const h=u=>Math.floor(u)*a+Math.min(u-Math.floor(u),a);return(h(c)-h(l))/(c-l)}function zl(s,e){const t=s.track,n={eastM:s.eastM,northM:s.northM,altitudeM:0,headingDeg:s.headingDeg};if(!t||t.length===0)return n;if(t.length===1||e<=t[0].t)return Ld(t[0],s);const i=t[t.length-1];if(e>=i.t)return Ld(i,s);for(let r=0;r<t.length-1;r++){const a=t[r],o=t[r+1];if(e<a.t||e>o.t)continue;const l=o.t-a.t,c=l===0?0:(e-a.t)/l;return{eastM:a.eastM+(o.eastM-a.eastM)*c,northM:a.northM+(o.northM-a.northM)*c,altitudeM:(a.altitudeM??0)+((o.altitudeM??0)-(a.altitudeM??0))*c,headingDeg:a.headingDeg??s.headingDeg}}return n}function Ld(s,e){return{eastM:s.eastM,northM:s.northM,altitudeM:s.altitudeM??0,headingDeg:s.headingDeg??e.headingDeg}}const Nd="#ff2200",Od="#00ff44",Ss="#ffffff",ja="#ffa500",Qs="#ff0000",t1="#2244ff",n1=[{id:"airliner",name:"Airliner",kinds:["aircraft"],create:()=>[{id:"nav-port",offsetM:{x:-17,y:0,z:0},color:Nd,pattern:{kind:"steady"}},{id:"nav-starboard",offsetM:{x:17,y:0,z:0},color:Od,pattern:{kind:"steady"}},{id:"nav-tail",offsetM:{x:0,y:1,z:-18},color:Ss,pattern:{kind:"steady"}},{id:"beacon-top",offsetM:{x:0,y:2,z:0},color:Qs,intensity:1.5,pattern:{kind:"flash",perMinute:45,dutyCycle:.18}},{id:"beacon-bottom",offsetM:{x:0,y:-2,z:0},color:Qs,intensity:1.5,pattern:{kind:"flash",perMinute:45,dutyCycle:.18}},{id:"strobe-port",offsetM:{x:-17,y:0,z:-1},color:Ss,intensity:20,pattern:{kind:"flash",perMinute:60,dutyCycle:.01}},{id:"strobe-starboard",offsetM:{x:17,y:0,z:-1},color:Ss,intensity:20,pattern:{kind:"flash",perMinute:60,dutyCycle:.01,phase:.08}}]},{id:"helicopter",name:"Helicopter",kinds:["aircraft"],create:()=>[{id:"nav-port",offsetM:{x:-5,y:0,z:0},color:Nd,pattern:{kind:"steady"}},{id:"nav-starboard",offsetM:{x:5,y:0,z:0},color:Od,pattern:{kind:"steady"}},{id:"nav-tail",offsetM:{x:0,y:1,z:-7},color:Ss,pattern:{kind:"steady"}},{id:"beacon",offsetM:{x:0,y:2,z:-2},color:Qs,intensity:1.5,pattern:{kind:"flash",perMinute:45,dutyCycle:.2}},{id:"strobe",offsetM:{x:0,y:-1,z:0},color:Ss,intensity:15,pattern:{kind:"flash",perMinute:75,dutyCycle:.015}}]},{id:"car-headlights",name:"Car, headlights on",kinds:["vehicle"],create:()=>[{id:"head-left",offsetM:{x:-.7,y:.6,z:2},color:Ss,intensity:2,pattern:{kind:"steady"}},{id:"head-right",offsetM:{x:.7,y:.6,z:2},color:Ss,intensity:2,pattern:{kind:"steady"}},{id:"tail-left",offsetM:{x:-.7,y:.6,z:-2},color:Qs,pattern:{kind:"steady"}},{id:"tail-right",offsetM:{x:.7,y:.6,z:-2},color:Qs,pattern:{kind:"steady"}}]},{id:"car-hazards",name:"Car, hazard flashers",kinds:["vehicle"],create:()=>[{id:"hazard-front-left",offsetM:{x:-.8,y:.6,z:2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}},{id:"hazard-front-right",offsetM:{x:.8,y:.6,z:2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}},{id:"hazard-rear-left",offsetM:{x:-.8,y:.6,z:-2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}},{id:"hazard-rear-right",offsetM:{x:.8,y:.6,z:-2},color:ja,pattern:{kind:"flash",perMinute:90,dutyCycle:.5}}]},{id:"emergency-beacons",name:"Emergency vehicle beacons",kinds:["vehicle"],create:()=>[{id:"beacon-blue",offsetM:{x:-.4,y:1.6,z:0},color:t1,intensity:2.5,pattern:{kind:"flash",perMinute:120,dutyCycle:.1}},{id:"beacon-red",offsetM:{x:.4,y:1.6,z:0},color:Qs,intensity:2.5,pattern:{kind:"flash",perMinute:120,dutyCycle:.1,phase:.5}}]},{id:"streetlamp",name:"Streetlamp",kinds:["streetlight"],create:()=>[{id:"lamp",offsetM:{x:0,y:5,z:0},color:"#ffd9a0",intensity:2,pattern:{kind:"steady"}}]}];class tl{constructor(e){this.names=e}name(e){return this.names[e.toLowerCase()]??e}stored(e){const t=e.trim().toLowerCase();for(const[n,i]of Object.entries(this.names))if(i.toLowerCase()===t)return n;return e.trim()}}class Ud{constructor(e,t,n,i=new tl({})){this.labels=e,this.language=t,this.said=n,this.tags=i}entriesFor(e,t,n={}){const i=[];return this.addObservation(i,e),this.addWitness(i,e,t),this.addLocation(i,e,t,n.groundElevationM),this.addDecor(i,e,t,n),this.addTemporal(i,e),this.addWeather(i,e,t),this.addSound(i,e,t),i}push(e,t,n,i,r,a="",o={}){r===void 0||r===""||e.push({group:t,field:n,label:i,value:String(r),unit:a,color:o.color,fromSource:o.fromSource===!0})}percent(e){return e===void 0?void 0:`${Math.round(e*100)} %`}rounded(e,t=0){return e===void 0?void 0:String(Number(e.toFixed(t)))}shows(e,t=0){return e!==void 0&&Number(e.toFixed(t))!==0}showsPercent(e){return this.shows(e===void 0?void 0:e*100)}percentShown(e){return this.showsPercent(e)?this.percent(e):void 0}roundedShown(e,t=0){return this.shows(e,t)?this.rounded(e,t):void 0}addObservation(e,t){this.push(e,"observation","caseId",this.labels.caseId,t.caseId);const n=t.event.tags;this.push(e,"observation","tags",this.labels.tags,n&&n.length>0?n.map(i=>this.tags.name(i)).join(", "):void 0)}addWitness(e,t,n){const i=t.witness;this.push(e,"witness","witnessId",this.labels.witnessId,i?.id),this.push(e,"witness","witnessTitle",this.labels.witnessTitle,i?.title),this.push(e,"witness","witnessLastName",this.labels.witnessLastName,i?.lastName);const r=i?.firstNames;this.push(e,"witness","witnessFirstNames",this.labels.witnessFirstNames,r&&r.length>0?r.join(", "):void 0);const a=t.instrument;this.push(e,"witness","instrument",this.labels.instrument,a.name[this.language]);const o=t.exposure;this.push(e,"witness","exposureSeconds",this.labels.exposure,o===void 0?void 0:o<1?`1/${Math.round(1/o)}`:this.rounded(o,2),"s");const l=Wt(t,n);if(l){const c=kt.focalLengthMmFor(a,l.fovDeg);c===void 0?this.push(e,"witness","focalLength",this.labels.fieldOfView,this.rounded(l.fovDeg,1),"°"):this.push(e,"witness","focalLength",this.labels.focalLength,this.rounded(c,1),"mm"),this.push(e,"witness","fNumber",this.labels.aperture,this.rounded(l.fNumber??a.fNumber,1)),this.push(e,"witness","focusDistance",this.labels.focusDistance,this.rounded(l.focusDistanceM,1),"m"),this.push(e,"witness","roll",this.labels.roll,this.roundedShown(l.rollDeg),"°")}}addLocation(e,t,n,i){const r=t.event.place?.[0];this.push(e,"location","placeName",this.labels.placeName,r?.name);const a=Wt(t,n);a&&(this.push(e,"location","lat",this.labels.latitude,this.rounded(a.lat,6)),this.push(e,"location","lng",this.labels.longitude,this.rounded(a.lng,6)),this.push(e,"location","heading",this.labels.heading,this.rounded(a.headingDeg),"°"),this.push(e,"location","pitch",this.labels.pitch,this.rounded(a.pitchDeg),"°"),i===void 0?this.push(e,"location","elevation",this.labels.heightAboveGround,this.roundedShown(a.elevationM),"m"):this.push(e,"location","elevation",this.labels.elevation,this.rounded(i+a.elevationM),"m"))}addDecor(e,t,n,i){const r=t.decor.find(c=>c.id===i.decorId);if(!r){if(i.decorPicker===!0)for(const c of t.decor)this.push(e,"decor",`decor:${c.id}`,this.decorLabel(c),this.decorKindName(c.kind));return}this.push(e,"decor","decorTitle",this.labels.decorTitle,this.said.read(r.title));const a=zl(r,n);this.push(e,"decor","decorEast",this.labels.decorEast,this.rounded(a.eastM,1),"m"),this.push(e,"decor","decorNorth",this.labels.decorNorth,this.rounded(a.northM,1),"m"),this.push(e,"decor","decorAltitude",this.labels.decorAltitude,this.roundedShown(a.altitudeM),"m"),this.push(e,"decor","decorHeading",this.labels.decorHeading,this.rounded(a.headingDeg),"°"),Gp(r,n)&&this.push(e,"decor","decorLit",this.labels.decorLit,"✓");const o=r.lights?.map(c=>c.id).join()??"",l=o===""?void 0:n1.find(c=>c.create().map(h=>h.id).join()===o);this.push(e,"decor","decorLightRig",this.labels.decorLights,l?.name),this.push(e,"decor","decorFloors",this.labels.decorFloors,r.floors),this.push(e,"decor","decorOccupiedFloor",this.labels.decorOccupiedFloor,r.occupiedFloor),this.push(e,"decor","decorWitnessSide",this.labels.decorWitnessSide,this.decorSideName(r.witnessSide));for(const[c,h]of Object.entries(r.windows??{}))this.push(e,"decor",`decorWindow${this.capitalise(c)}`,`${this.labels.decorWindows} ${this.decorSideName(c)}`,h,"%")}addTemporal(e,t){const n=t.event;this.push(e,"temporal","obs-time",this.labels.observationTime,n.time&&Cd(n.time)),this.push(e,"temporal","obs-end-time",this.labels.observationEndTime,n.endTime&&Cd(n.endTime));const i=zp(n);this.push(e,"temporal","durationSeconds",this.labels.duration,this.roundedShown(i&&i/1e3,1),"s"),this.push(e,"temporal","timeZone",this.labels.utcOffset,n.timeZone),this.push(e,"temporal","utcOffsetHours",this.labels.utcOffset,this.rounded(n.utcOffsetHours,1),"UTC±h")}addWeather(e,t,n){const i=pa(t,n),a={fromSource:t.weatherSource!==void 0},o=this.showsPercent(i.cloudCover)||this.showsPercent(i.lowerCloudCover)||this.showsPercent(i.highCloudCover);this.push(e,"weather","cloudCover",this.labels.cloudCover,this.percentShown(i.cloudCover),"",a),this.push(e,"weather","highCloudCover",this.labels.highCloudCover,this.percentShown(i.highCloudCover),"",a),this.push(e,"weather","iceCrystalAlignment",this.labels.iceCrystalAlignment,this.showsPercent(i.highCloudCover)?this.percent(i.iceCrystalAlignment):void 0),this.push(e,"weather","cloudDarkness",this.labels.cloudDarkness,o?this.percent(i.cloudDarkness):void 0,"",a),this.push(e,"weather","cloudBase",this.labels.cloudBase,o?this.rounded(i.cloudBaseM):void 0,"m",a);const l=i.precipitationType!=="none"&&this.showsPercent(i.precipitationIntensity);this.push(e,"weather","precipitationType",this.labels.precipitationType,l?this.precipitationName(i.precipitationType):void 0,"",a),this.push(e,"weather","precipitationIntensity",this.labels.precipitationIntensity,l?this.percent(i.precipitationIntensity):void 0,"",a),this.push(e,"weather","windDirection",this.labels.windDirection,this.shows(i.windSpeed,2)?this.rounded(i.windDirectionDeg):void 0,"°",a),this.push(e,"weather","windSpeed",this.labels.windSpeed,this.roundedShown(i.windSpeed,2),"m/s",a),i.storm&&this.push(e,"weather","storm",this.labels.storm,"✓","",a)}addSound(e,t,n){const i=Bp(t,n);i.kind!=="none"&&(this.push(e,"sound","soundKind",this.labels.soundKind,this.soundKindName(i.kind)),this.push(e,"sound","soundVolume",this.labels.soundVolume,this.percentShown(i.volume)),this.push(e,"sound","soundPitch",this.labels.soundPitch,this.roundedShown(i.pitchHz),"Hz"),this.push(e,"sound","soundSrc",this.labels.soundSrc,i.src))}decorLabel(e){return this.said.read(e.title)??this.decorKindName(e.kind)}decorKindName(e){switch(e){case"building":return this.labels.decorBuilding;case"tree":return this.labels.decorTree;case"crop":return this.labels.decorCrop;case"mound":return this.labels.decorMound;case"streetlight":return this.labels.decorStreetlight;case"vehicle":return this.labels.decorVehicle;case"aircraft":return this.labels.decorAircraft;default:return this.labels.decorWitness}}decorSideName(e){switch(e){case"front":return this.labels.decorSideFront;case"behind":return this.labels.decorSideBehind;case"left":return this.labels.decorSideLeft;case"right":return this.labels.decorSideRight;case"front-left":return this.labels.decorSideFrontLeft;case"front-right":return this.labels.decorSideFrontRight;case"behind-left":return this.labels.decorSideBehindLeft;case"behind-right":return this.labels.decorSideBehindRight;default:return}}precipitationName(e){switch(e){case"rain":return this.labels.precipitationRain;case"snow":return this.labels.precipitationSnow;case"hail":return this.labels.precipitationHail;default:return this.labels.precipitationNone}}soundKindName(e){switch(e){case"hum":return this.labels.soundHum;case"whistle":return this.labels.soundWhistle;case"rumble":return this.labels.soundRumble;case"crackle":return this.labels.soundCrackle;default:return this.labels.soundNone}}capitalise(e){return e.replace(/(^|-)([a-z])/g,(t,n,i)=>i.toUpperCase())}}const i1="modulepreload",s1=function(s,e){return new URL(s,e).href},Fd={},Xi=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");i=a(t.map(h=>{if(h=s1(h,n),h in Fd)return;Fd[h]=!0;const u=h.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!n)for(let v=o.length-1;v>=0;v--){const m=o[v];if(m.href===h&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":i1,u||(p.as="script"),p.crossOrigin="",p.href=h,c&&p.setAttribute("nonce",c),document.head.appendChild(p),u)return new Promise((v,m)=>{p.addEventListener("load",v),p.addEventListener("error",()=>m(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)})},r1=[{id:"coverage",name:"Coverage",credit:"UFO@home",creditUrl:"https://ufoathome.org",create:()=>({about:"witness",assess:async s=>{const{CoverageAssessor:e}=await Xi(async()=>{const{CoverageAssessor:t}=await import("./CoverageAssessor-mVlehblF.js");return{CoverageAssessor:t}},[],import.meta.url);return new e().assess(s)}})},{id:"hynek",name:"Hynek",credit:"J. Allen Hynek",creditUrl:"https://rr0.org/science/crypto/ufo/observation/classification/hynek/",create:()=>({about:"temporal",assess:async s=>{const{HynekAssessor:e}=await Xi(async()=>{const{HynekAssessor:t}=await import("./HynekAssessor-BiP2di32.js");return{HynekAssessor:t}},[],import.meta.url);return new e().assess(s)}})}];class a1{constructor(e){this.labels=e}async read(e){const t=[],n=new Set;for(const i of r1){let r;try{r=await i.create().assess(e)}catch{continue}for(const o of r.criteria)o.basis===void 0&&!o.unsupported&&n.add(o.id);const a=r.score===void 0?r.verdict===void 0?"":this.verdictName(i.id,r.verdict):`${Math.round(r.score*100)}%`;a!==""&&t.push({group:"assessment",field:i.id,label:this.labels.assessmentNames[i.id]??i.name,value:a,unit:"",fromSource:!1,about:i.create().about})}return{entries:t,unanswered:n}}verdictName(e,t){return this.labels.assessmentVerdicts[`${e}.${t}`]??t.toUpperCase()}}const Wp=Math.PI/180,ml=111320;function tn(s,e,t,n){const i=ml*Math.cos(t*Wp),r=(s-t)*ml;return{x:(e-n)*i,z:-r}}function zi(s,e,t,n){const i=ml*Math.cos(t*Wp),r=-e,a=s;return{lat:t+r/ml,lng:n+a/i}}function kd(s,e,t,n,i,r){const a=n?.lat!==void 0&&n.lng!==void 0&&i?.lat!==void 0&&i.lng!==void 0?tn(i.lat,i.lng,n.lat,n.lng):{x:0,z:0},o=Math.max(0,s),l=[0,...e.allKeyframes.map(c=>c.t).filter(c=>c>0&&c<o),o];for(let c=1;c<l.length;c++){const h=l[c-1],u=l[c]-h;if(u===0)continue;const d=32;for(let f=0;f<=d;f++){const p=e.getInterpolatedWeatherAt(h+u*f/d)??t,v=r===void 0?void 0:p.cloudLayers?.find(w=>w.id===r),m=(v?.windDirectionDeg??p.windDirectionDeg)*Math.PI/180,g=f===0||f===d?1:f%2===0?2:4,S=(v?.windSpeed??p.windSpeed)*u/1e3/d/3*g;a.x-=Math.sin(m)*S,a.z+=Math.cos(m)*S}}return a}const o1=`
|
|
380
380
|
<div class="stage" id="stage">
|
|
381
381
|
<div class="frame" id="frame">
|
|
382
382
|
<canvas id="scene-canvas"></canvas>
|
|
@@ -6420,4 +6420,4 @@ void main() {
|
|
|
6420
6420
|
}
|
|
6421
6421
|
`;let el;function gE(){if(el)return el;const s=128,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/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,s,s),el=new Ai(e),el}function Pp(s){const t=document.createElement("canvas");t.width=128,t.height=128;const n=t.getContext("2d"),i=128/2-2,r=128/2,a=128/2,o="#2e2b26",l="#f4f1e2";n.fillStyle=o,n.beginPath(),n.arc(r,a,i,0,Math.PI*2),n.fill();const c=Ra(s.illuminatedFraction,0,1),h=s.phaseFraction<.5,u=i*Math.abs(1-2*c),d=c<.5;return n.save(),n.beginPath(),n.arc(r,a,i,0,Math.PI*2),n.clip(),n.fillStyle=l,n.beginPath(),h?(n.arc(r,a,i,-Math.PI/2,Math.PI/2,!1),n.ellipse(r,a,u,i,0,Math.PI/2,-Math.PI/2,d)):(n.arc(r,a,i,Math.PI/2,-Math.PI/2,!1),n.ellipse(r,a,u,i,0,-Math.PI/2,Math.PI/2,d)),n.fill(),n.restore(),new Ai(t)}function vE(s){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(s,64,68),new Ai(e)}function lh(s){let e=s;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 ch=7.5,hh=9;class fi{static cache=new Map;static load(e){let t=fi.cache.get(e);return t||(t=fetch(e).then(n=>n.arrayBuffer()).then(n=>fi.parse(n)),fi.cache.set(e,t)),t}static upTo(e,t){const n=e.filter((a,o)=>o===0||e[o-1].magnitudeLimit<t);if(n.length<=1)return fi.load(e[0].url);const i=n.map(a=>a.url).join(`
|
|
6422
6422
|
`);let r=fi.cache.get(i);return r||(r=Promise.all(n.map(a=>fi.load(a.url))).then(a=>a.reduce((o,l)=>fi.concat(o,l))),fi.cache.set(i,r)),r}static parse(e){const t=e.byteLength/(4*Float32Array.BYTES_PER_ELEMENT),n=t*Float32Array.BYTES_PER_ELEMENT;return{count:t,ra:new Float32Array(e,0*n,t),dec:new Float32Array(e,1*n,t),mag:new Float32Array(e,2*n,t),ci:new Float32Array(e,3*n,t)}}static concat(e,t){const n=(i,r)=>{const a=new Float32Array(i.length+r.length);return a.set(i,0),a.set(r,i.length),a};return{count:e.count+t.count,ra:n(e.ra,t.ra),dec:n(e.dec,t.dec),mag:n(e.mag,t.mag),ci:n(e.ci,t.ci)}}}const ME=new URL(""+new URL("rain-BvWZrB9h.ogg",import.meta.url).href,import.meta.url).href,xE=new URL(""+new URL("wind-BjklexY7.ogg",import.meta.url).href,import.meta.url).href,yE=new URL(""+new URL("thunder-DA48qs_v.wav",import.meta.url).href,import.meta.url).href,_E=20,SE=1;class bE{context;buffers=new Map;ambientSource;ambientGain;ambientKey="none";ambientToken=0;ambientVolume=0;windSource;windGain;windActive=!1;windToken=0;windVolume=0;paused=!0;requested={type:"none",intensity:0,windSpeed:0};resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(e){console.warn("WeatherAudio: Web Audio unavailable, weather sounds disabled:",e);return}}this.context.state==="suspended"&&this.context.resume()}setAmbient(e,t,n){if(this.requested={type:e,intensity:t,windSpeed:n},!this.context)return;this.paused&&(e="none",t=0,n=0);const i=e==="rain"||e==="hail"?e:"none";if(this.ambientVolume=i==="hail"?Math.min(1,t*1.3+.2):i==="rain"?t:0,i!==this.ambientKey){this.ambientKey=i;const a=++this.ambientToken;this.stopSource(this.ambientSource,this.ambientGain),this.ambientSource=void 0,this.ambientGain=void 0,i!=="none"&&this.startLoop(ME,this.ambientVolume).then(o=>this.applyIfCurrent(o,a,()=>this.ambientToken,l=>{this.ambientSource=l?.source,this.ambientGain=l?.gain,l&&(l.gain.gain.value=this.ambientVolume)}))}else this.ambientGain&&(this.ambientGain.gain.value=this.ambientVolume);this.windVolume=Math.min(n/_E,1);const r=n>SE;if(r!==this.windActive){this.windActive=r;const a=++this.windToken;this.stopSource(this.windSource,this.windGain),this.windSource=void 0,this.windGain=void 0,r&&this.startLoop(xE,this.windVolume).then(o=>this.applyIfCurrent(o,a,()=>this.windToken,l=>{this.windSource=l?.source,this.windGain=l?.gain,l&&(l.gain.gain.value=this.windVolume)}))}else this.windGain&&(this.windGain.gain.value=this.windVolume)}setPaused(e){if(e===this.paused)return;this.paused=e;const{type:t,intensity:n,windSpeed:i}=this.requested;this.setAmbient(t,n,i)}playThunder(){!this.context||this.paused||this.playOneShot(yE,.9)}dispose(){this.ambientToken++,this.windToken++,this.stopSource(this.ambientSource,this.ambientGain),this.stopSource(this.windSource,this.windGain),this.ambientSource=void 0,this.ambientGain=void 0,this.windSource=void 0,this.windGain=void 0,this.context?.close(),this.context=void 0,this.buffers.clear()}applyIfCurrent(e,t,n,i){if(t!==n()){e?.source.stop();return}i(e)}async startLoop(e,t){const n=this.context;if(n)try{const i=await this.getBuffer(e),r=n.createBufferSource();r.buffer=i,r.loop=!0;const a=n.createGain();return a.gain.value=t,r.connect(a).connect(n.destination),r.start(),{source:r,gain:a}}catch(i){console.warn("Weather ambient sound failed to load, staying silent:",i);return}}async playOneShot(e,t){const n=this.context;if(n)try{const i=await this.getBuffer(e),r=n.createBufferSource();r.buffer=i;const a=n.createGain();a.gain.value=t,r.connect(a).connect(n.destination),r.start()}catch(i){console.warn("Thunder sound failed to load:",i)}}async getBuffer(e){const t=this.context;if(!t)throw new Error("WeatherAudio: AudioContext not ready — resume() must be called first");let n=this.buffers.get(e);return n||(n=fetch(e).then(i=>{if(!i.ok)throw new Error(`Audio fetch failed (${i.status}): ${e}`);return i.arrayBuffer()}).then(i=>t.decodeAudioData(i)),this.buffers.set(e,n)),n}stopSource(e,t){try{e?.stop()}catch{}e?.disconnect(),t?.disconnect()}}class Fi{constructor(e){this.elements=e;const{eccentricity:t,perihelionAu:n}=e,[i,r]=this.perifocalAxes(),a=Math.sqrt(Fi.SUN_GM_AU3_PER_DAY2*(1+t)/n);this.perihelionPosition=this.scale(i,n),this.perihelionVelocity=this.scale(r,a),this.inverseSemiMajorAxis=(1-t)/n}static SUN_GM_AU3_PER_DAY2=.0002959122082855911;static MAX_ITERATIONS=200;perihelionPosition;perihelionVelocity;inverseSemiMajorAxis;positionAt(e){const t=e-this.elements.perihelionJd,n=this.universalAnomaly(t),i=this.inverseSemiMajorAxis*n*n,r=this.elements.perihelionAu,a=1-n*n/r*Fi.stumpffC(i),o=t-n*n*n/Math.sqrt(Fi.SUN_GM_AU3_PER_DAY2)*Fi.stumpffS(i);return{x:a*this.perihelionPosition.x+o*this.perihelionVelocity.x,y:a*this.perihelionPosition.y+o*this.perihelionVelocity.y,z:a*this.perihelionPosition.z+o*this.perihelionVelocity.z}}heliocentricDistanceAt(e){const t=this.positionAt(e);return Math.hypot(t.x,t.y,t.z)}universalAnomaly(e){if(e===0)return 0;const t=Math.sign(e),n=Math.sqrt(Fi.SUN_GM_AU3_PER_DAY2)*Math.abs(e),i=o=>{const l=this.inverseSemiMajorAxis*o*o,c=this.elements.perihelionAu;return(1-this.inverseSemiMajorAxis*c)*o*o*o*Fi.stumpffS(l)+c*o};let r=Math.max(1,n/this.elements.perihelionAu);for(;i(r)<n;)r*=2;let a=0;for(let o=0;o<Fi.MAX_ITERATIONS&&r-a>1e-13*Math.max(1,r);o++){const l=(a+r)/2;i(l)<n?a=l:r=l}return t*(a+r)/2}perifocalAxes(){const e=this.elements.ascendingNodeDeg*Math.PI/180,t=this.elements.argumentOfPerihelionDeg*Math.PI/180,n=this.elements.inclinationDeg*Math.PI/180,i=Math.cos(e),r=Math.sin(e),a=Math.cos(t),o=Math.sin(t),l=Math.cos(n),c=Math.sin(n);return[{x:i*a-r*o*l,y:r*a+i*o*l,z:o*c},{x:-i*o-r*a*l,y:-r*o+i*a*l,z:a*c}]}scale(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}static stumpffC(e){if(Math.abs(e)<1e-6)return 1/2-e/24+e*e/720;if(e>0)return(1-Math.cos(Math.sqrt(e)))/e;const t=Math.sqrt(-e);return(Math.cosh(t)-1)/-e}static stumpffS(e){if(Math.abs(e)<1e-6)return 1/6-e/120+e*e/5040;if(e>0){const n=Math.sqrt(e);return(n-Math.sin(n))/(n*n*n)}const t=Math.sqrt(-e);return(Math.sinh(t)-t)/(t*t*t)}}const bg=[{id:"halley-1910",designation:"1P/Halley",name:{en:"Halley's Comet",fr:"comète de Halley"},orbit:{eccentricity:.9672960498922706,perihelionAu:.5872100477652511,inclinationDeg:162.218798367122,ascendingNodeDeg:58.56208298700436,argumentOfPerihelionDeg:111.7366940639061,perihelionJd:2.4187816784171113e6},peakMagnitude:0,peakOn:"1910-05-20",absoluteMagnitude:4.72,activityExponent:4,tailLengthDeg:100,tailLengthAu:.1638,note:"Passed 0.15 au from Earth on 20 May 1910, and the Earth crossed the outer tail the day before — the apparition that produced a genuine public panic."},{id:"brooks-1911",designation:"C/1911 O1",name:{en:"Comet Brooks",fr:"comète Brooks"},orbit:{eccentricity:.9876404970138669,perihelionAu:.4898172916113738,inclinationDeg:33.34043866978714,ascendingNodeDeg:293.7022074981857,argumentOfPerihelionDeg:153.5578007321686,perihelionJd:2.4193378856140426e6},peakMagnitude:2,peakOn:"1911-10-25",absoluteMagnitude:5.59,activityExponent:4},{id:"skjellerup-maristany-1927",designation:"C/1927 X1",name:{en:"Comet Skjellerup-Maristany",fr:"comète Skjellerup-Maristany"},orbit:{eccentricity:.999839726885059,perihelionAu:.1761569619628186,inclinationDeg:85.1125991950808,ascendingNodeDeg:78.24360172472711,argumentOfPerihelionDeg:47.15877857390136,perihelionJd:2.4252326808989984e6},peakMagnitude:-6,peakOn:"1927-12-15",absoluteMagnitude:1.19,activityExponent:4,note:"One of the few comets of the century seen in full daylight."},{id:"de-kock-paraskevopoulos-1941",designation:"C/1941 B2",name:{en:"Comet de Kock-Paraskevopoulos",fr:"comète de Kock-Paraskevopoulos"},orbit:{eccentricity:.9991026715181549,perihelionAu:.7900329662827822,inclinationDeg:168.2039226531089,ascendingNodeDeg:43.10609347214336,argumentOfPerihelionDeg:268.6990344196369,perihelionJd:2430022157765061e-9},peakMagnitude:2,peakOn:"1941-02-05",absoluteMagnitude:5.01,activityExponent:4},{id:"southern-1947",designation:"C/1947 X1",name:{en:"the Southern Comet",fr:"comète australe"},orbit:{eccentricity:.9998424430916737,perihelionAu:.1100045955093761,inclinationDeg:138.5113919632757,ascendingNodeDeg:337.3114969669252,argumentOfPerihelionDeg:196.1820121395961,perihelionJd:2.4325220864727003e6},peakMagnitude:-3,peakOn:"1947-12-08",absoluteMagnitude:3.01,activityExponent:4,note:"A bright southern-hemisphere comet of December 1947, the month the American sighting wave of that year was still being argued over."},{id:"eclipse-1948",designation:"C/1948 V1",name:{en:"the Eclipse Comet",fr:"comète de l'éclipse"},orbit:{eccentricity:.9999130678247334,perihelionAu:.1354437057263306,inclinationDeg:23.11668597152911,ascendingNodeDeg:211.0454985994762,argumentOfPerihelionDeg:107.2474157073104,perihelionJd:2.4328519265329437e6},peakMagnitude:-2,peakOn:"1948-11-01",absoluteMagnitude:4.79,activityExponent:4,note:"Found during the total solar eclipse of 1 November 1948, which is how a comet that bright had gone unnoticed: it had been hidden in the Sun's glare."},{id:"arend-roland-1957",designation:"C/1956 R1",name:{en:"Comet Arend-Roland",fr:"comète Arend-Roland"},orbit:{eccentricity:1.0002570255357,perihelionAu:.3160532361485914,inclinationDeg:119.9440863251822,ascendingNodeDeg:215.8548157717755,argumentOfPerihelionDeg:308.775920364167,perihelionJd:2.4359365327396123e6},peakMagnitude:.5,peakOn:"1957-04-25",absoluteMagnitude:3.96,activityExponent:4,note:"Showed a spike pointing back TOWARD the Sun in late April 1957 — a real anti-tail, and much reported at the time."},{id:"mrkos-1957",designation:"C/1957 P1",name:{en:"Comet Mrkos",fr:"comète Mrkos"},orbit:{eccentricity:.9993521583504134,perihelionAu:.3549238508212375,inclinationDeg:93.9433042053929,ascendingNodeDeg:68.32441518619923,argumentOfPerihelionDeg:40.31823675802871,perihelionJd:243605193752228e-8},peakMagnitude:1,peakOn:"1957-08-05",absoluteMagnitude:5.07,activityExponent:4,note:"The second bright naked-eye comet of 1957, four months after Arend-Roland."},{id:"seki-lines-1962",designation:"C/1962 C1",name:{en:"Comet Seki-Lines",fr:"comète Seki-Lines"},orbit:{eccentricity:1.000003791331562,perihelionAu:.03139689112215131,inclinationDeg:65.01487186102287,ascendingNodeDeg:304.6776602796538,argumentOfPerihelionDeg:11.47295326312573,perihelionJd:2437756163010178e-9},peakMagnitude:-2.5,peakOn:"1962-04-01",absoluteMagnitude:9.3,activityExponent:4},{id:"ikeya-seki-1965",designation:"C/1965 S1",name:{en:"Comet Ikeya-Seki",fr:"comète Ikeya-Seki"},orbit:{eccentricity:.9999141178248997,perihelionAu:.007785966366889336,inclinationDeg:141.8642315267051,ascendingNodeDeg:346.9951764632611,argumentOfPerihelionDeg:69.04909813996062,perihelionJd:2.4390546837018197e6},peakMagnitude:-10,peakOn:"1965-10-21",alsoRecordedMagnitude:2,alsoRecordedOn:"1965-10-30",absoluteMagnitude:5.26,activityExponent:4.002,tailLengthDeg:25,tailLengthAu:.5048,note:"A sungrazer that passed 450 000 km above the Sun's surface and was seen beside it in broad daylight — the brightest comet of the twentieth century. It then stood in the dawn sky for a fortnight with a tail some 25 degrees long, which is the second magnitude recorded here."},{id:"bennett-1970",designation:"C/1969 Y1",name:{en:"Comet Bennett",fr:"comète Bennett"},orbit:{eccentricity:.9962979048768408,perihelionAu:.5376209981502136,inclinationDeg:90.03975717147327,ascendingNodeDeg:224.6576652531314,argumentOfPerihelionDeg:354.1494209173161,perihelionJd:2.4406655455270996e6},peakMagnitude:0,peakOn:"1970-03-26",absoluteMagnitude:3.36,activityExponent:4},{id:"white-ortiz-bolelli-1970",designation:"C/1970 K1",name:{en:"Comet White-Ortiz-Bolelli",fr:"comète White-Ortiz-Bolelli"},orbit:{eccentricity:.9999488875801225,perihelionAu:.00884411465256722,inclinationDeg:138.9520738221631,ascendingNodeDeg:336.8194095816687,argumentOfPerihelionDeg:61.10224765396615,perihelionJd:2.4407209807728203e6},peakMagnitude:1,peakOn:"1970-05-22",absoluteMagnitude:4.35,activityExponent:4},{id:"kohoutek-1973",designation:"C/1973 E1",name:{en:"Comet Kohoutek",fr:"comète Kohoutek"},orbit:{eccentricity:1.000007152175185,perihelionAu:.1424250377812859,inclinationDeg:14.30414984159355,ascendingNodeDeg:258.4893339663974,argumentOfPerihelionDeg:37.79772760699667,perihelionJd:2442044930687027e-9},peakMagnitude:0,peakOn:"1974-01-05",absoluteMagnitude:4.89,activityExponent:4,note:"Announced in advance as the comet of the century and remembered for disappointing: it was an ordinary naked-eye object, not the spectacle the press had promised."},{id:"west-1976",designation:"C/1975 V1",name:{en:"Comet West",fr:"comète West"},orbit:{eccentricity:1.000017859625611,perihelionAu:.1966006188461085,inclinationDeg:43.07319920579427,ascendingNodeDeg:118.9189245655447,argumentOfPerihelionDeg:358.4315101259072,perihelionJd:2442833721841768e-9},peakMagnitude:-3,peakOn:"1976-02-25",absoluteMagnitude:4.41,activityExponent:4,tailLengthDeg:30,tailLengthAu:.4325,note:"Broke into four pieces at perihelion. Barely reported at the time — the press had been burned by Kohoutek two years earlier."},{id:"iras-araki-alcock-1983",designation:"C/1983 H1",name:{en:"Comet IRAS-Araki-Alcock",fr:"comète IRAS-Araki-Alcock"},orbit:{eccentricity:.9898409731606003,perihelionAu:.9913412593828502,inclinationDeg:73.25000846947029,ascendingNodeDeg:49.10235754476374,argumentOfPerihelionDeg:192.8506176754439,perihelionJd:2.4454757545235856e6},peakMagnitude:1.7,peakOn:"1983-05-11",absoluteMagnitude:9.04,activityExponent:4,note:"Passed 0.031 au from Earth on 11 May 1983, one of the closest cometary approaches on record: it crossed a quarter of the sky in a night, which no other comet in this list did."},{id:"halley-1986",designation:"1P/Halley",name:{en:"Halley's Comet",fr:"comète de Halley"},orbit:{eccentricity:.9672792271749998,perihelionAu:.5871034488173393,inclinationDeg:162.2422242700916,ascendingNodeDeg:58.85993640671803,argumentOfPerihelionDeg:111.8655480539208,perihelionJd:2.4464709589610207e6},peakMagnitude:2.1,peakOn:"1986-03-10",absoluteMagnitude:2.71,activityExponent:4,note:"The worst-placed return in two thousand years — famous, expected, and for most observers a faint smudge."},{id:"hyakutake-1996",designation:"C/1996 B2",name:{en:"Comet Hyakutake",fr:"comète Hyakutake"},orbit:{eccentricity:.9997295133739305,perihelionAu:.2302272039470452,inclinationDeg:124.923592343765,ascendingNodeDeg:188.0454295899424,argumentOfPerihelionDeg:130.1724036582639,perihelionJd:2.4502048946148166e6},peakMagnitude:0,peakOn:"1996-03-25",absoluteMagnitude:4.75,activityExponent:4,tailLengthDeg:80,tailLengthAu:1,note:"Passed 0.10 au from Earth in March 1996, five weeks BEFORE perihelion, with a tail measured at some 80 degrees — the longest of the modern era."},{id:"hale-bopp-1997",designation:"C/1995 O1",name:{en:"Comet Hale-Bopp",fr:"comète Hale-Bopp"},orbit:{eccentricity:.9951314746156615,perihelionAu:.9141695067003724,inclinationDeg:89.43017155012492,ascendingNodeDeg:282.470602866853,argumentOfPerihelionDeg:130.5872524854533,perihelionJd:2450539633099368e-9},peakMagnitude:-.8,peakOn:"1997-04-01",absoluteMagnitude:-1.06,activityExponent:4,tailLengthDeg:20,tailLengthAu:.9938,note:"Visible to the naked eye for about eighteen months, longer than any comet on record."},{id:"mcnaught-2007",designation:"C/2006 P1",name:{en:"Comet McNaught",fr:"comète McNaught"},orbit:{eccentricity:1.00001811603225,perihelionAu:.1707325614080681,inclinationDeg:77.83726446452654,ascendingNodeDeg:267.4149080498975,argumentOfPerihelionDeg:155.9756130642756,perihelionJd:2454113298753579e-9},peakMagnitude:-5.5,peakOn:"2007-01-13",absoluteMagnitude:2.53,activityExponent:4,tailLengthDeg:35,tailLengthAu:.5009,note:"The brightest comet since Ikeya-Seki, seen in daylight beside the Sun in January 2007."},{id:"lovejoy-2011",designation:"C/2011 W3",name:{en:"Comet Lovejoy",fr:"comète Lovejoy"},orbit:{eccentricity:.999915056276912,perihelionAu:.005553783989325053,inclinationDeg:134.3558712062691,ascendingNodeDeg:326.3693517957772,argumentOfPerihelionDeg:53.50991655176601,perihelionJd:2455911511809431e-9},peakMagnitude:-3,peakOn:"2011-12-16",alsoRecordedMagnitude:1.5,alsoRecordedOn:"2011-12-22",absoluteMagnitude:3.51,activityExponent:1.194,note:"A sungrazer that was expected to be destroyed at perihelion and came out the other side, to stand in the southern dawn sky for the rest of December — which is the second magnitude recorded here."},{id:"panstarrs-2013",designation:"C/2011 L4",name:{en:"Comet PANSTARRS",fr:"comète PANSTARRS"},orbit:{eccentricity:1.000032542889696,perihelionAu:.301544229714915,inclinationDeg:84.2081978367921,ascendingNodeDeg:65.66588626213694,argumentOfPerihelionDeg:333.6516444379993,perihelionJd:2456361669960698e-9},peakMagnitude:1,peakOn:"2013-03-10",absoluteMagnitude:5.98,activityExponent:4},{id:"neowise-2020",designation:"C/2020 F3",name:{en:"Comet NEOWISE",fr:"comète NEOWISE"},orbit:{eccentricity:.9991782081129224,perihelionAu:.2946512466331692,inclinationDeg:128.9375043020912,ascendingNodeDeg:61.01042991771634,argumentOfPerihelionDeg:37.2786526292898,perihelionJd:2.4590341788972816e6},peakMagnitude:.9,peakOn:"2020-07-08",absoluteMagnitude:5.79,activityExponent:4,tailLengthDeg:10,tailLengthAu:.1808,note:"The first comet since Hale-Bopp that ordinary observers in the northern hemisphere saw without being told where to look."},{id:"tsuchinshan-atlas-2024",designation:"C/2023 A3",name:{en:"Comet Tsuchinshan-ATLAS",fr:"comète Tsuchinshan-ATLAS"},orbit:{eccentricity:1.000020192843226,perihelionAu:.3914228969475176,inclinationDeg:139.1105462619479,ascendingNodeDeg:21.55945689078845,argumentOfPerihelionDeg:308.4913086299446,perihelionJd:2460581242087108e-9},peakMagnitude:0,peakOn:"2024-10-14",absoluteMagnitude:3.97,activityExponent:4,tailLengthDeg:20,tailLengthAu:.1902,note:"Briefly reported far brighter around 9 October 2024, when it stood almost between the observer and the Sun and forward-scattered the light through its own dust — a geometry this catalog's brightness model does not attempt, so what is stored is the ordinary evening-sky peak a few days later."}];class wE{static WINDOW_DAYS=200;static TWILIGHT_ELONGATION_DEG=15;static LIGHT_SPEED_AU_PER_DAY=173.144632674;static orbits=new Map;static aroundDate(e){const t=this.julianDayOf(e);return bg.filter(n=>Math.abs(t-n.orbit.perihelionJd)<=this.WINDOW_DAYS)}static brightestAt(e,t){return this.aroundDate(e).map(n=>this.appearanceOf(n,e,t)).sort((n,i)=>n.magnitude-i.magnitude)[0]}static appearanceOf(e,t,n){const i=Bt(t),r=this.earthPositionAt(i),a=this.apparentPositionOf(e,2451545+i.tt,r),o=this.subtract(a,r),l=this.length(a),c=this.length(o),h=this.tailEndAt(e,a,r,l,i,t,n),u=this.horizontalOf(o,i,t,n);return{apparition:e,position:u,...h,heliocentricDistanceAu:l,earthDistanceAu:c,elongationDeg:this.angleBetween(o,this.subtract({x:0,y:0,z:0},r)),magnitude:this.magnitudeAt(e,l,c)}}static magnitudeAt(e,t,n){const i=e.absoluteMagnitude+5*Math.log10(n)+2.5*e.activityExponent*Math.log10(t);return Math.max(i,e.peakMagnitude)}static tailEndAt(e,t,n,i,r,a,o){if(e.tailLengthAu===void 0)return{};const l=1+e.tailLengthAu/i,c=this.subtract({x:t.x*l,y:t.y*l,z:t.z*l},n),h=this.subtract(t,n);return{tailEnd:this.horizontalOf(c,r,a,o),tailLengthDeg:this.angleBetween(h,c)}}static apparentPositionOf(e,t,n){const i=this.orbitOf(e);let r=i.positionAt(t);for(let a=0;a<2;a++){const o=this.length(this.subtract(r,n))/this.LIGHT_SPEED_AU_PER_DAY;r=i.positionAt(t-o)}return r}static horizontalOf(e,t,n,i){const r=ul(Tb(),new vt(e.x,e.y,e.z,t)),a=ul(Rb(t),r),o=rb(t,new vd(i.lat,i.lng,i.elevationM)),l=new vt(a.x-o.x,a.y-o.y,a.z-o.z,t),c=og(l);return Zl(c.ra,c.dec,n,i)}static earthPositionAt(e){return ul(Ab(),vs(Se.Earth,e))}static julianDayOf(e){return 2451545+Bt(e).tt}static orbitOf(e){const t=this.orbits.get(e.id);if(t)return t;const n=new Fi(e.orbit);return this.orbits.set(e.id,n),n}static subtract(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}static length(e){return Math.hypot(e.x,e.y,e.z)}static angleBetween(e,t){const n=(e.x*t.x+e.y*t.y+e.z*t.z)/(this.length(e)*this.length(t)||1);return Math.acos(Math.min(1,Math.max(-1,n)))*180/Math.PI}}const EE=[{id:"quadrantids",code:"QUA",name:{en:"Quadrantids",fr:"Quadrantides"},radiantRaHours:15.33,radiantDecDeg:49.7,start:{month:12,day:28},peak:{month:1,day:3},end:{month:1,day:12},peakZhr:110,velocityKmS:41,populationIndex:2.1},{id:"lyrids",code:"LYR",name:{en:"April Lyrids",fr:"Lyrides d'avril"},radiantRaHours:18.13,radiantDecDeg:33.3,start:{month:4,day:16},peak:{month:4,day:22},end:{month:4,day:25},peakZhr:18,velocityKmS:49,populationIndex:2.1},{id:"eta-aquariids",code:"ETA",name:{en:"eta Aquariids",fr:"Êta Aquarides"},radiantRaHours:22.53,radiantDecDeg:-1,start:{month:4,day:19},peak:{month:5,day:6},end:{month:5,day:28},peakZhr:50,velocityKmS:66,populationIndex:2.4},{id:"alpha-capricornids",code:"CAP",name:{en:"alpha Capricornids",fr:"Alpha Capricornides"},radiantRaHours:20.47,radiantDecDeg:-9.2,start:{month:7,day:3},peak:{month:7,day:30},end:{month:8,day:15},peakZhr:5,velocityKmS:23,populationIndex:2.5},{id:"southern-delta-aquariids",code:"SDA",name:{en:"Southern delta Aquariids",fr:"Delta Aquarides du Sud"},radiantRaHours:22.67,radiantDecDeg:-16.4,start:{month:7,day:12},peak:{month:7,day:30},end:{month:8,day:23},peakZhr:25,velocityKmS:41,populationIndex:3.2},{id:"perseids",code:"PER",name:{en:"Perseids",fr:"Perséides"},radiantRaHours:3.22,radiantDecDeg:58,start:{month:7,day:17},peak:{month:8,day:12},end:{month:8,day:24},peakZhr:100,velocityKmS:59,populationIndex:2.2},{id:"southern-taurids",code:"STA",name:{en:"Southern Taurids",fr:"Taurides du Sud"},radiantRaHours:3.47,radiantDecDeg:13,start:{month:9,day:10},peak:{month:10,day:10},end:{month:11,day:20},peakZhr:5,velocityKmS:27,populationIndex:2.3},{id:"draconids",code:"DRA",name:{en:"October Draconids",fr:"Draconides d'octobre"},radiantRaHours:17.47,radiantDecDeg:54,start:{month:10,day:6},peak:{month:10,day:8},end:{month:10,day:10},peakZhr:10,velocityKmS:20,populationIndex:2.6},{id:"orionids",code:"ORI",name:{en:"Orionids",fr:"Orionides"},radiantRaHours:6.35,radiantDecDeg:15.6,start:{month:10,day:2},peak:{month:10,day:21},end:{month:11,day:7},peakZhr:20,velocityKmS:66,populationIndex:2.5},{id:"northern-taurids",code:"NTA",name:{en:"Northern Taurids",fr:"Taurides du Nord"},radiantRaHours:3.87,radiantDecDeg:22,start:{month:10,day:20},peak:{month:11,day:12},end:{month:12,day:10},peakZhr:5,velocityKmS:29,populationIndex:2.3},{id:"leonids",code:"LEO",name:{en:"Leonids",fr:"Léonides"},radiantRaHours:10.13,radiantDecDeg:21.6,start:{month:11,day:6},peak:{month:11,day:17},end:{month:11,day:30},peakZhr:15,velocityKmS:71,populationIndex:2.5},{id:"geminids",code:"GEM",name:{en:"Geminids",fr:"Géminides"},radiantRaHours:7.47,radiantDecDeg:32.3,start:{month:12,day:4},peak:{month:12,day:14},end:{month:12,day:17},peakZhr:150,velocityKmS:35,populationIndex:2.6},{id:"ursids",code:"URS",name:{en:"Ursids",fr:"Ursides"},radiantRaHours:14.47,radiantDecDeg:75.3,start:{month:12,day:17},peak:{month:12,day:22},end:{month:12,day:26},peakZhr:10,velocityKmS:33,populationIndex:3}],Ul=6.5;class uh{static activeAt(e){return EE.flatMap(t=>{const n=this.nearness(t,e);return n<=0?[]:[{shower:t,zhr:t.peakZhr*n,nearness:n}]})}static nearness(e,t){const n=this.dayOfYear(t),i=this.dayOfYear(this.asDate(e.start)),r=this.dayOfYear(this.asDate(e.peak)),a=this.dayOfYear(this.asDate(e.end)),o=this.wrappedDelta(n,r),l=this.wrappedDelta(r,i),c=this.wrappedDelta(a,r);return o<0?o<-l?0:1+o/l:o>0?o>c?0:1-o/c:1}static observedRatePerHour(e,t,n,i=Ul){if(t<=0)return 0;const r=Ul-i;return e*Math.sin(t*Math.PI/180)/Math.pow(n,r)}static radiantPosition(e,t,n){return Zl(e.radiantRaHours,e.radiantDecDeg,t,n)}static dayOfYear(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Math.floor((Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-t)/864e5)+1}static asDate(e){return new Date(Date.UTC(2001,e.month-1,e.day))}static wrappedDelta(e,t){const n=e-t;return n>182?n-365:n<-182?n+365:n}}class It{static QUIET_RATE_PER_HOUR=2;static APEX_RATE_PER_HOUR=8;static POPULATION_INDEX=3;static apexPosition(e,t){const n=Bt(e),i=new md(0,ib(e).elon-90,1),r=ul(Cb(n),ag(i,n)),a=og(r);return Zl(a.ra,a.dec,e,t)}static observedRatePerHour(e,t=Ul){const n=It.APEX_RATE_PER_HOUR*Math.max(0,Math.sin(e*Math.PI/180)),i=Ul-t;return(It.QUIET_RATE_PER_HOUR+n)/Math.pow(It.POPULATION_INDEX,i)}static schedule(e){const t=new hg(e.seed^1542469173);return Bs.schedule(e).map(n=>{const i=It.toCartesian({altitudeDeg:Math.asin(t.next())*180/Math.PI,azimuthDeg:t.between(0,360)}),r=n.fromRadiantDeg*Math.PI/180,a=It.turnAround(i,t.between(0,360)),o={x:i.x*Math.cos(r)+a.x*Math.sin(r),y:i.y*Math.cos(r)+a.y*Math.sin(r),z:i.z*Math.cos(r)+a.z*Math.sin(r)};return{...n,radiant:It.toHorizontal(o),bearingDeg:It.bearingFrom(o,i)}})}static turnAround(e,t){const[n,i]=It.basisAround(e),r=t*Math.PI/180;return{x:n.x*Math.cos(r)+i.x*Math.sin(r),y:n.y*Math.cos(r)+i.y*Math.sin(r),z:n.z*Math.cos(r)+i.z*Math.sin(r)}}static bearingFrom(e,t){const[n,i]=It.basisAround(e),r=e.x*t.x+e.y*t.y+e.z*t.z,a=It.normalise({x:t.x-e.x*r,y:t.y-e.y*r,z:t.z-e.z*r});return(Math.atan2(a.x*i.x+a.y*i.y+a.z*i.z,a.x*n.x+a.y*n.y+a.z*n.z)*180/Math.PI%360+360)%360}static basisAround(e){const t=Math.abs(e.y)<.9?{x:0,y:1,z:0}:{x:1,y:0,z:0},n=It.normalise(It.cross(e,t));return[n,It.normalise(It.cross(e,n))]}static toHorizontal(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{altitudeDeg:Math.asin(Math.min(1,Math.max(-1,e.y/t)))*180/Math.PI,azimuthDeg:(Math.atan2(e.x,-e.z)*180/Math.PI%360+360)%360}}static appearanceOf(e){const t=It.toCartesian(e.radiant??{altitudeDeg:90,azimuthDeg:0}),n=It.turnAround(t,e.bearingDeg),i=e.fromRadiantDeg*Math.PI/180;return It.toHorizontal({x:t.x*Math.cos(i)+n.x*Math.sin(i),y:t.y*Math.cos(i)+n.y*Math.sin(i),z:t.z*Math.cos(i)+n.z*Math.sin(i)})}static toCartesian(e){const t=e.altitudeDeg*Math.PI/180,n=e.azimuthDeg*Math.PI/180,i=Math.cos(t);return{x:i*Math.sin(n),y:Math.sin(t),z:-i*Math.cos(n)}}static cross(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}static normalise(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}static TYPICAL_VELOCITY_KM_S=40}const Ip="https://ufoathome.org/tle/index.json";class ln{static MAX_ELEMENT_AGE_DAYS=7;static DAY_MS=864e5;fetchImpl;indexUrls;index;files=new Map;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.indexUrls=e.indexUrls??ln.defaultIndexUrls()}static defaultIndexUrls(){const e=[];return typeof location<"u"&&/^https?:$/.test(location.protocol)&&e.push(new URL("/tle/index.json",location.href).href),e.includes(Ip)||e.push(Ip),e}static FIRST_SNAPSHOT="2021-02-22";async covers(e){const t=Date.parse(`${ln.FIRST_SNAPSHOT}T00:00:00Z`)-ln.MAX_ELEMENT_AGE_DAYS*ln.DAY_MS;if(e.getTime()<t)return!1;const n=await this.loadIndex();return n?Object.values(n.index.kinds).some(i=>e.getTime()>=Date.parse(i.from)-ln.MAX_ELEMENT_AGE_DAYS*ln.DAY_MS&&e.getTime()<=Date.parse(i.to)+ln.MAX_ELEMENT_AGE_DAYS*ln.DAY_MS):!1}async at(e){const t=await this.loadIndex();if(!t)return;const{index:n,base:i}=t,r=[],a=[];for(const o of Object.keys(n.kinds)){const l=await this.kindAt(o,e,n,i);r.push(...l),a.push(this.coverageOf(o,e,n,l.length>0))}return{objects:r,coverage:a,credit:n.credit,creditUrl:n.source}}async kindAt(e,t,n,i){const r=t.getTime(),a=n.binDays*ln.DAY_MS,o=Math.floor(r/a),l=r-o*a<a/2?o-1:o+1,c=new Set(n.kinds[e].bins),h=[o,l].map(v=>new Date(v*a).toISOString().slice(0,10)).filter(v=>c.has(v));if(h.length===0)return[];const[u,...d]=await Promise.all([this.json(new URL(`objects-${e}.json`,i).href),...h.map(v=>this.binary(new URL(`${e}/${v}.bin`,i).href))]),f=new Map;for(const v of d)for(const m of ln.decode(v,n.recordBytes)){const g=f.get(m.norad);(!g||Math.abs(m.epochMs-r)<Math.abs(g.epochMs-r))&&f.set(m.norad,m)}const p=[];for(const v of f.values()){const m=Math.abs(v.epochMs-r)/ln.DAY_MS;if(m>ln.MAX_ELEMENT_AGE_DAYS)continue;const g=u[v.norad]??{name:String(v.norad)};g.launch&&Date.parse(`${g.launch}T00:00:00Z`)>r||p.push({norad:v.norad,name:g.name,kind:e,launch:g.launch,stdMag:g.stdMag,elements:v,ageDays:m})}return p}coverageOf(e,t,n,i){const{from:r,to:a}=n.kinds[e],o=t.getTime(),l=ln.MAX_ELEMENT_AGE_DAYS*ln.DAY_MS,c=i?"covered":o<Date.parse(r)-l?"before":o>Date.parse(a)+l?"after":"gap";return{kind:e,status:c,from:r,to:a}}static decode(e,t){const n=new DataView(e),i=[];for(let r=0;r+t<=e.byteLength;r+=t)i.push({norad:n.getUint32(r,!0),epochMs:n.getFloat64(r+4,!0),bstar:n.getFloat32(r+12,!0),inclinationDeg:n.getFloat32(r+16,!0),raanDeg:n.getFloat32(r+20,!0),eccentricity:n.getFloat32(r+24,!0),argOfPerigeeDeg:n.getFloat32(r+28,!0),meanAnomalyDeg:n.getFloat32(r+32,!0),meanMotion:n.getFloat64(r+36,!0)});return i}loadIndex(){return this.index??=(async()=>{for(const e of this.indexUrls)try{const t=await this.fetchImpl(e);if(!t.ok)continue;return{index:await t.json(),base:e}}catch{}})(),this.index}json(e){return this.cached(e,async t=>t.json())}binary(e){return this.cached(e,async t=>t.arrayBuffer())}cached(e,t){let n=this.files.get(e);return n||(n=this.fetchImpl(e).then(i=>{if(!i.ok)throw new Error(`${e}: ${i.status}`);return t(i)}),n.catch(()=>this.files.delete(e)),this.files.set(e,n)),n}}class AE{lowerM;upperM;add(e,t){if(!(e<=0)){if(t.behindM!==void 0){const n=mt.sizeMAt(t.behindM,e);this.lowerM=this.lowerM===void 0?n:Math.max(this.lowerM,n)}if(t.inFrontM!==void 0){const n=mt.sizeMAt(t.inFrontM,e);this.upperM=this.upperM===void 0?n:Math.min(this.upperM,n)}}}get sizeRange(){return{minM:this.lowerM,maxM:this.upperM}}get empty(){return this.lowerM===void 0&&this.upperM===void 0}get contradictory(){return this.lowerM!==void 0&&this.upperM!==void 0&&this.lowerM>this.upperM}distanceRangeAt(e){return e<=0?{}:{minM:this.lowerM===void 0?void 0:mt.distanceMAt(this.lowerM,e),maxM:this.upperM===void 0?void 0:mt.distanceMAt(this.upperM,e)}}clear(){this.lowerM=void 0,this.upperM=void 0}}class Hs{static DEG_PER_SECOND=360/86164.0905;static degOver(e){return Math.max(0,e)*Hs.DEG_PER_SECOND}static instants(e,t){if(!(t>0))return 1;const n=Hs.degOver(e)/t;return n<1?1:Math.min(Hs.MAX_INSTANTS,Math.max(2,Math.ceil(n)))}static MAX_INSTANTS=64}class mn{static EYE={apertureMm:7,exposureSeconds:.1,resolutionArcsec:60};static WAVELENGTH_M=55e-8;static ARCSEC_PER_RADIAN=180*3600/Math.PI;static UNKNOWN_CAMERA_FOCAL_MM=50;static UNKNOWN_CAMERA_DETAIL_UM=20;static get skyDriftArcsecPerSecond(){return Hs.DEG_PER_SECOND*3600}static graspOf(e,t={}){const n=t.exposureSeconds??e.exposureSeconds,i=t.fNumber??e.fNumber;if(n===void 0||i===void 0||!(n>0)||!(i>0))return mn.EYE;const r=t.focalLengthMm??e.frame?.focalLengthMm??mn.UNKNOWN_CAMERA_FOCAL_MM,a=r/i,o=mn.resolutionArcsec(e,r,a);return{apertureMm:a,exposureSeconds:Math.min(n,mn.trailLimitedSeconds(o)),resolutionArcsec:o}}static resolutionArcsec(e,t,n){const r=(e.detailUm??mn.UNKNOWN_CAMERA_DETAIL_UM)/1e3/t*mn.ARCSEC_PER_RADIAN,a=1.22*mn.WAVELENGTH_M/(n/1e3)*mn.ARCSEC_PER_RADIAN;return Math.max(r,a)}static trailLimitedSeconds(e){return e/mn.skyDriftArcsecPerSecond}static gainOverEye(e,t={}){const n=mn.graspOf(e,t),i=mn.EYE,r=(n.apertureMm/i.apertureMm)**2,a=n.exposureSeconds/i.exposureSeconds,o=(i.resolutionArcsec/n.resolutionArcsec)**2;return 1.25*Math.log10(r*a*o)}static gainFor(e,t){const n=t.fieldOfViewDeg===void 0?void 0:kt.focalLengthMmFor(e,t.fieldOfViewDeg);return mn.gainOverEye(e,{fNumber:t.fNumber,focalLengthMm:n,exposureSeconds:t.exposureSeconds})}}const Lp=111320,fa=Math.PI/180,TE=1.02,RE=1;class Ca{static of(e,t){const n=Ca.sightings(e,t);if(n.length<2)return;const i=Ca.baseline(n);if(!i)return;const{near:r,far:a,closedM:o}=i,l=Math.tan(a.widthDeg/2*fa)===0?0:Math.tan(r.widthDeg/2*fa)/Math.tan(a.widthDeg/2*fa);if(l<TE)return;const c=o/(l-1),h=mt.sizeMAt(c,r.widthDeg),u=n.map(d=>({t:d.t,m:mt.distanceMAt(h,d.widthDeg)}));return{widthM:h,distanceM:u,nearestM:Math.min(...u.map(d=>d.m)),fromT:a.t,toT:r.t,closedM:o}}static sightings(e,t){return e.timeline.allKeyframes.flatMap(n=>{const i=n.shapes.find(o=>o.sourceId===t)?.shape,r=i?.angular?.widthDeg,a=Wt(e,n.t);return r===void 0||r<=0||a?.lat===void 0||a.lng===void 0?[]:[{t:n.t,widthDeg:r,lat:a.lat,lng:a.lng,sightAzimuthDeg:i?.aim?.azimuthDeg??a.headingDeg}]}).sort((n,i)=>n.t-i.t)}static baseline(e){let t;for(const n of e)for(const i of e){if(n.t>=i.t)continue;const r=Ca.closedAlongSight(n,i),[a,o,l]=r>=0?[i,n,r]:[n,i,-r];l<RE||a.widthDeg<=o.widthDeg||(!t||l>t.closedM)&&(t={near:a,far:o,closedM:l})}return t}static closedAlongSight(e,t){const n=(t.lat-e.lat)*Lp,i=(t.lng-e.lng)*Lp*Math.cos(e.lat*fa),r=(e.sightAzimuthDeg??0)*fa;return n*Math.cos(r)+i*Math.sin(r)}}class pn{static CONVENTIONAL_M=5;static NEAREST_M=.2;static MARGIN=1.1;static resolve(e){if(e.statedM!==void 0&&e.statedM>0)return{distanceM:pn.atLeastNearest(e.statedM),basis:"stated"};if(e.hypothesisM!==void 0&&e.hypothesisM>0)return{distanceM:pn.atLeastNearest(e.hypothesisM),basis:"hypothesis"};if(e.derivedM!==void 0&&e.derivedM>0)return{distanceM:pn.atLeastNearest(e.derivedM),basis:"derived"};const t=pn.largest(e.range?.minM,e.crossing?.behindM),n=pn.smallest(e.range?.maxM,e.crossing?.inFrontM),i=t===void 0?void 0:t*pn.MARGIN,r=n===void 0?void 0:n/pn.MARGIN;return i!==void 0&&r!==void 0?{distanceM:pn.atLeastNearest(i<=r?Math.sqrt(i*r):i),basis:"bounded"}:i!==void 0?{distanceM:pn.atLeastNearest(i),basis:"bounded"}:r!==void 0&&r<pn.CONVENTIONAL_M?{distanceM:pn.atLeastNearest(r),basis:"bounded"}:{distanceM:pn.CONVENTIONAL_M,basis:"conventional"}}static atLeastNearest(e){return Math.max(pn.NEAREST_M,e)}static largest(...e){const t=e.filter(n=>n!==void 0&&n>0);return t.length===0?void 0:Math.max(...t)}static smallest(...e){const t=e.filter(n=>n!==void 0&&n>0);return t.length===0?void 0:Math.min(...t)}}em();const CE={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"}},DE=["en","fr"],PE={en:"{name} — mag {mag}, {alt}° above the horizon",fr:"{name} — mag {mag}, {alt}° au-dessus de l'horizon"},IE={en:"{name} — satellite, mag {mag}, {height} km up",fr:"{name} — satellite, mag {mag}, à {height} km d'altitude"},LE="satellites-change",NE={en:"{name} — mag {mag}, {alt}° below the horizontal",fr:"{name} — mag {mag}, {alt}° sous l'horizontale"},Np="comet:",OE={building:{en:"Building",fr:"Bâtiment"},tree:{en:"Tree",fr:"Arbre"},crop:{en:"Crop row",fr:"Rang de culture"},mound:{en:"Stone heap",fr:"Tas de pierres"},streetlight:{en:"Streetlight",fr:"Lampadaire"},vehicle:{en:"Vehicle",fr:"Véhicule"},witness:{en:"Witness",fr:"Témoin"},aircraft:{en:"Aircraft",fr:"Aéronef"},entity:{en:"Being",fr:"Être"}},UE=new URL(""+new URL("stars-mag7.5-B43R6Wvg.bin",import.meta.url).href,import.meta.url).href,FE=new URL(""+new URL("stars-mag7.5-9-BLV2tFmZ.bin",import.meta.url).href,import.meta.url).href,kE=-18,zE={sun:{altitudeDeg:-3,azimuthDeg:180,magnitude:-26.7},moon:{altitudeDeg:-90,azimuthDeg:0,phase:{phaseFraction:0,illuminatedFraction:0},magnitude:-12.7},planets:[]},dh={lat:0,lng:0,elevationM:0,headingDeg:void 0,pitchDeg:0,fovDeg:60};class Md extends HTMLElement{static get observedAttributes(){return["src","star-catalog-src","deep-star-catalog-src","show-compass","max-pixel-ratio",Gi,Vi]}shadow;stageElement;frameElement;sceneCanvas;ufoElement;sceneRenderer;hoverTooltip;resizeObserver;sizeEstimates=new Map;sizeEstimatesFor;distanceHypotheses=new Map;depths=new Map;directionScratch=new D;meteorScheduleFor;lastTimeMs=0;lastSkyKey;starCatalog;starCatalogRequest=0;static tleArchive=new ln;satellitesFor;satelliteRequest=0;satelliteStatus="none";satellites;satellitePassesMemo;starCatalogDepth=0;weatherAudio=new bE;animateWhilePausedValue=!1;set animateWhilePaused(e){e!==this.animateWhilePausedValue&&(this.animateWhilePausedValue=e,this.syncAnimationsToPlayback())}get animateWhilePaused(){return this.animateWhilePausedValue}thunderTimeoutId;handleFullscreenChange=()=>this.resizeToStage();handlePointerMove=e=>{this.sceneRenderer.setCompassHovered(!0);const t=this.ufoElement.canvasElement,n=t.getBoundingClientRect();if(n.width===0||n.height===0)return;const i=(e.clientX-n.left)/n.width*t.width,r=(e.clientY-n.top)/n.height*t.height;if(this.ufoElement.hasVisibleShapeAt(i,r)){this.hoverTooltip.hidden=!0;return}const a=(e.clientX-n.left)/n.width*2-1,o=-((e.clientY-n.top)/n.height*2-1),l=Bl(Fr.preferencesFor(this),DE),c=this.sceneRenderer.pickBodyAt(a,o);if(c){this.showHoverTooltip(e,this.bodyName(c,l));return}const h=this.sceneRenderer.pickDecorAt(a,o),u=h?this.ufoElement.sighting.decor.find(p=>p.id===h):void 0;if(u){this.showHoverTooltip(e,this.said.read(u.title)||OE[u.kind][l]);return}const d=this.sceneRenderer.pickSatelliteAt(a,o);if(d){this.showHoverTooltip(e,IE[l].replace("{name}",d.name).replace("{mag}",d.magnitude.toLocaleString(void 0,{maximumFractionDigits:1})).replace("{height}",Math.round(d.heightKm).toLocaleString()));return}const f=this.sceneRenderer.pickStarAt(a,o);if(f){const p=f.star.mag,v=f.altitudeDeg,m=(v<0?NE:PE)[l];this.showHoverTooltip(e,m.replace("{name}",f.star.name[l]).replace("{mag}",p.toLocaleString(void 0,{maximumFractionDigits:Math.abs(p)<1?2:1})).replace("{alt}",String(Math.round(Math.abs(v)))));return}this.hoverTooltip.hidden=!0};bodyName(e,t){const n=e.startsWith(Np)?e.slice(Np.length):void 0;return(n?bg.find(r=>r.id===n):void 0)?.name[t]??CE[e]?.[t]??e}showHoverTooltip(e,t){this.hoverTooltip.textContent=t,this.hoverTooltip.hidden=!1;const n=this.stageElement.getBoundingClientRect();this.hoverTooltip.style.left=`${e.clientX-n.left+12}px`,this.hoverTooltip.style.top=`${e.clientY-n.top+12}px`}handlePointerLeave=()=>{this.hoverTooltip.hidden=!0,this.sceneRenderer.setCompassHovered(!1)};handleLightningFlash=()=>{clearTimeout(this.thunderTimeoutId);const e=(.5+Math.random()*3.5)*1e3;this.thunderTimeoutId=window.setTimeout(()=>this.weatherAudio.playThunder(),e)};handleFirstInteraction=()=>{this.weatherAudio.resume(),this.setWeather(pa(this.ufoElement.sighting,this.lastTimeMs))};handleTimeUpdate=e=>{this.lastTimeMs=e.detail.time,this.syncAnimationsToPlayback(),this.updateAstronomy(this.lastTimeMs),this.ufoElement.playbackState==="playing"&&this.sceneRenderer.frame(performance.now())};syncAnimationsToPlayback(){const e=this.ufoElement.playbackState==="playing",t=e||this.animateWhilePaused;this.sceneRenderer.setAnimationsRunning(t,e),this.weatherAudio.setPaused(!t),t||clearTimeout(this.thunderTimeoutId)}constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${l1}</style>${o1}`,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 zn(this.sceneCanvas,void 0,this.handleLightningFlash),this.hoverTooltip=this.shadow.getElementById("hover-tooltip"),this.ufoElement=document.createElement(mh),this.ufoElement.classList.add("ufo-overlay"),this.ufoElement.paintsShapes=!1,this.forwardPlayerAttributes(),this.ufoElement.addEventListener("lookat",t=>this.lookToward(t.detail)),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.sceneRenderer.onMapSubjectBounds=t=>this.ufoElement.setMapSubjectBounds(t),this.ufoElement.addEventListener("timeupdate",this.handleTimeUpdate),this.ufoElement.addEventListener("referenceview",t=>this.applyReferenceView(t.detail)),this.ufoElement.canvasElement.addEventListener("pointermove",this.handlePointerMove),this.ufoElement.canvasElement.addEventListener("pointerleave",this.handlePointerLeave),this.ufoElement.canvasElement.addEventListener("pointerdown",this.handleFirstInteraction,{once:!0})}get said(){return this.saidTexts??=new xi(Fr.preferencesFor(this))}saidTexts;connectedCallback(){this.saidTexts=void 0,this.sceneRenderer.restoreContext(),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(),clearTimeout(this.thunderTimeoutId),this.weatherAudio.dispose(),queueMicrotask(()=>{this.isConnected||this.sceneRenderer.releaseContext()})}attributeChangedCallback(e,t,n){if(e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),(e==="star-catalog-src"||e==="deep-star-catalog-src")&&n!==t&&this.isConnected&&this.loadStars(),e==="show-compass"&&n!==t&&this.sceneRenderer.setShowCompass(this.hasAttribute("show-compass")),e==="max-pixel-ratio"&&n!==t){const i=Number(n);this.sceneRenderer.setMaxPixelRatio(Number.isFinite(i)&&i>0?i:Math.min(window.devicePixelRatio||1,2))}(e===Gi||e===Vi)&&n!==t&&this.forwardPlayerAttributes()}forwardPlayerAttributes(){for(const e of[Gi,Vi])this.ufoElement.toggleAttribute(e,this.hasAttribute(e))}setCompassForced(e){this.sceneRenderer.setCompassForced(e)}lookToward(e){const t=Wt(this.ufoElement.sighting,this.lastTimeMs);if(e.kind==="witness"||t?.lat===void 0||t.lng===void 0||t.headingDeg===void 0){this.setLookOffset(0,0);return}const{x:n,z:i}=tn(e.lat,e.lng,t.lat,t.lng);if(Math.hypot(n,i)<1)return this.setLookOffset(0,0);const r=(Math.atan2(n,-i)*180/Math.PI+360)%360;this.setLookOffset(((r-t.headingDeg)%360+540)%360-180,-t.pitchDeg)}setLookOffset(e,t){this.sceneRenderer.setLookOffset(e,t),this.ufoElement.setLookOffset(e,t),this.updateAstronomy(this.lastTimeMs)}setIndoorLook(e,t){this.sceneRenderer.setIndoorLook(e,t)}setCloudRendering(e){this.sceneRenderer.setCloudRendering(e)}setWeather(e){this.sceneRenderer.setWeather(e),this.weatherAudio.setAmbient(e.precipitationType,e.precipitationIntensity,e.windSpeed)}pickCloudAt(e,t){return this.sceneRenderer.pickCloudAt(e,t)}cloudDirectionAt(e,t){return this.sceneRenderer.cloudDirectionAt(e,t)}pickDecorAt(e,t){return this.sceneRenderer.pickDecorAt(e,t)}resumeWeatherAudio(){this.weatherAudio.resume()}async loadFromSrc(e){this.sightingData=await fl.json(e)}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.ufoElement.sightingData=e,this.applyFrameFormat(),this.lastTimeMs=0,this.sceneRenderer.compileNextFrameOffThread(),this.updateAstronomy(0)}referenceAspect(e){return this.sceneRenderer.referenceAspect(e)}screenPointOf(e){return this.sceneRenderer.screenPointOf(e)}directionAt(e,t){return this.sceneRenderer.directionAt(e,t)}referenceFailedToLoad(e){return this.sceneRenderer.referenceFailedToLoad(e)}applyReferenceView(e){this.sceneRenderer.setReferencesShown(e.shown);for(const t of this.ufoElement.sighting.references)this.sceneRenderer.setReferenceView(t.id,{opacity:e.opacity})}get currentTerrainAttribution(){return this.sceneRenderer.currentTerrainAttribution}setTerrainProviders(e){this.sceneRenderer.setTerrainProviders(e)}setDecorModelProvider(e){this.sceneRenderer.setDecorModelProvider(e)}get decorModelCredits(){return this.sceneRenderer.currentDecorModelCredits}applyFrameFormat(){const e=this.ufoElement.sighting.instrument,t=mt.CANVAS_HEIGHT_PX,n=kt.frameWidthPx(e,t);this.frameElement.style.setProperty("--frame-aspect",`${n} / ${t}`)}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=[{magnitudeLimit:ch,url:this.getAttribute("star-catalog-src")??UE},{magnitudeLimit:hh,url:this.getAttribute("deep-star-catalog-src")??FE}],t=this.instrumentReach(),n=++this.starCatalogRequest;this.starCatalogDepth=t>ch?hh:ch;const i=await fi.upTo(e,t);n===this.starCatalogRequest&&(this.starCatalog=i,this.sceneRenderer.compileNextFrameOffThread(),this.updateAstronomy(this.lastTimeMs))}ensureStarsDeepEnough(){!this.starCatalog||this.starCatalogDepth>=hh||this.instrumentReach()<=this.starCatalogDepth||this.loadStars()}instrumentReach(){const e=this.ufoElement.sighting,t=mn.gainFor(e.instrument,{fNumber:Wt(e,0)?.fNumber,fieldOfViewDeg:Hn.fovOf(e,0),exposureSeconds:e.exposure});return pu(kE,t)}updateAstronomy(e){this.ensureStarsDeepEnough(),this.applySceneAt(e);const t=Zn.windowEndingAt(e,this.exposureSeconds()),n=t.seconds,i=this.degreesPerPixelAt(e),r=Hs.instants(n,i),a=Math.max(r,this.ufoElement.exposureTimes(e).length,Zn.instants(this.ufoElement.sighting.decor,Wt(this.ufoElement.sighting,e)?.elevationM??0,t.fromMs,n,i));if(a<=1){this.sceneRenderer.setExposure(1);return}this.sceneRenderer.setExposure(a,o=>this.applySceneAt(t.fromMs+t.ms*o/(a-1),{sky:Math.floor(o*r/a)!==Math.floor((o-1)*r/a),stepMs:t.ms/a}))}exposureSeconds(){return this.ufoElement.sighting.exposure??0}degreesPerPixelAt(e){const t=this.sceneCanvas.height;return t<=0?0:Hn.fovOf(this.ufoElement.sighting,e)/t}applySceneAt(e,t){const n=this.ufoElement.sighting;this.setWeather(pa(n,e)),this.sceneRenderer.setInstrument(n.instrument),this.updateMeteorShower(n,e),this.sceneRenderer.setDecor(n.decor),this.sceneRenderer.setReferences(n.references);const i=Wt(n,e),r=Wt(n,0),a=pa(n,0),o=Object.fromEntries(pl(pa(n,e)).map(w=>[w.id,kd(e,n.weatherTrack,a,r,i,w.id)]));this.sceneRenderer.setCloudOffset(kd(e,n.weatherTrack,a,r,i),o),this.sceneRenderer.setObserverPose(i??dh),this.sceneRenderer.setLensOptics(this.lensOpticsAt(e)),this.sceneRenderer.setInstrumentGain(mn.gainFor(n.instrument,{fNumber:i?.fNumber,fieldOfViewDeg:Hn.fovOf(n,e),exposureSeconds:n.exposure})),this.sceneRenderer.setGait(Vt.of(n)?.offsetAt(e)??Vt.STILL),this.sceneRenderer.updateDecorAnchoring(Wt(n,0),i,e),this.sceneRenderer.updateDecorLitState(e,t?.stepMs??0),this.sceneRenderer.setTerrainOrigin(i?.lat,i?.lng),this.pushPhenomenaAt(e);const l=i?.lat??dh.lat,c=i?.lng??dh.lng,h=dl(n.event.time??{},c,n.event.utcOffsetHours),u={lat:l,lng:c,elevationM:i?.elevationM??0};if(this.pushSatellitesAt(h,e,u),t&&!t.sky)return;if(!h){this.sceneRenderer.setAstronomy(zE);return}const d=new Date(h.getTime()+e),f=Math.max(1,Math.round(.25*this.degreesPerPixelAt(e)/Hs.DEG_PER_SECOND*1e3)),p=Math.max(1e-8,this.degreesPerPixelAt(e)*.1),v=`${Math.floor(d.getTime()/f)}|${Math.round(l/p)}|${Math.round(c/p)}|${Math.round(u.elevationM)}|${this.starCatalog?this.starCatalogDepth:0}`;if(v===this.lastSkyKey){this.sceneRenderer.render();return}this.lastSkyKey=v;const m={...Wc("Sun",d,u),magnitude:Xc("Sun",d)},g={...Wc("Moon",d,u),phase:Pb(d),magnitude:Xc("Moon",d)},S=Db.map(w=>({body:w,position:Wc(w,d,u),magnitude:Xc(w,d)}));this.sceneRenderer.setAstronomy({sun:m,moon:g,planets:S,comet:this.cometAt(d,u),stars:this.starCatalog?{catalog:this.starCatalog,date:d,observer:u}:void 0,frame:{date:d,observer:u}}),this.ufoElement.setSunAltitude(m.altitudeDeg)}pushSatellitesAt(e,t,n){if(this.ensureSatellites(e),!e||!this.satellites){this.sceneRenderer.setSatellites([]);return}const i=new Date(e.getTime()+t),r=[];for(const a of this.satellites.passes.positionsAt(i,n,-1))a.magnitude!==void 0&&r.push({norad:a.object.norad,name:a.object.name,position:{altitudeDeg:a.altitudeDeg,azimuthDeg:a.azimuthDeg},magnitude:a.magnitude,heightKm:a.heightKm});this.sceneRenderer.setSatellites(r)}ensureSatellites(e){const t=e?String(e.getTime()):"";if(t===this.satellitesFor)return;this.satellitesFor=t,this.satellites=void 0,this.satellitePassesMemo=void 0;const n=++this.satelliteRequest;if(!e){this.satelliteStatus="none";return}this.satelliteStatus="loading";const i=a=>{n===this.satelliteRequest&&(this.satelliteStatus=a,this.dispatchEvent(new CustomEvent(LE)))},r=Md.tleArchive;(async()=>{if(!await r.covers(e))return i("outside");const[a,o]=await Promise.all([r.at(e),Xi(()=>import("./SatellitePasses-Pfro2-0Z.js"),[],import.meta.url)]);if(n===this.satelliteRequest){if(!a)return i("unavailable");this.satellites={snapshot:a,passes:new o.SatellitePasses(a.objects)},i("ready"),this.updateAstronomy(this.lastTimeMs)}})().catch(()=>i("unavailable"))}get satelliteState(){const e=this.satellites?.snapshot;return{status:this.satelliteStatus,coverage:e?.coverage,credit:e?.credit,creditUrl:e?.creditUrl}}satellitePassesDuring(e){const t=this.satellites,n=this.ufoElement.sighting,i=Wt(n,0),r=n.event.place?.[0],a=i?.lat??r?.lat,o=i?.lng??r?.lng;if(!t||a===void 0||o===void 0)return[];const l=dl(n.event.time??{},o,n.event.utcOffsetHours);if(!l)return[];const c=Math.min(Math.max(e,0),4*36e5),h={lat:a,lng:o,elevationM:i?.elevationM??0},u=JSON.stringify([this.satellitesFor,l.getTime(),a,o,h.elevationM,c]);if(this.satellitePassesMemo?.key===u)return this.satellitePassesMemo.passes;const d=Math.max(10,Math.ceil(c/1e3/600)),f=t.passes.passesDuring(l,new Date(l.getTime()+c),h,d);return this.satellitePassesMemo={key:u,passes:f},f}cometAt(e,t){const n=wE.brightestAt(e,t);if(n)return{id:n.apparition.id,position:n.position,tailEnd:n.tailEnd,magnitude:n.magnitude}}pushPhenomenaAt(e){const t=this.ufoElement.sighting;t!==this.sizeEstimatesFor&&(this.sizeEstimates.clear(),this.distanceHypotheses.clear(),this.sizeEstimatesFor=t);const n=t.timeline,i=this.ufoElement.canvasElement,r=this.ufoElement.frameShiftPx,a=this.projectionAt(e),o=new Map,l=new Map,c=new Set;for(const p of n.sourceIds){const v=n.getInterpolatedShapeAt(e,p);if(!v)continue;const m={...v,bounds:{...v.bounds,x:v.bounds.x+r.x,y:v.bounds.y+r.y}};o.set(p,m);const g=v.aim?this.sceneRenderer.screenPointOf($n.directionOf(v.aim,this.directionScratch)):{ndcX:(m.bounds.x+m.bounds.width/2)/i.width*2-1,ndcY:-((m.bounds.y+m.bounds.height/2)/i.height*2-1)},S=g!==void 0&&Math.abs(g.ndcX)<=1&&Math.abs(g.ndcY)<=1,w=S?this.sceneRenderer.decorDistancesAt(g.ndcX,g.ndcY,p):{};c.add(p),(S||v.aim)&&c.delete(p);const y=v.angular?.widthDeg??a.pxToDeg(v.bounds.width),b=this.sizeEstimateOf(p);b.add(y,w);const E=Ca.of(t,p);l.set(p,pn.resolve({hypothesisM:this.distanceHypotheses.get(p),derivedM:E&&y>0?mt.distanceMAt(E.widthM,y):void 0,range:b.distanceRangeAt(y),crossing:w}))}for(const[p,v]of o)for(const[m,g]of o){if(m===p||g.transparency>=1||g.bounds.width*g.bounds.height<=v.bounds.width*v.bounds.height||!(v.bounds.x>=g.bounds.x&&v.bounds.y>=g.bounds.y&&v.bounds.x+v.bounds.width<=g.bounds.x+g.bounds.width&&v.bounds.y+v.bounds.height<=g.bounds.y+g.bounds.height))continue;const w=l.get(m);w&&l.set(p,{distanceM:w.distanceM*.999,basis:w.basis});break}this.depths=l;const h=n.sourceIds,u=[];for(const[p,v]of o)u.push({sourceId:p,shape:v,distanceM:l.get(p).distanceM,renderOrder:h.indexOf(p),aim:v.aim,hidden:c.has(p)});const f=(Wt(t,e)?.rollDeg??0)+(Vt.of(t)?.offsetAt(e)??Vt.STILL).rollDeg;this.sceneRenderer.setPhenomena(u,{projection:a,canvasWidthPx:i.width,canvasHeightPx:i.height,scale:Math.max(1,this.sceneCanvas.height/Math.max(1,i.height)),starPoints:kt.starPointsOf(t.instrument),rollRad:f*Math.PI/180})}setDistanceHypothesis(e,t){t===void 0||!(t>0)?this.distanceHypotheses.delete(e):this.distanceHypotheses.set(e,t),this.updateAstronomy(this.lastTimeMs)}depthOf(e){return this.depths.get(e)}sizeRangeOf(e){return this.sizeEstimateOf(e).sizeRange}distanceRangeAt(e,t){const n=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(t,e);if(!n)return{};const i=n.angular?.widthDeg??this.projectionAt(t).pxToDeg(n.bounds.width);return this.sizeEstimateOf(e).distanceRangeAt(i)}sizeContradictory(e){return this.sizeEstimateOf(e).contradictory}updateMeteorShower(e,t){this.ensureMeteorSchedule(e),this.sceneRenderer.updateMeteors(t)}ensureMeteorSchedule(e){const t=this.meteorInputsOf(e);t!==this.meteorScheduleFor&&(this.meteorScheduleFor=t,this.scheduleMeteors(e))}meteorInputsOf(e){const t=e.event.place?.[0],n=e.event.time;return JSON.stringify([t?.lat,t?.lng,n?.year,n?.month,n?.day,n?.hour,n?.minute,e.event.utcOffsetHours,e.event.durationSeconds,e.timeline.duration])}scheduleMeteors(e){const t=e.event.place?.[0],n=e.event.time,i=t?.lat!==void 0&&t.lng!==void 0&&n?.year!==void 0?dl(n,t.lng,e.event.utcOffsetHours):void 0;if(!i||t?.lat===void 0||t.lng===void 0){this.sceneRenderer.setMeteorShower([],0,0);return}const r={lat:t.lat,lng:t.lng,elevationM:0},a=(e.event.durationSeconds??0)*1e3||e.timeline.duration||2e4,o=Math.round(i.getTime()/1e3)+Math.round(t.lat*1e3),l=It.schedule({ratePerHour:It.observedRatePerHour(It.apexPosition(i,r).altitudeDeg),durationMs:a,velocityKmS:It.TYPICAL_VELOCITY_KM_S,seed:o}),c=uh.activeAt(i).map(u=>{const d=uh.radiantPosition(u.shower,i,r);return{entry:u,position:d,rate:uh.observedRatePerHour(u.zhr,d.altitudeDeg,u.shower.populationIndex)}}).sort((u,d)=>d.rate-u.rate)[0];if(!c||c.rate<=0){this.sceneRenderer.setMeteorShower(l,0,0);return}const h=Bs.schedule({ratePerHour:c.rate,durationMs:a,velocityKmS:c.entry.shower.velocityKmS,seed:o+1});this.sceneRenderer.setMeteorShower([...h,...l],c.position.altitudeDeg,c.position.azimuthDeg)}meteorByRank(e){this.ensureMeteorSchedule(this.ufoElement.sighting);const t=[...this.sceneRenderer.meteorSchedule].filter(r=>r.t+r.durationMs<=this.ufoElement.seekableDuration).sort((r,a)=>a.brightness-r.brightness);if(t.length===0)return;const n=t[e%t.length],i=this.sceneRenderer.meteorMidpoint(n);if(i)return{t:Math.round(n.t+n.durationMs*.45),...i}}lensOpticsAt(e){const t=this.ufoElement.sighting,n=t.instrument,i=n.frame,r=Wt(t,e),a=r?.fNumber??n.fNumber;if(!i||a===void 0)return;const o=kt.focalLengthMmFor(n,Hn.fovOf(t,e));if(o!==void 0)return{focalLengthMm:o,fNumber:a,focusDistance:r?.focusDistanceM??0,frameHeightMm:i.heightMm}}projectionAt(e){const t=this.ufoElement.sighting;return Bi.of(t.instrument,mt.CANVAS_HEIGHT_PX,Hn.fovOf(t,e))}sizeEstimateOf(e){let t=this.sizeEstimates.get(e);return t||(t=new AE,this.sizeEstimates.set(e,t)),t}}const ku="rr0-scene";function wg(){em(),customElements.get(ku)||customElements.define(ku,Md)}const BE={color:"Color",transparency:"Transparency",halo:"Halo",blur:"Blur",brightness:"Brilliance",shapeTitle:"Name",utcOffset:"Time zone",cloudBase:"Cloud base",elevation:"Altitude",heightAboveGround:"Height above ground",duration:"Duration",placeName:"Place",latitude:"Latitude",longitude:"Longitude",heading:"Heading",pitch:"Tilt",roll:"Roll",observationTime:"Observation start",observationEndTime:"Observation end",assessmentGroup:"Assessment",assessmentNames:{coverage:"Witness info"},assessmentVerdicts:{"hynek.nl":"NL — nocturnal light","hynek.dd":"DD — daylight disc","hynek.rv":"RV — radar-visual","hynek.ce1":"CE1 — close encounter","hynek.ce2":"CE2 — with a physical trace","hynek.ce3":"CE3 — with entities"},witnessGroup:"Witness",witnessId:"ID",witnessTitle:"Title",witnessLastName:"Last name",witnessFirstNames:"First names",caseId:"Case ID",tags:"Tags",cloudCover:"Cloud cover",highCloudCover:"Ice cloud (cirrus)",focalLength:"Focal length",fieldOfView:"Field of view",aperture:"Aperture",exposure:"Exposure",focusDistance:"Focused at",iceCrystalAlignment:"Crystal alignment",cloudDarkness:"Cloud darkness",precipitationType:"Precipitation",precipitationNone:"None",precipitationRain:"Rain",precipitationSnow:"Snow",precipitationHail:"Hail",precipitationIntensity:"Intensity",windDirection:"Wind direction",windSpeed:"Wind speed",storm:"Storm",cloudsGroup:"Clouds",precipitationGroup:"Precipitation",windGroup:"Wind",soundKind:"Sound",soundNone:"None (silent)",soundHum:"Hum",soundWhistle:"Whistle",soundRumble:"Rumble",soundCrackle:"Crackle",soundVolume:"Loudness",soundPitch:"Pitch",soundSrc:"Recording",instrument:"Observed through",decorAircraft:"Aircraft",decorEntity:"Being",decorAltitude:"Altitude",decorLights:"Lights",decorLightsNone:"none",decor:"Environment",decorBuilding:"Building",decorTree:"Tree",decorCrop:"Crop row",decorMound:"Stone heap",decorStreetlight:"Streetlight",decorVehicle:"Vehicle",decorWitness:"Other witness",decorEast:"Distance east",decorNorth:"Distance north",decorHeading:"Heading",decorColor:"Colour",decorLit:"Lit",decorTitle:"Name",milestones:"Moments",milestoneLabel:"Label",milestoneNote:"What happens",addMilestone:"Name this moment",deleteMilestone:"Delete moment",confirmAccept:"Delete",confirmDecline:"Cancel",decorWidth:"Width",decorLength:"Length",decorHeight:"Height",decorModel:"3D model",decorModelNone:"Built-in shape",decorModelAdvanced:"Model from an address",decorModelUrl:"glTF/GLB address",decorModelTitle:"Model name",decorModelAuthor:"Author",decorModelLicense:"Licence",decorModelSource:"Where it came from",decorFloors:"Floors",decorOccupiedFloor:"Occupied floor",decorWitnessSide:"Witness location",decorWitnessSideNone:"Not present",decorWindows:"Windows",decorSideFront:"Front",decorSideBehind:"Behind",decorSideLeft:"Left",decorSideRight:"Right",decorSideFrontLeft:"Front-left",decorSideFrontRight:"Front-right",decorSideBehindLeft:"Behind-left",decorSideBehindRight:"Behind-right"},zu={...BE,testimonyBy:"Testimony by",unnamedWitness:"Witness {n}",about:"About",close:"Close",observation:"Observation",date:"Date",location:"Location",case:"Case",description:"Description",credits:"Credits",editThisObservation:"Edit this observation",embed:"Embed",embedReplay:"Replay",embedEdit:"Editor",embedCopy:"Copy",embedCopied:"Copied",showLabels:"Show what it states",hideLabels:"Hide what it states"},HE=Object.freeze(Object.defineProperty({__proto__:null,sightingMessages_en:zu},Symbol.toStringTag,{value:"Module"}));wg();const GE="“Thunder” by Jerimee",VE="https://creativecommons.org/licenses/by/3.0/",WE="CC BY 3.0",XE="https://ufoathome.org",Op=`${XE}/edit/`;class Eg extends HTMLElement{static get observedAttributes(){return["src","show-labels",Gi,Vi]}shadow;sceneElement;toolbarElement;testimonyElement;testimonyPrefix;witnessText;witnessSelect;infoButton;infoPanel;infoAppLink;infoObservationHeading;infoObservationList;infoCreditsToggle;infoCreditsList;infoCloseButton;infoEmbedToggle;infoEmbedPanel;embedReplayRadio;embedEditRadio;labelEmbedReplay;labelEmbedEdit;embedMarkup;embedCopyButton;labelsToggle;paramSummary;summaryBuilder=new Ud(zu,"en",new xi(["en"]),new tl({}));summarySignature="";assessmentEntries=[];assessmentToken=0;supportsPopover=typeof HTMLElement.prototype.showPopover=="function";entries=[];currentSrc;infoOpen=!1;creditsOpen=!1;embedOpen=!1;labelsShown=!1;language="en";messages=zu;constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${Ng}</style>${Lg}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.sceneElement=document.createElement(ku),this.forwardPlayerAttributes(),this.sceneElement.ufoElement.creditShownExternally=!0,this.sceneElement.ufoElement.hostControls(this.shadow.getElementById("scene-controls")),this.shadow.getElementById("ufo-slot").replaceWith(this.sceneElement),this.toolbarElement=this.shadow.getElementById("toolbar"),this.testimonyElement=this.shadow.getElementById("testimony"),this.testimonyPrefix=this.shadow.getElementById("testimony-prefix"),this.witnessText=this.shadow.getElementById("witness-text"),this.witnessSelect=this.shadow.getElementById("witness"),this.infoButton=this.shadow.getElementById("info-button"),this.infoPanel=this.shadow.getElementById("info-panel"),this.infoAppLink=this.shadow.getElementById("info-app-link"),this.infoObservationHeading=this.shadow.getElementById("info-observation-heading"),this.infoObservationList=this.shadow.getElementById("info-observation-list"),this.infoCreditsToggle=this.shadow.getElementById("info-credits-toggle"),this.infoCreditsList=this.shadow.getElementById("info-credits-list"),this.infoCloseButton=this.shadow.getElementById("info-close"),this.labelsToggle=this.shadow.getElementById("info-labels-toggle"),this.paramSummary=this.shadow.getElementById("param-summary"),this.labelsToggle.addEventListener("click",()=>{this.showLabels=!this.showLabels}),this.infoEmbedToggle=this.shadow.getElementById("info-embed-toggle"),this.infoEmbedPanel=this.shadow.getElementById("info-embed"),this.embedReplayRadio=this.shadow.getElementById("embed-kind-replay"),this.embedEditRadio=this.shadow.getElementById("embed-kind-edit"),this.labelEmbedReplay=this.shadow.getElementById("label-embed-replay"),this.labelEmbedEdit=this.shadow.getElementById("label-embed-edit"),this.embedMarkup=this.shadow.getElementById("embed-markup"),this.embedCopyButton=this.shadow.getElementById("embed-copy"),this.witnessSelect.addEventListener("change",()=>this.selectWitness(this.witnessSelect.value)),this.sceneElement.ufoElement.addEventListener("timeupdate",()=>this.refreshParamSummary()),this.supportsPopover?(this.infoPanel.setAttribute("popover","auto"),this.infoPanel.removeAttribute("hidden"),this.infoButton.setAttribute("popovertarget","info-panel"),this.infoPanel.addEventListener("beforetoggle",t=>{t.newState==="open"&&(this.populateInfoPanel(),this.bringInfoButtonIntoView())}),this.infoPanel.addEventListener("toggle",t=>this.syncInfoOpen(t.newState==="open"))):this.infoButton.addEventListener("click",()=>this.toggleInfoPanel()),this.infoCloseButton.addEventListener("click",()=>this.toggleInfoPanel()),this.infoCreditsToggle.addEventListener("click",()=>this.toggleCredits()),this.infoEmbedToggle.addEventListener("click",()=>this.toggleEmbed());for(const t of[this.embedReplayRadio,this.embedEditRadio])t.addEventListener("change",()=>this.refreshEmbedMarkup());this.embedCopyButton.addEventListener("click",()=>void this.copyEmbedMarkup()),this.loadLocaleMessages()}get scene(){return this.sceneElement}async loadLocaleMessages(){this.language=Bl(Fr.preferencesFor(this),qp),this.language!=="en"&&(this.messages=await A1(this.language),this.testimonyPrefix.textContent=this.messages.testimonyBy,this.infoButton.title=this.messages.about,this.infoButton.setAttribute("aria-label",this.messages.about),this.infoCloseButton.setAttribute("aria-label",this.messages.close),this.infoObservationHeading.textContent=this.messages.observation,this.infoCreditsToggle.textContent=this.messages.credits,this.tags=new tl(await T1(this.language)),this.summaryBuilder=new Ud(this.messages,this.language==="fr"?"fr":"en",this.said,this.tags),this.syncLabelsToggle(),this.refreshParamSummary(),this.currentSrc&&this.runAssessments(),this.infoEmbedToggle.textContent=this.messages.embed,this.labelEmbedReplay.textContent=this.messages.embedReplay,this.labelEmbedEdit.textContent=this.messages.embedEdit,this.embedCopyButton.textContent=this.messages.embedCopy,this.infoOpen&&this.populateInfoPanel(),this.updateTestimonyLine())}get said(){return this.saidTexts??=new xi(Fr.preferencesFor(this))}saidTexts;tags=new tl({});connectedCallback(){this.saidTexts=void 0;const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick)}attributeChangedCallback(e,t,n){e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),e==="show-labels"&&this.applyLabels(this.hasAttribute("show-labels")),(e===Gi||e===Vi)&&this.forwardPlayerAttributes()}forwardPlayerAttributes(){for(const e of[Gi,Vi])this.sceneElement.toggleAttribute(e,this.hasAttribute(e))}async loadFromSrc(e){const t=await fl.json(e);Array.isArray(t)?await this.loadWitnessUrls(t.map(n=>new URL(n,new URL(e,location.href)).href)):this.setEntries([{src:e,sighting:t}])}get sightingData(){return this.entries.find(e=>e.src===this.currentSrc)?.sighting}set sightingData(e){this.currentSrc="",this.setEntries([{src:"",sighting:e}])}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 n=>({src:n,sighting:await fl.json(n)})));this.setEntries(t)}setEntries(e){this.entries=e,this.warnOnMismatchedCaseIds(e),this.toolbarElement.hidden=e.length===0;const t=e.length>1;this.witnessSelect.hidden=!t,this.witnessText.hidden=t,this.witnessSelect.innerHTML="";for(const i of e){const r=document.createElement("option");r.value=i.src,r.textContent=this.witnessDisplayName(i.sighting.witness)??this.messages.unnamedWitness.replace("{n}",String(e.indexOf(i)+1)),this.witnessSelect.appendChild(r)}const n=e.find(i=>i.src===this.currentSrc)??e[0];n?this.selectWitness(n.src):this.updateTestimonyLine()}editorUrl(){if(!this.currentSrc)return Op;const e=new URL(this.currentSrc,location.href);return`${Op}?sighting=${encodeURIComponent(e.href)}`}embedMarkupFor(e){const t=e==="edit"?"rr0-sighting-editor":"rr0-sighting",n=new URL(`${t}.mjs`,import.meta.url).href,i=this.currentSrc?new URL(this.currentSrc,location.href).href:"";return`<script type="module" src="${n}"><\/script>
|
|
6423
|
-
<${t} src="${i}"></${t}>`}refreshEmbedMarkup(){this.embedMarkup.value=this.embedMarkupFor(this.embedEditRadio.checked?"edit":"replay")}async copyEmbedMarkup(){try{await navigator.clipboard.writeText(this.embedMarkup.value),this.embedCopyButton.textContent=this.messages.embedCopied,window.setTimeout(()=>this.embedCopyButton.textContent=this.messages.embedCopy,1500)}catch{this.embedMarkup.select()}}warnOnMismatchedCaseIds(e){const t=new Set(e.map(n=>n.sighting.caseId).filter(n=>n!==void 0));t.size>1&&console.warn(`<rr0-sighting>: witnesses declare different case ids (${[...t].join(", ")}) — they may not belong to the same case.`)}selectWitness(e){const t=this.entries.find(n=>n.src===e);t&&(this.currentSrc=e,this.witnessSelect.value=e,this.sceneElement.sightingData=t.sighting,this.updateTestimonyLine(),this.refreshParamSummary(),this.runAssessments(),this.infoOpen&&this.populateInfoPanel())}async runAssessments(){const e=++this.assessmentToken,t=await new a1(this.messages).read(this.sceneElement.ufoElement.sighting);e===this.assessmentToken&&(this.assessmentEntries=t.entries,this.refreshParamSummary())}updateTestimonyLine(){const e=this.entries.find(i=>i.src===this.currentSrc),t=e?this.witnessDisplayName(e.sighting.witness):void 0,n=t!==void 0||this.entries.length>1;this.testimonyElement.hidden=!n,this.witnessText.textContent=t??""}witnessDisplayName(e){if(!e)return;const t=[...e.firstNames??[],e.lastName].filter(Boolean).join(" ");return e.title||t||e.id||e.dirName}formatDate(e){const t=e.place?.[0],n=dl(e.time??{},t?.lng??0,e.utcOffsetHours);if(!n)return;const i=n.getTime()+this.utcOffsetHoursOf(e,t?.lng??0)*36e5;return new Intl.DateTimeFormat(this.language==="fr"?"fr-FR":"en-US",{dateStyle:"long",timeStyle:"short",timeZone:"UTC"}).format(new Date(i))}utcOffsetHoursOf(e,t){return e.utcOffsetHours??Math.round(t/15)}formatLocation(e){const t=e.place?.[0];if(t)return`${t.lat.toFixed(4)}, ${t.lng.toFixed(4)}`}toggleInfoPanel(){const e=!this.infoOpen;if(this.supportsPopover){const t=this.infoPanel.matches(":popover-open");e&&!t?this.infoPanel.showPopover():!e&&t&&this.infoPanel.hidePopover();return}e&&this.bringInfoButtonIntoView(),this.syncInfoOpen(e),this.infoPanel.hidden=!e,e?document.addEventListener("click",this.handleOutsideClick):document.removeEventListener("click",this.handleOutsideClick)}bringInfoButtonIntoView(){const e=this.infoButton.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;e.top>=0&&e.bottom<=t||this.infoButton.scrollIntoView({block:"center"})}syncInfoOpen(e){e!==this.infoOpen&&(this.infoOpen=e,this.infoButton.setAttribute("aria-expanded",String(e)),e?this.supportsPopover||this.populateInfoPanel():(this.creditsOpen=!1,this.infoCreditsList.hidden=!0,this.infoCreditsToggle.setAttribute("aria-expanded","false"),this.embedOpen=!1,this.infoEmbedPanel.hidden=!0,this.infoEmbedToggle.setAttribute("aria-expanded","false")))}handleOutsideClick=e=>{const t=e.composedPath();!t.includes(this.infoPanel)&&!t.includes(this.infoButton)&&this.toggleInfoPanel()};toggleCredits(){this.creditsOpen=!this.creditsOpen,this.infoCreditsList.hidden=!this.creditsOpen,this.infoCreditsToggle.setAttribute("aria-expanded",String(this.creditsOpen)),this.creditsOpen&&this.revealInPanel(this.infoCreditsList)}toggleEmbed(){this.embedOpen=!this.embedOpen,this.infoEmbedPanel.hidden=!this.embedOpen,this.infoEmbedToggle.setAttribute("aria-expanded",String(this.embedOpen)),this.embedOpen&&(this.refreshEmbedMarkup(),this.revealInPanel(this.infoEmbedPanel))}revealInPanel(e){e.scrollIntoView?.({block:"nearest"})}get showLabels(){return this.labelsShown}set showLabels(e){this.toggleAttribute("show-labels",e)}applyLabels(e){this.labelsShown=e,this.syncLabelsToggle(),this.refreshParamSummary(),this.populateInfoPanel()}syncLabelsToggle(){this.labelsToggle.textContent=this.labelsShown?this.messages.hideLabels:this.messages.showLabels,this.labelsToggle.setAttribute("aria-pressed",String(this.labelsShown))}refreshParamSummary(){if(this.paramSummary.hidden=!this.labelsShown,!this.labelsShown){this.paramSummary.replaceChildren(),this.summarySignature="";return}const e=this.sceneElement.ufoElement.sighting,t=[...this.summaryBuilder.entriesFor(e,this.sceneElement.ufoElement.currentTime),...this.assessmentEntries],n=t.map(a=>`${a.field}=${a.label}=${a.value}${a.unit}${a.fromSource?"*":""}`).join("|");if(n===this.summarySignature)return;this.summarySignature=n;const i=[];let r;for(const a of t){r&&r.group!==a.group&&(r=void 0);const o=a.group==="witness"?this.messages.witnessGroup:a.group==="assessment"?this.messages.assessmentGroup:void 0;if(o!==void 0&&!r){const c=document.createElement("span");c.className="param-nest";const h=document.createElement("span");h.className="param-nest-label",h.textContent=o,c.append(h),r={group:a.group,element:c},i.push(c)}const l=this.paramItem(a);r?r.element.append(l):i.push(l)}this.paramSummary.replaceChildren(...i)}paramItem(e){const t=document.createElement("span");t.className=e.fromSource?"param-label from-source":"param-label";const n=document.createElement("span");if(n.className="param-label-label",n.textContent=`${e.label} `,t.append(n),e.color!==void 0){const r=document.createElement("span");r.className="param-label-swatch",r.style.background=e.color,t.append(r)}const i=document.createElement("span");return i.className="param-label-value",i.textContent=e.unit===""?e.value:`${e.value} ${e.unit}`,t.append(i),t}populateInfoPanel(){const e=this.entries.find(o=>o.src===this.currentSrc);if(this.infoObservationList.innerHTML="",e){if(!this.labelsShown){const l=this.formatDate(e.sighting);l&&this.appendInfoRow(this.infoObservationList,this.messages.date,l);const c=this.formatLocation(e.sighting);c&&this.appendInfoRow(this.infoObservationList,this.messages.location,c),e.sighting.caseId&&this.appendInfoRow(this.infoObservationList,this.messages.case,e.sighting.caseId)}const o=this.said.read(e.sighting.description);o&&this.appendInfoRow(this.infoObservationList,this.messages.description,o),!this.labelsShown&&e.sighting.tags&&e.sighting.tags.length>0&&this.appendInfoRow(this.infoObservationList,this.messages.tags,e.sighting.tags.map(l=>this.tags.name(l)).join(", "))}this.refreshEmbedMarkup(),this.infoAppLink.href=this.editorUrl(),this.infoAppLink.textContent="UFO@home v0.60.
|
|
6423
|
+
<${t} src="${i}"></${t}>`}refreshEmbedMarkup(){this.embedMarkup.value=this.embedMarkupFor(this.embedEditRadio.checked?"edit":"replay")}async copyEmbedMarkup(){try{await navigator.clipboard.writeText(this.embedMarkup.value),this.embedCopyButton.textContent=this.messages.embedCopied,window.setTimeout(()=>this.embedCopyButton.textContent=this.messages.embedCopy,1500)}catch{this.embedMarkup.select()}}warnOnMismatchedCaseIds(e){const t=new Set(e.map(n=>n.sighting.caseId).filter(n=>n!==void 0));t.size>1&&console.warn(`<rr0-sighting>: witnesses declare different case ids (${[...t].join(", ")}) — they may not belong to the same case.`)}selectWitness(e){const t=this.entries.find(n=>n.src===e);t&&(this.currentSrc=e,this.witnessSelect.value=e,this.sceneElement.sightingData=t.sighting,this.updateTestimonyLine(),this.refreshParamSummary(),this.runAssessments(),this.infoOpen&&this.populateInfoPanel())}async runAssessments(){const e=++this.assessmentToken,t=await new a1(this.messages).read(this.sceneElement.ufoElement.sighting);e===this.assessmentToken&&(this.assessmentEntries=t.entries,this.refreshParamSummary())}updateTestimonyLine(){const e=this.entries.find(i=>i.src===this.currentSrc),t=e?this.witnessDisplayName(e.sighting.witness):void 0,n=t!==void 0||this.entries.length>1;this.testimonyElement.hidden=!n,this.witnessText.textContent=t??""}witnessDisplayName(e){if(!e)return;const t=[...e.firstNames??[],e.lastName].filter(Boolean).join(" ");return e.title||t||e.id||e.dirName}formatDate(e){const t=e.place?.[0],n=dl(e.time??{},t?.lng??0,e.utcOffsetHours);if(!n)return;const i=n.getTime()+this.utcOffsetHoursOf(e,t?.lng??0)*36e5;return new Intl.DateTimeFormat(this.language==="fr"?"fr-FR":"en-US",{dateStyle:"long",timeStyle:"short",timeZone:"UTC"}).format(new Date(i))}utcOffsetHoursOf(e,t){return e.utcOffsetHours??Math.round(t/15)}formatLocation(e){const t=e.place?.[0];if(t)return`${t.lat.toFixed(4)}, ${t.lng.toFixed(4)}`}toggleInfoPanel(){const e=!this.infoOpen;if(this.supportsPopover){const t=this.infoPanel.matches(":popover-open");e&&!t?this.infoPanel.showPopover():!e&&t&&this.infoPanel.hidePopover();return}e&&this.bringInfoButtonIntoView(),this.syncInfoOpen(e),this.infoPanel.hidden=!e,e?document.addEventListener("click",this.handleOutsideClick):document.removeEventListener("click",this.handleOutsideClick)}bringInfoButtonIntoView(){const e=this.infoButton.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;e.top>=0&&e.bottom<=t||this.infoButton.scrollIntoView({block:"center"})}syncInfoOpen(e){e!==this.infoOpen&&(this.infoOpen=e,this.infoButton.setAttribute("aria-expanded",String(e)),e?this.supportsPopover||this.populateInfoPanel():(this.creditsOpen=!1,this.infoCreditsList.hidden=!0,this.infoCreditsToggle.setAttribute("aria-expanded","false"),this.embedOpen=!1,this.infoEmbedPanel.hidden=!0,this.infoEmbedToggle.setAttribute("aria-expanded","false")))}handleOutsideClick=e=>{const t=e.composedPath();!t.includes(this.infoPanel)&&!t.includes(this.infoButton)&&this.toggleInfoPanel()};toggleCredits(){this.creditsOpen=!this.creditsOpen,this.infoCreditsList.hidden=!this.creditsOpen,this.infoCreditsToggle.setAttribute("aria-expanded",String(this.creditsOpen)),this.creditsOpen&&this.revealInPanel(this.infoCreditsList)}toggleEmbed(){this.embedOpen=!this.embedOpen,this.infoEmbedPanel.hidden=!this.embedOpen,this.infoEmbedToggle.setAttribute("aria-expanded",String(this.embedOpen)),this.embedOpen&&(this.refreshEmbedMarkup(),this.revealInPanel(this.infoEmbedPanel))}revealInPanel(e){e.scrollIntoView?.({block:"nearest"})}get showLabels(){return this.labelsShown}set showLabels(e){this.toggleAttribute("show-labels",e)}applyLabels(e){this.labelsShown=e,this.syncLabelsToggle(),this.refreshParamSummary(),this.populateInfoPanel()}syncLabelsToggle(){this.labelsToggle.textContent=this.labelsShown?this.messages.hideLabels:this.messages.showLabels,this.labelsToggle.setAttribute("aria-pressed",String(this.labelsShown))}refreshParamSummary(){if(this.paramSummary.hidden=!this.labelsShown,!this.labelsShown){this.paramSummary.replaceChildren(),this.summarySignature="";return}const e=this.sceneElement.ufoElement.sighting,t=[...this.summaryBuilder.entriesFor(e,this.sceneElement.ufoElement.currentTime),...this.assessmentEntries],n=t.map(a=>`${a.field}=${a.label}=${a.value}${a.unit}${a.fromSource?"*":""}`).join("|");if(n===this.summarySignature)return;this.summarySignature=n;const i=[];let r;for(const a of t){r&&r.group!==a.group&&(r=void 0);const o=a.group==="witness"?this.messages.witnessGroup:a.group==="assessment"?this.messages.assessmentGroup:void 0;if(o!==void 0&&!r){const c=document.createElement("span");c.className="param-nest";const h=document.createElement("span");h.className="param-nest-label",h.textContent=o,c.append(h),r={group:a.group,element:c},i.push(c)}const l=this.paramItem(a);r?r.element.append(l):i.push(l)}this.paramSummary.replaceChildren(...i)}paramItem(e){const t=document.createElement("span");t.className=e.fromSource?"param-label from-source":"param-label";const n=document.createElement("span");if(n.className="param-label-label",n.textContent=`${e.label} `,t.append(n),e.color!==void 0){const r=document.createElement("span");r.className="param-label-swatch",r.style.background=e.color,t.append(r)}const i=document.createElement("span");return i.className="param-label-value",i.textContent=e.unit===""?e.value:`${e.value} ${e.unit}`,t.append(i),t}populateInfoPanel(){const e=this.entries.find(o=>o.src===this.currentSrc);if(this.infoObservationList.innerHTML="",e){if(!this.labelsShown){const l=this.formatDate(e.sighting);l&&this.appendInfoRow(this.infoObservationList,this.messages.date,l);const c=this.formatLocation(e.sighting);c&&this.appendInfoRow(this.infoObservationList,this.messages.location,c),e.sighting.caseId&&this.appendInfoRow(this.infoObservationList,this.messages.case,e.sighting.caseId)}const o=this.said.read(e.sighting.description);o&&this.appendInfoRow(this.infoObservationList,this.messages.description,o),!this.labelsShown&&e.sighting.tags&&e.sighting.tags.length>0&&this.appendInfoRow(this.infoObservationList,this.messages.tags,e.sighting.tags.map(l=>this.tags.name(l)).join(", "))}this.refreshEmbedMarkup(),this.infoAppLink.href=this.editorUrl(),this.infoAppLink.textContent="UFO@home v0.60.1",this.infoAppLink.title=this.messages.editThisObservation,this.infoAppLink.setAttribute("aria-label",this.messages.editThisObservation),this.infoCreditsList.innerHTML="";const t=this.sceneElement.currentTerrainAttribution;if(t){const o=document.createElement("li");o.textContent=t,this.infoCreditsList.appendChild(o)}const n=this.sceneElement.ufoElement.witnessMapCredit;if(n&&!t?.includes(n)){const o=document.createElement("li");o.textContent=n,this.infoCreditsList.appendChild(o)}for(const o of this.sceneElement.decorModelCredits){const l=document.createElement("li"),c=o.author?` — ${o.author}`:"";if(o.sourceUrl){const h=document.createElement("a");h.href=o.sourceUrl,h.target="_blank",h.rel="noopener",h.textContent=o.title,l.append(h,document.createTextNode(`${c} (${o.license})`))}else l.textContent=`${o.title}${c} (${o.license})`;this.infoCreditsList.appendChild(l)}for(const o of this.sceneElement.ufoElement.sighting.references){if(!o.credit)continue;const l=document.createElement("li");if(o.creditUrl){const c=document.createElement("a");c.href=o.creditUrl,c.target="_blank",c.rel="noopener",c.textContent=o.credit,l.appendChild(c)}else l.textContent=o.credit;this.infoCreditsList.appendChild(l)}const i=this.sceneElement.satelliteState;if(i.status==="ready"&&i.credit){const o=document.createElement("li"),l=document.createElement("a");l.href=i.creditUrl??"",l.target="_blank",l.rel="noopener",l.textContent=i.credit,o.appendChild(l),this.infoCreditsList.appendChild(o)}const r=document.createElement("li");r.textContent=`${GE} (`;const a=document.createElement("a");a.href=VE,a.target="_blank",a.rel="noopener",a.textContent=WE,r.appendChild(a),r.appendChild(document.createTextNode(")")),this.infoCreditsList.appendChild(r)}appendInfoRow(e,t,n){const i=document.createElement("dt");i.textContent=t;const r=document.createElement("dd");r.textContent=n,e.appendChild(i),e.appendChild(r)}}const Up="rr0-sighting",Fp="rr0-eyewitness";class qE extends Eg{}function YE(){wg(),customElements.get(Up)||customElements.define(Up,Eg),customElements.get(Fp)||customElements.define(Fp,qE)}YE();export{JE as $,Jn as A,ot as B,le as C,X2 as D,wi as E,sA as F,ct as G,xt as H,QE as I,jE as J,We as K,qa as L,nA as M,so as N,Mt as O,V2 as P,ys as Q,Oa as R,Ca as S,KE as T,eA as U,Pe as V,Sm as W,tA as X,wa as Y,nn as Z,An as _,ZE as a,Ks as a0,_m as a1,iA as a2,u2 as a3,xl as a4,nu as a5,El as a6,Qt as a7,Tm as a8,rd as a9,ad as aa,je as ab,Ms as ac,Xa as ad,ii as ae,Ki as af,$E as b,Wc as c,oA as d,_l as e,En as f,aA as g,Xe as h,D as i,Of as j,rA as k,lA as l,o2 as m,Us as n,ic as o,y1 as p,dv as q,gt as r,dl as s,Xt as t,Eh as u,vn as v,id as w,$i as x,v2 as y,w2 as z};
|
|
@@ -129,7 +129,7 @@ ${JSON.stringify(n)}`),t.push(`The account:
|
|
|
129
129
|
|
|
130
130
|
${e.ask}`,"Answer by calling draft_recording."),t.join(`
|
|
131
131
|
|
|
132
|
-
`)}static imageBlock(e){return{type:"image",source:{type:"base64",media_type:e.mediaType,data:e.data}}}async clientFor(e,t){if(!e)throw new Un("credential");const n=`${e}\0${t??""}`;if(this.client&&this.clientFor_===n)return this.client;const{default:i}=await jn(async()=>{const{default:s}=await import("./index-DQDuRMiM.js").then(a=>a.i);return{default:s}},[],import.meta.url);return this.client=new i({apiKey:e,...t?{defaultHeaders:{"anthropic-workspace-id":t}}:{},dangerouslyAllowBrowser:!0,maxRetries:1}),this.clientFor_=n,this.client}static read(e){if(e.stop_reason==="refusal")throw new Un("refused");const t=e.content.find(i=>i.type==="tool_use"&&i.name===Nf.name);if(!t||t.type!=="tool_use")throw new Un("malformed");const n=t.input;if(typeof n?.recording!="object"||n.recording===null||Array.isArray(n.recording))throw new Un("malformed");return{recording:n.recording,claims:Array.isArray(n.claims)?n.claims.flatMap(i=>{const{path:s,basis:a,rationale:o}=i??{};return typeof s!="string"||typeof o!="string"?[]:[{path:s,basis:a==="derived"||a==="assumed"?a:"stated",rationale:o}]}):[],gaps:Array.isArray(n.gaps)?n.gaps.filter(i=>typeof i=="string"):[]}}static async diagnose(e,t){if(e instanceof Un)return e;if(t?.aborted)return new Un("cancelled",e);const{default:n}=await jn(async()=>{const{default:i}=await import("./index-DQDuRMiM.js").then(s=>s.i);return{default:i}},[],import.meta.url);return e instanceof n.AuthenticationError||e instanceof n.PermissionDeniedError?new Un("credential",e):e instanceof n.RateLimitError?new Un("rate-limited",e):e instanceof n.BadRequestError||e instanceof n.NotFoundError?new Un("rejected",e.message,e):e instanceof n.APIConnectionError?new Un("unreachable",e):new Un("malformed",e)}}const Ns=[{id:"claude",name:"Claude",credit:"Anthropic",creditUrl:"https://www.anthropic.com/legal/consumer-terms",create:()=>new $r}],_1=[{id:"coverage",name:"Coverage",credit:"UFO@home",creditUrl:"https://ufoathome.org",create:()=>({about:"witness",assess:async r=>{const{CoverageAssessor:e}=await jn(async()=>{const{CoverageAssessor:t}=await import("./CoverageAssessor-FIt771Wz.js");return{CoverageAssessor:t}},[],import.meta.url);return new e().assess(r)}})},{id:"hynek",name:"Hynek",credit:"J. Allen Hynek",creditUrl:"https://rr0.org/science/crypto/ufo/
|
|
132
|
+
`)}static imageBlock(e){return{type:"image",source:{type:"base64",media_type:e.mediaType,data:e.data}}}async clientFor(e,t){if(!e)throw new Un("credential");const n=`${e}\0${t??""}`;if(this.client&&this.clientFor_===n)return this.client;const{default:i}=await jn(async()=>{const{default:s}=await import("./index-DQDuRMiM.js").then(a=>a.i);return{default:s}},[],import.meta.url);return this.client=new i({apiKey:e,...t?{defaultHeaders:{"anthropic-workspace-id":t}}:{},dangerouslyAllowBrowser:!0,maxRetries:1}),this.clientFor_=n,this.client}static read(e){if(e.stop_reason==="refusal")throw new Un("refused");const t=e.content.find(i=>i.type==="tool_use"&&i.name===Nf.name);if(!t||t.type!=="tool_use")throw new Un("malformed");const n=t.input;if(typeof n?.recording!="object"||n.recording===null||Array.isArray(n.recording))throw new Un("malformed");return{recording:n.recording,claims:Array.isArray(n.claims)?n.claims.flatMap(i=>{const{path:s,basis:a,rationale:o}=i??{};return typeof s!="string"||typeof o!="string"?[]:[{path:s,basis:a==="derived"||a==="assumed"?a:"stated",rationale:o}]}):[],gaps:Array.isArray(n.gaps)?n.gaps.filter(i=>typeof i=="string"):[]}}static async diagnose(e,t){if(e instanceof Un)return e;if(t?.aborted)return new Un("cancelled",e);const{default:n}=await jn(async()=>{const{default:i}=await import("./index-DQDuRMiM.js").then(s=>s.i);return{default:i}},[],import.meta.url);return e instanceof n.AuthenticationError||e instanceof n.PermissionDeniedError?new Un("credential",e):e instanceof n.RateLimitError?new Un("rate-limited",e):e instanceof n.BadRequestError||e instanceof n.NotFoundError?new Un("rejected",e.message,e):e instanceof n.APIConnectionError?new Un("unreachable",e):new Un("malformed",e)}}const Ns=[{id:"claude",name:"Claude",credit:"Anthropic",creditUrl:"https://www.anthropic.com/legal/consumer-terms",create:()=>new $r}],_1=[{id:"coverage",name:"Coverage",credit:"UFO@home",creditUrl:"https://ufoathome.org",create:()=>({about:"witness",assess:async r=>{const{CoverageAssessor:e}=await jn(async()=>{const{CoverageAssessor:t}=await import("./CoverageAssessor-FIt771Wz.js");return{CoverageAssessor:t}},[],import.meta.url);return new e().assess(r)}})},{id:"hynek",name:"Hynek",credit:"J. Allen Hynek",creditUrl:"https://rr0.org/science/crypto/ufo/observation/classification/hynek/",create:()=>({about:"temporal",assess:async r=>{const{HynekAssessor:e}=await jn(async()=>{const{HynekAssessor:t}=await import("./HynekAssessor-DUqRa3Su.js");return{HynekAssessor:t}},[],import.meta.url);return new e().assess(r)}})}];class E1{constructor(e){this.labels=e}async read(e){const t=[],n=new Set;for(const i of _1){let s;try{s=await i.create().assess(e)}catch{continue}for(const o of s.criteria)o.basis===void 0&&!o.unsupported&&n.add(o.id);const a=s.score===void 0?s.verdict===void 0?"":this.verdictName(i.id,s.verdict):`${Math.round(s.score*100)}%`;a!==""&&t.push({group:"assessment",field:i.id,label:this.labels.assessmentNames[i.id]??i.name,value:a,unit:"",fromSource:!1,about:i.create().about})}return{entries:t,unanswered:n}}verdictName(e,t){return this.labels.assessmentVerdicts[`${e}.${t}`]??t.toUpperCase()}}class Si{static stated(e){return Si.statedIn(e,[])}static apply(e,t,n){const i=structuredClone(e);for(const s of n){const a=s.split("."),o=Si.read(t,a);o!==void 0&&Si.write(i,a,structuredClone(o))}return i}static statedIn(e,t){const n=[];for(const[i,s]of Object.entries(e)){if(s===void 0)continue;const a=[...t,i];Si.isPlainObject(s)?n.push(...Si.statedIn(s,a)):n.push(a.join("."))}return n}static isPlainObject(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}static read(e,t){let n=e;for(const i of t){if(!Si.isPlainObject(n))return;n=n[i]}return n}static write(e,t,n){let i=e;for(const s of t.slice(0,-1)){const a=i[s];Si.isPlainObject(a)||(i[s]={}),i=i[s]}i[t[t.length-1]]=n}}const gr=["front","behind","left","right","front-left","front-right","behind-left","behind-right"];function ku(r){return r==="vehicle"?["front","behind","front-left","front-right","behind-left","behind-right"]:["front","behind","left","right"]}function T1(r){return r==="vehicle"?["front-left","front-right","behind-left","behind-right"]:ku(r)}const nd=90,A1=50;function jm(r){if(!Nu(r))return;const e={};for(const t of ku(r))e[t]=id(r,t)?A1:nd;return e}const ta=2;function Nu(r){return r==="building"||r==="vehicle"}function id(r,e){return r==="building"?!0:r==="vehicle"?e!=="front"&&e!=="behind":!1}function Kr(r){return r==="building"||r==="vehicle"}function jl(r,e){const t=r.litKeyframes;if(!t||t.length===0)return r.lit??!1;let n=t[0];for(const i of t){if(i.t>e)break;n=i}return n.lit}function I1(r,e){return r.pattern.kind==="steady"?!0:Jm(r,e,e+1)>.5}function Jm(r,e,t){if(r.pattern.kind==="steady")return 1;const{perMinute:n,dutyCycle:i,phase:s=0}=r.pattern,a=Math.min(Math.max(i,0),1);if(a===0||n<=0)return 0;const o=6e4/n,l=e/o+s,c=t/o+s;if(c<=l)return Math.min(Math.max(l-Math.floor(l),0),a)<a?1:0;const h=d=>Math.floor(d)*a+Math.min(d-Math.floor(d),a);return(h(c)-h(l))/(c-l)}function fa(r,e){const t=r.track,n={eastM:r.eastM,northM:r.northM,altitudeM:0,headingDeg:r.headingDeg};if(!t||t.length===0)return n;if(t.length===1||e<=t[0].t)return Of(t[0],r);const i=t[t.length-1];if(e>=i.t)return Of(i,r);for(let s=0;s<t.length-1;s++){const a=t[s],o=t[s+1];if(e<a.t||e>o.t)continue;const l=o.t-a.t,c=l===0?0:(e-a.t)/l;return{eastM:a.eastM+(o.eastM-a.eastM)*c,northM:a.northM+(o.northM-a.northM)*c,altitudeM:(a.altitudeM??0)+((o.altitudeM??0)-(a.altitudeM??0))*c,headingDeg:a.headingDeg??r.headingDeg}}return n}function Of(r,e){return{eastM:r.eastM,northM:r.northM,altitudeM:r.altitudeM??0,headingDeg:r.headingDeg??e.headingDeg}}const D1={x:et.CANVAS_WIDTH_PX/2,y:et.CANVAS_HEIGHT_PX/2,width:1,height:1};class Jl{static loadable(e){const t=e.decor?{decor:e.decor.map((i,s)=>Jl.decor(i,s))}:{},n=e.timeline?.keyframes;return n?{...e,...t,timeline:{...e.timeline,keyframes:n.map(i=>({t:i.t??0,shapes:(i.shapes??[]).map(s=>({sourceId:s.sourceId,shape:Jl.shape(s.shape)}))}))}}:{...e,...t}}static decor(e,t){const n=e.kind??"vehicle";return{...Nu(n)?{windows:jm(n)}:{},...n==="building"?{floors:ta}:{},...e,id:e.id??`decor-${t+1}`,kind:n,eastM:e.eastM??0,northM:e.northM??0}}static shape(e){const t=e?.kind==="polygon"?"polygon":"oval";return{...t==="polygon"?{points:[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}]}:{},...e,kind:t,bounds:{...D1},color:typeof e?.color=="string"?e.color:"#e8e6df",angle:0,transparency:0,haloScale:0,selected:!1}}}const C1=`
|
|
133
133
|
<!-- The groups' own handles, gathered onto one wrapping strip instead of standing as seven stacked
|
|
134
134
|
<summary> rows down the left edge. Seven collapsed rows cost 259px of pure chrome before a
|
|
135
135
|
single field is shown, which is most of a phone's screen spent on nothing; the same seven
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rr0/ufoathome",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.60.
|
|
4
|
+
"version": "0.60.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",
|