@rr0/ufoathome 0.136.1 → 0.137.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ const e={type:"string",doc:"The schema this file was written against, for an editor to check it with: https://ufoathome.org/schema/1/sighting.schema.json."},t={type:"number",doc:"The version of the format this file is written in (see FormatVersion): 1, the only one so far."},o={type:"string",doc:'Which account this is, unique across every recording anywhere: the day it happened, then who saw it ("1964-04-24-ZamoraLonnie"), or where for an anonymous observer.'},r={type:"object",fields:{year:{type:"number"},month:{type:"number"},day:{type:"number"},hour:{type:"number"},minute:{type:"number"},second:{type:"number"},season:{type:"enum",doc:'The season, when the date is only known to be "in the spring of 2022" (EDTF `2022-21`): then `month` and `day` are undefined.',values:["spring","summer","autumn","winter"]},raw:{type:"string",doc:"The exact EDTF-ish text as typed in the editor UI (e.g."}}},a={type:"object",doc:"See SightingEvent.endTime.",fields:{year:{type:"number"},month:{type:"number"},day:{type:"number"},hour:{type:"number"},minute:{type:"number"},second:{type:"number"},season:{type:"enum",doc:'The season, when the date is only known to be "in the spring of 2022" (EDTF `2022-21`): then `month` and `day` are undefined.',values:["spring","summer","autumn","winter"]},raw:{type:"string",doc:"The exact EDTF-ish text as typed in the editor UI (e.g."}}},n={type:"number",doc:"See SightingEvent.durationSeconds."},s={type:"string",doc:"See SightingEvent.durationText."},i={type:"number",doc:"See SightingEvent.utcOffsetHours — the legal time zone `time`/`endTime` are expressed in."},d={type:"string",doc:"See SightingEvent.timeZone — the IANA rule `utcOffsetHours` was derived from, when it was."},h={type:"array",fields:{lat:{type:"number"},lng:{type:"number"},name:{type:"string",doc:'The place as it is named, fully qualified — "Valensole, Alpes-de-Haute-Provence, …, France".'}}},c={type:"object",doc:"See Sighting.observer.",fields:{id:{type:"string",doc:'Who this is, as a reference: last name then first names, run together ("ZamoraLonnie"), whether or not a page exists for them yet.'},title:{type:"string",doc:'What the observer is called when no name is given or wanted — "Witness 2" in one language, "Témoin 2" in another — or their name as they gave it.',loose:!0},lastName:{type:"string"},firstNames:{type:"array"}}},l={type:"object",doc:"Who saw it and how their account travelled — see Account, and Sighting.account.",fields:{observerAgeYears:{type:"number",doc:"The main observer's age in years AT THE TIME, not today — a 1974 account is read by whoever finds it decades later, and the number that means anything is the one from then."},observerBirth:{type:"object",doc:"The main observer's birth date, as precisely as it is known (a full date, a year, or one marked approximate): the other way of stating `observerAgeYears`, which the editor keeps in step with it against the observation date (see ObserverAge).",fields:{year:{type:"number"},month:{type:"number"},day:{type:"number"},hour:{type:"number"},minute:{type:"number"},second:{type:"number"},season:{type:"enum",doc:'The season, when the date is only known to be "in the spring of 2022" (EDTF `2022-21`): then `month` and `day` are undefined.',values:["spring","summer","autumn","winter"]},raw:{type:"string",doc:"The exact EDTF-ish text as typed in the editor UI (e.g."}}},observerPerception:{type:"object",doc:"How the main observer's own perception differs from a typical one — colour vision, alcohol, fatigue — as the values of the ObserverProviders' settings, by provider id."},observerOccupation:{type:"string",doc:'What the main observer did, as they are described: "boulanger", "pilote de ligne", "gendarme".',loose:!0},source:{type:"enum",doc:"How the account reached the person who wrote this recording.",values:["on-site","interview","telephone","questionnaire","letter","social-media","press"]},followedUp:{type:"boolean",doc:"Whether the observer was gone back to after the first account."},conditions:{type:"object",doc:"The conditions of this account and of the sighting as the observer lived it: what the error laws of the values they give read (see docs/witness-error-model.md and WitnessError).",fields:{delayDays:{type:"number",doc:"Days between the sighting and this account."},version:{type:"number",doc:"Which version of the observer's account this is: 1 for the first given."},word:{type:"enum",values:["object","light","craft","ufo","other"]},exposure:{type:"enum",values:["press","none","broadcast","other-witnesses","investigators"]},independent:{type:"boolean",doc:"Whether the observers gave their accounts without talking to each other first."},darkAdapted:{type:"boolean",doc:"Whether the observer's eyes were used to the dark."},correctedVision:{type:"boolean",doc:"Whether the observer wore the glasses or lenses they need."},glare:{type:"boolean",doc:"Whether a bright light dazzled the observer just before."},moonShownDeg:{type:"number",doc:"How wide the observer showed the full Moon, in degrees, the way they showed the object: their own angular-size factor is this over the Moon's real 0.52°, applied to every angular size they give (see WitnessError.MOON_DEG)."}}}}},p={type:"number",doc:"How much the observer's body sways the view at rest: 1 a person, 0 a tripod — see Sighting.sway."},u={type:"object",doc:"The vehicle the observer was in, when the decor does not draw it — see Sighting.vehicle.",fields:{kind:{type:"enum",values:["car","van","truck","motorcycle","generic"]},windowsOpen:{type:"boolean",doc:"Whether the windows were open: the road and the wind come in, the cabin no longer muffles the engine."},noise:{type:"number",doc:'How loud it was, against an ordinary one of its kind: 1 by default, 1.5 for "very noisy".'},headlights:{type:"enum",doc:'How its lights are set (see HeadlightMode), or "auto": the dipped beam from the dusk on and nothing by day, which is what a driver does.',values:["off","position","dipped","main","fog","auto"]},headlightKeyframes:{type:"array",doc:"Sorted by t.",fields:{t:{type:"number"},mode:{type:"enum",values:["off","position","dipped","main","fog","auto"]}}}}},y={type:"string",doc:"See SightingEvent.description — a plain string, or one per language.",loose:!0},m={type:"string",doc:"See SightingEvent.image — the picture a shared link to this recording shows."},g={type:"string",doc:"See SightingEvent.summary — what a shared link to this recording says of it.",loose:!0},b={type:"number",doc:"See SightingEvent.summaryTime — the second the picture of this recording's card is taken at."},f={type:"array",doc:"See SightingEvent.tags."},w={type:"object",fields:{keyframes:{type:"array",fields:{t:{type:"number"},shapes:{type:"array",fields:{sourceId:{type:"string"},shape:{type:"object",fields:{kind:{type:"enum",values:["oval","polygon"]},bounds:{type:"object",fields:{x:{type:"number"},y:{type:"number"},width:{type:"number"},height:{type:"number"}}},color:{type:"string",doc:"CSS color"},angle:{type:"number",doc:"Rotation in radians about the shape's centre, positive = clockwise on screen; 0 = no rotation"},transparency:{type:"number",doc:"0 = opaque, 1 = fully transparent"},haloScale:{type:"number",doc:"0 = no halo/glow, >1 = larger glow radius"},blur:{type:"number",doc:"How indistinct the observer said its edges were — 0 for a hard outline, 1 for a shape with no edge at all."},brightness:{type:"number",doc:"How dazzling the observer said it was — 0 for a light you can look at, 1 for one you cannot."},selected:{type:"boolean"},title:{type:"string",doc:"What the observer calls it, if anything.",loose:!0},angular:{type:"object",doc:"How big this looked to the observer, in degrees of arc (see AngularExtent) — the recording's OWN statement of size, and the one it is allowed to make.",fields:{widthDeg:{type:"number",doc:"How wide it looked, in degrees of arc."},heightDeg:{type:"number",doc:"How tall it looked, in degrees of arc."}}},aim:{type:"object",doc:"Where the phenomenon itself was in the observer's sky (the direction of the shape's centre, not the way the observer was facing) — degrees of azimuth from true north and of altitude above the horizon, the same conventions as ObserverPose.",fields:{azimuthDeg:{type:"number",doc:"Degrees clockwise from true north, the same convention as ObserverPose.headingDeg."},altitudeDeg:{type:"number",doc:"Degrees above (positive) or below the horizon."}}},points:{type:"array",doc:"Points relative to bounds origin (0,0 = bounds.x, bounds.y)",fields:{x:{type:"number"},y:{type:"number"}}}}}}}}},order:{type:"array",doc:"Back-to-front paint/hit-test order — see Timeline's own `order` field."},groups:{type:"array",doc:"Each inner array is one group's member sourceIds (always >= 2 members) — see Timeline's own `groups` field."},span:{type:"number",doc:"The length of the observation the keyframes were placed against, in ms, when it is longer than the last keyframe — a shape placed at 0 s then moved at 5 s of a 10 s observation has keyframes at 0 and 5000 only, and without this the recording would end (and be stretched over the whole observation) at 5 s."}}},v={type:"object",doc:"The observer's position/elevation/orientation over time — absent for older recordings, which fall back to the legacy static place[0] (see Sighting.ts's resolveObserverPoseAt).",fields:{keyframes:{type:"array",fields:{t:{type:"number"},pose:{type:"object",fields:{lat:{type:"number",doc:"Decimal degrees."},lng:{type:"number"},elevationM:{type:"number",doc:"Metres above the local ground under the observer, not above sea level: 0 for someone standing on it, the height of a window or a cliff top otherwise."},headingDeg:{type:"number",doc:"Degrees clockwise from true north."},pitchDeg:{type:"number",doc:"Degrees above (positive) or below (negative) the local horizontal — how far up/down the observer was looking, e.g."},rollDeg:{type:"number",doc:"How far the instrument itself was tilted about its own line of sight, degrees, positive clockwise as the observer saw it — a camera held askew, a head leaned over."},fovDeg:{type:"number",doc:"Vertical field of view in degrees, as a Three.js PerspectiveCamera would take it."},fNumber:{type:"number",doc:"How far the lens was stopped down — undefined for anything the recording did not state, which then falls back to the instrument's own setting (see Instrument.fNumber)."},focusDistanceM:{type:"number",doc:"How far away the lens was focused, metres — undefined meaning at infinity, which is where a camera pointed at the sky sits and the only setting under which everything celestial comes out sharp."},filter:{type:"string",doc:"What was held in front of the instrument — a FILTERS id, a solar filter for an eclipse."}}}}}}},k={type:"object",doc:"Weather over time — absent for older recordings, which fall back to the legacy static `weather` field below (see Sighting.ts's resolveWeatherAt).",fields:{keyframes:{type:"array",fields:{t:{type:"number"},weather:{type:"object",fields:{cloudLayers:{type:"array",doc:"Explicit layers override the historical cloud fields; [] means no clouds.",fields:{id:{type:"string",doc:"Stable across keyframes: reordering layers must not regenerate their cloud pattern."},instances:{type:"array",doc:"Optional explicit masses, independent of the generated coverage percentage.",fields:{id:{type:"string"},eastM:{type:"number",doc:"Position relative to the recording's initial observer, in metres east/north."},northM:{type:"number"},baseM:{type:"number"},thicknessM:{type:"number"},widthM:{type:"number"},depthM:{type:"number"},rotationDeg:{type:"number"},density:{type:"number"},darkness:{type:"number",doc:"Visual shading, 0 (white) to 1 (very dark); absent inherits the parent layer."},seed:{type:"number"}}},type:{type:"enum",values:["cumulus","stratus","stratocumulus","cirrus","unknown"]},baseM:{type:"number",doc:"Base in metres above the recording's reference ground, not above the moving observer."},thicknessM:{type:"number",doc:"Vertical extent in metres."},coverage:{type:"number",doc:"Horizontal coverage, 0–1."},sizeM:{type:"number",doc:"Characteristic horizontal cloud size in metres."},density:{type:"number",doc:"Relative optical density, 0–2; zero is transparent."},darkness:{type:"number",doc:"Visual shading, 0 (white) to 1 (very dark)."},iceCrystalAlignment:{type:"number",doc:"Degree of preferential crystal orientation, meaningful only for cirrus."},seed:{type:"number",doc:"Reproducible variation; defaults to a hash of the stable layer id."},windDirectionDeg:{type:"number",doc:"Optional wind overrides; bearing TOWARD which the cloud travels, clockwise from north."},windSpeed:{type:"number"}}},cloudCover:{type:"number",doc:"0 = clear sky, 1 = fully overcast."},cloudDarkness:{type:"number",doc:"0 = light/clear clouds, 1 = dark/stormy character."},cloudBaseM:{type:"number",doc:"Height of the cloud layer's BASE above the ground, in meters — 600 to 2000 m covers most real low cloud."},highCloudCover:{type:"number",doc:"How much of the sky the HIGH deck covered, 0 to 1 — cirrus and cirrostratus, above about six kilometres, where anything present is ice rather than water."},lowerCloudCover:{type:"number",doc:"How much of the sky the LOW and MIDDLE decks covered, 0 to 1 — the cloud that stands between a observer and anything higher up."},iceCrystalAlignment:{type:"number",doc:"How steadily the ice crystals were falling, 0 to 1 — the one thing about the sky that decides which halo forms stood, and the one thing no record of any sighting holds."},rareIceCrystals:{type:"number",doc:"The share of a cirrus deck's crystals that are the rare kinds, 0 to 1: columns capped with pyramids, which draw the odd-radius rings (9, 20, 35 degrees), and plates free to turn about a level axis, which draw Lowitz's arcs sloping from the sundogs."},relativeHumidity:{type:"number",doc:"Relative humidity near the ground, 0 to 1."},precipitationType:{type:"enum",values:["none","rain","snow","hail"]},precipitationIntensity:{type:"number",doc:'0-1; meaningless while precipitationType is "none".'},precipitationAmount:{type:"number",doc:"How much of that precipitation is actually falling yet, 0 to 1 — absent meaning all of it."},windDirectionDeg:{type:"number",doc:"Degrees clockwise from true north — same convention as ObserverPose.headingDeg, and the direction the wind blows *toward*, not the one it comes from: SceneRenderer drifts every precipitation particle and cloud field along exactly this bearing (`sin/-cos`, north = -Z), so 0 means snow drifting northward."},windSpeed:{type:"number",doc:"Real-world wind speed in m/s (0 = calm, ~30 = violent storm/hurricane-force) — drives both cloud advection, visual precipitation drift and wind audio volume directly."},storm:{type:"boolean",doc:"Whether a thunderstorm was reported — drives both a scene-fog lightning flash and a delayed thunderclap (see SceneRenderer's lightning-flash scheduling, named for the visual mechanism it implements internally, not for this field)."}}}}}}},M={type:"object",doc:`Legacy static weather condition, kept only as weatherTrack's own fallback for recordings made before it existed — absent means "unknown/not recorded", not "clear skies" (renderers default to DEFAULT_WEATHER, see Weather.ts).`,fields:{cloudLayers:{type:"array",doc:"Explicit layers override the historical cloud fields; [] means no clouds.",fields:{id:{type:"string",doc:"Stable across keyframes: reordering layers must not regenerate their cloud pattern."},instances:{type:"array",doc:"Optional explicit masses, independent of the generated coverage percentage.",fields:{id:{type:"string"},eastM:{type:"number",doc:"Position relative to the recording's initial observer, in metres east/north."},northM:{type:"number"},baseM:{type:"number"},thicknessM:{type:"number"},widthM:{type:"number"},depthM:{type:"number"},rotationDeg:{type:"number"},density:{type:"number"},darkness:{type:"number",doc:"Visual shading, 0 (white) to 1 (very dark); absent inherits the parent layer."},seed:{type:"number"}}},type:{type:"enum",values:["cumulus","stratus","stratocumulus","cirrus","unknown"]},baseM:{type:"number",doc:"Base in metres above the recording's reference ground, not above the moving observer."},thicknessM:{type:"number",doc:"Vertical extent in metres."},coverage:{type:"number",doc:"Horizontal coverage, 0–1."},sizeM:{type:"number",doc:"Characteristic horizontal cloud size in metres."},density:{type:"number",doc:"Relative optical density, 0–2; zero is transparent."},darkness:{type:"number",doc:"Visual shading, 0 (white) to 1 (very dark)."},iceCrystalAlignment:{type:"number",doc:"Degree of preferential crystal orientation, meaningful only for cirrus."},seed:{type:"number",doc:"Reproducible variation; defaults to a hash of the stable layer id."},windDirectionDeg:{type:"number",doc:"Optional wind overrides; bearing TOWARD which the cloud travels, clockwise from north."},windSpeed:{type:"number"}}},cloudCover:{type:"number",doc:"0 = clear sky, 1 = fully overcast."},cloudDarkness:{type:"number",doc:"0 = light/clear clouds, 1 = dark/stormy character."},cloudBaseM:{type:"number",doc:"Height of the cloud layer's BASE above the ground, in meters — 600 to 2000 m covers most real low cloud."},highCloudCover:{type:"number",doc:"How much of the sky the HIGH deck covered, 0 to 1 — cirrus and cirrostratus, above about six kilometres, where anything present is ice rather than water."},lowerCloudCover:{type:"number",doc:"How much of the sky the LOW and MIDDLE decks covered, 0 to 1 — the cloud that stands between a observer and anything higher up."},iceCrystalAlignment:{type:"number",doc:"How steadily the ice crystals were falling, 0 to 1 — the one thing about the sky that decides which halo forms stood, and the one thing no record of any sighting holds."},rareIceCrystals:{type:"number",doc:"The share of a cirrus deck's crystals that are the rare kinds, 0 to 1: columns capped with pyramids, which draw the odd-radius rings (9, 20, 35 degrees), and plates free to turn about a level axis, which draw Lowitz's arcs sloping from the sundogs."},relativeHumidity:{type:"number",doc:"Relative humidity near the ground, 0 to 1."},precipitationType:{type:"enum",values:["none","rain","snow","hail"]},precipitationIntensity:{type:"number",doc:'0-1; meaningless while precipitationType is "none".'},precipitationAmount:{type:"number",doc:"How much of that precipitation is actually falling yet, 0 to 1 — absent meaning all of it."},windDirectionDeg:{type:"number",doc:"Degrees clockwise from true north — same convention as ObserverPose.headingDeg, and the direction the wind blows *toward*, not the one it comes from: SceneRenderer drifts every precipitation particle and cloud field along exactly this bearing (`sin/-cos`, north = -Z), so 0 means snow drifting northward."},windSpeed:{type:"number",doc:"Real-world wind speed in m/s (0 = calm, ~30 = violent storm/hurricane-force) — drives both cloud advection, visual precipitation drift and wind audio volume directly."},storm:{type:"boolean",doc:"Whether a thunderstorm was reported — drives both a scene-fog lightning flash and a delayed thunderclap (see SceneRenderer's lightning-flash scheduling, named for the visual mechanism it implements internally, not for this field)."}}},S={type:"object",doc:"What the sighting sounded like over time — see SoundTrack.",fields:{keyframes:{type:"array",fields:{t:{type:"number"},sound:{type:"object",fields:{kind:{type:"enum",values:["none","hum","whistle","rumble","crackle"]},volume:{type:"number",doc:"How loud it was, 0 (inaudible) to 1 (as loud as the observer could describe) — deliberately relative rather than a dB SPL figure: nobody reports a sound level in decibels, and inventing one would claim a measurement where there is only an impression."},pitchHz:{type:"number",doc:`The sound's own frequency in Hz — the oscillator's pitch for the pitched kinds ("hum", "whistle"), and the noise filter's centre for the unpitched ones ("rumble", "crackle"), where it reads as how deep or how sharp the noise is.`},src:{type:"string",doc:"An actual audio recording of the sound, when one exists (a observer who filmed the event, a later recording of the same phenomenon) — replaces synthesis entirely while it is set, with `volume` still scaling it."}}}}}}},T=JSON.parse(`{"type":"array","doc":"See Sighting.decor.","fields":{"id":{"type":"string"},"kind":{"type":"enum","values":["terrace","wall","building","tree","crop","mound","streetlight","vehicle","observer","aircraft","trafficlight","crossing","roadsign","shrub","bridge","wire","entity"]},"title":{"type":"string","doc":"Optional display name, same role as Shape.title — falls back to a generic \\"{kind} {n}\\" label (see SightingEditorElement.decorLabel) when absent.","loose":true},"eastM":{"type":"number","doc":"Meters from the observer's own position — eastM positive = east, northM positive = north."},"northM":{"type":"number"},"headingDeg":{"type":"number","doc":"Degrees clockwise from true north, same convention as ObserverPose.headingDeg — which way a vehicle is facing, or a observer looking."},"lit":{"type":"boolean","doc":"Streetlight lamp / vehicle headlights switched on."},"litKeyframes":{"type":"array","doc":"Sorted by t.","fields":{"t":{"type":"number"},"lit":{"type":"boolean"}}},"headlights":{"type":"enum","doc":"For a vehicle: how its lights are set (see HeadlightMode).","values":["off","position","dipped","main","fog"]},"headlightKeyframes":{"type":"array","doc":"Sorted by t.","fields":{"t":{"type":"number"},"mode":{"type":"enum","values":["off","position","dipped","main","fog"]}}},"lights":{"type":"array","doc":"The object's individual lamps, each with its own place on the body and its own rhythm — see DecorLight, and LIGHT_RIGS for the ready-made sets.","fields":{"id":{"type":"string"},"offsetM":{"type":"object","doc":"Where it sits on the object, in meters relative to the object's own centre and heading: +x is its right, +y up, +z its front.","fields":{"x":{"type":"number"},"y":{"type":"number"},"z":{"type":"number"}}},"color":{"type":"string","doc":"CSS hex colour, as emitted — the regulated red/green/white of navigation lights, the amber of a hazard flasher."},"intensity":{"type":"number","doc":"Peak luminous intensity as a ratio to an ordinary navigation light's (1, about a hundred candela — see DecorSystem's LAMP_CANDELA); the airliner rig (LIGHT_RIGS) gives its beacon 1.5 and its wingtip strobes 20."},"pattern":{"type":"object","fields":{"kind":{"type":"enum","values":["steady","flash"]},"perMinute":{"type":"number"},"dutyCycle":{"type":"number"},"phase":{"type":"number"}}},"radiusM":{"type":"number","doc":"The radius of what shines, metres, where it is not a quarter of a metre: the lens of a traffic light is ten centimetres."},"beamDeg":{"type":"number","doc":"Where the lamp is seen from, when it is not from everywhere: the angle off the object's front (−z, where its heading points) at which it gives half its light, degrees."}}},"track":{"type":"array","doc":"Where the object is over time, when it moves — an aircraft crossing the sky, a car driving past.","fields":{"t":{"type":"number"},"eastM":{"type":"number"},"northM":{"type":"number"},"altitudeM":{"type":"number","doc":"Meters above the observer's own elevation."},"headingDeg":{"type":"number"},"gazeAzimuthDeg":{"type":"number","doc":"Where a figure looks, as a compass azimuth: its head turns to face it, as far as a neck turns (85 degrees either side of where its body points), if its model has a node named \\"head\\" (scripts/people/split_head.py)."}}},"sightingUrl":{"type":"string","doc":"For kind \\"observer\\" only: the URL of that observer's own sighting.json recording, if known — lets the 3D scene's own context menu offer \\"view this observer's account\\" (loading it the same way SightingEditorElement.importFromUrl already does)."},"windows":{"type":"object","doc":"Per-side window opacity, 0 (fully open — the pane is invisible, and DecorSystem.addRoom's own interior wall panel is skipped there too, same as no window at all) to 100 (fully closed — a solid-looking pane)."},"color":{"type":"string","doc":"What colour this object actually is, as a CSS colour — the same way a shape states its own (see Shape.color), because a recording is written and read by people and \\"#8f86a8\\" is a colour a person can type."},"observerSide":{"type":"enum","values":["front","behind","left","right","front-left","front-right","behind-left","behind-right"]},"observerFacing":{"type":"enum","doc":"Which window the observer looks through, when it is not the one at their own seat: a driver sits at \\"front-left\\" and looks through the windshield (\\"front\\").","values":["front","behind","left","right","front-left","front-right","behind-left","behind-right"]},"observerKeyframes":{"type":"array","doc":"Where the observer sits over time, when they do not stay where they are: a driver is in the car until the moment they get out of it.","fields":{"t":{"type":"number"},"side":{"type":"enum","doc":"The seat they are in from this instant; absent means they are outside the object.","values":["front","behind","left","right","front-left","front-right","behind-left","behind-right"]},"facing":{"type":"enum","doc":"The window they look through from this instant, when it is not the one at their seat.","values":["front","behind","left","right","front-left","front-right","behind-left","behind-right"]}}},"engine":{"type":"object","doc":"A vehicle heard running — see DecorEngine: its engine turning with its own \`track\`, heard less the further it is from the observer.","fields":{"kind":{"type":"enum","doc":"Which sound: a decor object's own \`kind\` says only \\"vehicle\\".","values":["car","van","truck","motorcycle","generic"]},"noise":{"type":"number","doc":"As ObserverVehicle.noise."}}},"aircraftSound":{"type":"enum","doc":"An aircraft heard while it flies — what sort of noise it makes (see AircraftHearing.noiseOfKind), or \\"silent\\" for one that makes none (a glider's cousin, a stand-in for something nobody heard).","values":["unknown","airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet","light-piston","turboprop-light","helicopter-light","helicopter-medium","helicopter-heavy","military-jet","glider","balloon","ultralight","unmanned","silent"]},"surveyedOn":{"type":"string","doc":"The day (YYYY-MM-DD) of the survey this object was taken from, where it comes from one (see \`origin\`): the latest of the days of everything it was drawn from (the laser flight, the aerial photograph, the map's edition)."},"facade":{"type":"object","doc":"Kind \\"building\\" only: the colour of its walls, and the windows and door drawn on them.","fields":{"color":{"type":"string","doc":"The colour of the wall, \\"#rrggbb\\": plaster, stone, brick."},"plain":{"type":"boolean","doc":"A plain wall, with no windows and no door."},"openings":{"type":"enum","doc":"How the walls are opened.","values":["tall","lancet"]},"storeyM":{"type":"number","doc":"The height of a storey, metres, where it is known (the floors a survey states, or those of an old building): absent is three."},"closedAtNight":{"type":"boolean","doc":"The windows of a place nobody is in at night (a shop, an office, a pool, a gymnasium): it has windows, but a fifth as many of them lit as a home has at the same hour (see DecorSystem.CLOSED_AT_NIGHT_SHARE)."}}},"roof":{"type":"object","doc":"Kind \\"building\\" only: the shape and colour of its roof.","fields":{"shape":{"type":"enum","doc":"\\"flat\\" is the box; \\"gable\\" rises to a ridge along the building's longer side; \\"hip\\" slopes down on all four; \\"dome\\" is a cupola over the ellipse the walls hold.","values":["flat","gable","hip","dome"]},"ridge":{"type":"enum","doc":"Which side of the building a gable's ridge runs along: \\"width\\" (the longer side, the default) or \\"depth\\".","values":["width","depth"]},"riseM":{"type":"number","doc":"How far the ridge stands above the eaves, metres."},"color":{"type":"string","doc":"The colour of the roof seen from above, \\"#rrggbb\\", where it was measured (see RoofShapes): the walls keep their own."}}},"bridge":{"type":"object","doc":"Kind \\"bridge\\" only: how it is built, where that is known — see BridgeStructure.","fields":{"spanM":{"type":"number","doc":"Metres of open span under the deck, centred on the object."},"deckThicknessM":{"type":"number","doc":"Thickness of the deck slab, metres."},"railing":{"type":"object","doc":"The railing along both edges: its height above the road, the spacing of its posts, and how many horizontal rails it has — two rails make two rows of rectangular openings.","fields":{"heightM":{"type":"number"},"postSpacingM":{"type":"number"},"rails":{"type":"number"}}}}},"wire":{"type":"object","doc":"Kind \\"wire\\" only: how many strands, where they hang, and which ends stand on a pole — see WireStructure.","fields":{"strands":{"type":"array","doc":"The strands: each one's height above the ground and, for a crossarm, how far it hangs to one side of the line (positive to the right of its heading).","fields":{"heightM":{"type":"number"},"acrossM":{"type":"number"}}},"poles":{"type":"enum","doc":"Which ends stand on a pole: both (default), the one the object's heading points away from (\`start\`) or towards (\`end\`), or none, for a line anchored on buildings at both ends.","values":["none","both","start","end"]},"diameterM":{"type":"number","doc":"How thick a strand is, metres."},"poleHeightM":{"type":"number","doc":"How tall a pole is, metres."}}},"lamp":{"type":"object","doc":"Kind \\"streetlight\\" only: the lamp it carries, where it is known (a town's inventory says it).","fields":{"colorTemperatureK":{"type":"number","doc":"The colour of its light, kelvins: 2 000 a sodium lamp's orange, 2 700 to 3 000 a warm white LED's, 4 000 a cold one."},"lumens":{"type":"number","doc":"Its luminous flux, lumens."},"mount":{"type":"enum","doc":"\\"wall\\": a bracket on a facade, with no column of its own.","values":["wall","column"]}}},"sign":{"type":"object","doc":"Kind \\"roadsign\\" only: what its face says.","fields":{"face":{"type":"enum","doc":"\\"stop\\" is the red octagon, \\"give-way\\" the triangle point down, \\"speed-limit\\" the disc ringed in red; \\"other\\" a sign whose face is not drawn.","values":["other","stop","give-way","speed-limit"]},"code":{"type":"string","doc":"The sign as the map codes it, where it does (\\"FR:B14[50]\\")."},"value":{"type":"number","doc":"The limit, km/h, for a \\"speed-limit\\"."}}},"floors":{"type":"number","doc":"Kind \\"building\\" only: number of upper stories above the ground floor, set when the building is created (default 2, see SightingEditorElement.addDecor) and editable afterward."},"occupiedFloor":{"type":"number","doc":"Kind \\"building\\" only, meaningful once observerSide is set: which floor the observer is on, 0 (ground floor) up to floors."},"occludesSourceIds":{"type":"array","doc":"Shape sourceIds (see Timeline.sourceIds/Shape) this decor object sits in front of, from the observer's own reported viewpoint — occluding that shape wherever their screen positions line up (see SceneRenderer.isScreenPointOccluded)."},"sizeM":{"type":"object","doc":"How big it really is, in meters, along its own axes — see DecorSize.","fields":{"widthM":{"type":"number"},"lengthM":{"type":"number"},"heightM":{"type":"number"}}},"modelParameters":{"type":"object","doc":"The settings of the model this object is drawn as, by the key the model publishes them under (see ModelParameters.parameters): a being's costume colour, say."},"model":{"type":"object","doc":"The real 3D model that stands in for the primitive, if one does — see DecorModelRef.","fields":{"id":{"type":"string","doc":"Catalogue entry, resolved by the live DecorModelProvider."},"url":{"type":"string","doc":"Direct glTF/GLB address, taking precedence over \`id\`."},"headingOffsetDeg":{"type":"number","doc":"Degrees to turn the loaded model about its own vertical axis so its nose points the way this scene's heading convention expects (0 faces -Z — see DecorSystem's build)."},"credit":{"type":"object","doc":"Who made it and under what licence.","fields":{"title":{"type":"string"},"author":{"type":"string"},"license":{"type":"string","doc":"Licence name as its author states it, e.g."},"sourceUrl":{"type":"string","doc":"Where it came from, so the claim can be checked."}}}}},"origin":{"type":"string","doc":"The survey this object was taken from, by the id of its provider (\\"ign-lidar-hd\\"), when the author did not place it by hand: the trees the editor plants from a canopy survey (see CanopyProvider)."}}}`),D={type:"array",doc:"The roads the account's own plan draws — see Sighting.roads and Road.ts.",fields:{id:{type:"string"},title:{type:"string",doc:"What the account calls it, where it calls it anything.",loose:!0},surface:{type:"enum",values:["paved","gravel","dirt"]},widthM:{type:"number",doc:"Carriageway width, metres."},path:{type:"array",doc:"The centre line, in metres east and north of the observer's place at t=0.",fields:{eastM:{type:"number"},northM:{type:"number"}}},source:{type:"string",doc:"Where this line comes from — the plan, the survey, the report it was read off.",loose:!0}}},j={type:"array",doc:"What an investigator drew over the place, imported from their file — see Sighting.traces and Trace.ts.",fields:{id:{type:"string"},title:{type:"string",doc:'What its author called it ("Ligne de visée depuis la ferme").',loose:!0},kind:{type:"enum",values:["polygon","point","line"]},points:{type:"array",doc:"One point for a marker, the vertices of a line, the vertices of an outline (not repeated at the end: it is closed by being a polygon).",fields:{lat:{type:"number"},lng:{type:"number"},altM:{type:"number",doc:"Metres, read as `InvestigatorTrace.altitude` says."}}},altitude:{type:"enum",doc:"How `altM` is read.",values:["ground","relative","absolute"]},color:{type:"string",doc:"CSS colour the author gave it, `#rrggbb`."},source:{type:"string",doc:"Whose it is and where it comes from — the person, the report, the file.",loose:!0}}},x={type:"object",doc:"Which meteorological record `weatherTrack` was looked up from, when it wasn't the observer who stated the conditions — see Sighting.weatherSource.",fields:{id:{type:"string",doc:"Stable dataset id, e.g."},name:{type:"string",doc:"Human-readable dataset name, e.g."},url:{type:"string",doc:"The exact request that produced these values, so the claim stays checkable years later."}}},W={type:"string",doc:"Which INSTRUMENTS entry this was observed through — see Sighting.instrumentId."},H={type:"number",doc:"How long the shutter stayed open, seconds — one value for the whole observation, see Sighting.exposureSeconds."},A={type:"number",doc:"The speed of the film or sensor this picture was taken on — see Sighting.iso."},R={type:"number",doc:`How bright the night sky is at the place, towns and all: the zenith of a moonless night in magnitudes per square arcsecond, a Sky Quality Meter's reading or the World Atlas's "SQM" figure (Falchi et al.`},z={type:"boolean",doc:"Whether the map of where the observer stood starts open — see Sighting.observerMap."},E={type:"array",doc:"The named moments of the account — see Milestone.",fields:{t:{type:"number",doc:"When, in milliseconds from the start of the recording — the same scale every track uses."},label:{type:"string",doc:'Short label, shown on the seek bar: the letter or number the account itself uses ("A", "B"), or a couple of words where it uses none.',loose:!0},note:{type:"string",doc:"What happened at that moment, in the account's own words where possible.",loose:!0}}},I={type:"array",doc:"Pictures of the place, laid over the reconstruction at the direction each was registered in — see SceneReference.",fields:{id:{type:"string",doc:"Stable id, what the editor's own list and a future trace on the picture name."},kind:{type:"enum",values:["photo","panorama"]},src:{type:"string",doc:"Where the picture is: an address, or the picture itself as a `data:` URL."},title:{type:"string",doc:'What to call it — "Vue depuis le muret, fin été 1968".',loose:!0},credit:{type:"string",doc:"Who made it and on what terms — shown wherever the picture is, because a credit that is not displayed is not a licence (see DataSource for the same rule on the data)."},creditUrl:{type:"string",doc:"Where that credit points: the source page, the licence."},t:{type:"number",doc:"The instant of the timeline it was taken at, milliseconds, for a picture made DURING the observation — by the observer, or by whoever was there."},from:{type:"object",doc:"Where it was taken from — the one point its registration holds for.",fields:{lat:{type:"number"},lng:{type:"number"}}},drawing:{type:"boolean",doc:"Whether somebody drew on it — a trajectory, an outline, an arrow — so that what the picture shows of the phenomenon is a statement made afterwards, not a thing the camera recorded."},opacity:{type:"number",doc:"How much of it shows, 0 to 1 — the starting point of the reader's own slider, since the comparison is made by sliding: all picture, all render, and the registration checked at every step between."},registration:{type:"object",fields:{headingDeg:{type:"number",doc:"Degrees clockwise from true north, the direction the picture's centre looks at."},pitchDeg:{type:"number",doc:"Degrees above the local horizontal, positive up."},rollDeg:{type:"number",doc:"Degrees the picture is tilted about its own axis, positive clockwise as it is looked at — see ObserverPose.rollDeg."},fovDeg:{type:"number",doc:"The picture's VERTICAL field, degrees — what the lens took in top to bottom, its horizontal field following from the image's own aspect ratio."}}},landmarks:{type:"array",doc:"The details it was lined up on — see PictureLandmark.",fields:{id:{type:"string"},label:{type:"string",doc:'What the detail is — "Arbre masquant", "barrière".',loose:!0},picture:{type:"object",doc:"Where it is on the picture, 0..1 from the top-left corner.",fields:{u:{type:"number"},v:{type:"number"}}},scene:{type:"object",doc:"Where it is from the observer, in the scene.",fields:{azimuthDeg:{type:"number"},altitudeDeg:{type:"number"}}}}}}},O={type:"array",doc:"Where the account can be read as it was given, each one a source — see RecordingSource.",fields:{type:{type:"enum",values:["book","article"]},title:{type:"string"},authors:{type:"array",doc:"The author(s) name(s): for a post, the account that posted it."},url:{type:"string",doc:"Where it can be read."},publication:{type:"object",doc:"Who published it and when (EDTF).",fields:{publisher:{type:"string"},time:{type:"string"}}},index:{type:"string",doc:"Chapter, page, etc."}}},C=JSON.parse(`{"type":"object","doc":"What the observer took it to be, in metres — see InterpretationJson.","fields":{"title":{"type":"string","doc":"What the claim is, in a few words — \\"Craft on its legs\\", \\"Weather balloon at 3 km\\".","loose":true},"bodies":{"type":"array","fields":{"id":{"type":"string"},"title":{"type":"string","loose":true},"explains":{"type":"array","doc":"The phenomena of the account (their \`sourceId\`s) this body claims to be — what its projected outline is measured against at each instant, and what is drawn as a ghost beside it."},"model":{"type":"object","doc":"What it is shaped like.","fields":{"id":{"type":"string","doc":"Catalogue entry, resolved by the live DecorModelProvider."},"url":{"type":"string","doc":"Direct glTF/GLB address, taking precedence over \`id\`."},"headingOffsetDeg":{"type":"number","doc":"Degrees to turn the loaded model about its own vertical axis so its nose points the way this scene's heading convention expects (0 faces -Z — see DecorSystem's build)."},"credit":{"type":"object","doc":"Who made it and under what licence.","fields":{"title":{"type":"string"},"author":{"type":"string"},"license":{"type":"string","doc":"Licence name as its author states it, e.g."},"sourceUrl":{"type":"string","doc":"Where it came from, so the claim can be checked."}}}}},"withObserver":{"type":"boolean","doc":"Whether the observer carries it: its keyframes, stated FROM THE OBSERVER, are offsets from their eye that go with the eye, instead of points of the world fixed where the eye was at each keyframe's instant."},"outlineNode":{"type":"string","doc":"The node of the model that IS what the observer drew — \\"hull\\" for a craft on legs the observer drew as an oval — and so what its outline is measured by (see BodyConfrontation)."},"track":{"type":"array","fields":{"t":{"type":"number"},"eastM":{"type":"number"},"northM":{"type":"number"},"azimuthDeg":{"type":"number"},"altitudeDeg":{"type":"number"},"distanceM":{"type":"number"},"onGround":{"type":"boolean","doc":"Standing on the ground."},"present":{"type":"boolean","doc":"Gone from here on — \`false\` — or back — \`true\`."},"altitudeAboveGroundM":{"type":"number","doc":"Metres between the ground under it and its lowest point."},"altitudeM":{"type":"number","doc":"Metres between its lowest point and the ground at the recording's own origin (where the observer stands at the start) — a height in the air that does NOT follow what is under the body."},"sizeM":{"type":"object","fields":{"widthM":{"type":"number"},"lengthM":{"type":"number"},"heightM":{"type":"number"}}},"attitude":{"type":"object","fields":{"headingDeg":{"type":"number"},"pitchDeg":{"type":"number"},"rollDeg":{"type":"number"}}},"appearance":{"type":"object","fields":{"color":{"type":"string","doc":"Its surface colour, CSS."},"albedo":{"type":"number","doc":"How much of the light falling on it it sends back, 0-1: aluminium ~0.7, a matt dark hull ~0.1."},"luminanceCdM2":{"type":"number","doc":"What it gives out of itself, candela per square metre — read through the scene's own photometry exactly as a flame's is (see BodyFlame), so that the same figure is a lamp at night and nothing at all against a noon sky."},"transparency":{"type":"number","doc":"How much of what is behind it shows through, 0 (opaque, the default) to 1 (gone): the same statement a drawn shape's transparency makes, for a body of the scene."},"haloScale":{"type":"number","doc":"How far the glare it throws round itself reaches, as a multiple of what its light gives (1, the default): 0 puts the glare out, 2 doubles its width."}}},"flame":{"type":"object","doc":"A flame coming out of it, from here on — see BodyFlame.","fields":{"node":{"type":"string"},"lengthM":{"type":"number","doc":"How far it reaches from the node, metres."},"widthM":{"type":"number","doc":"How wide it is at its widest, metres."},"color":{"type":"string","doc":"Its colour where it leaves the node, CSS."},"tipColor":{"type":"string","doc":"Its colour at its far end; the same as \`color\` when absent."},"luminanceCdM2":{"type":"number"},"raisesDust":{"type":"boolean","doc":"Whether it raises dust where it meets the ground — a flame reaching loose, dry soil does, the more the nearer it gets."}}},"motions":{"type":"object","doc":"How far along each of its model's own movements it is, by the movement's name in the model (a glTF animation): 0 at its start, 1 at its end, and on past 1 for one that repeats — a turn made three times is 3."},"lights":{"type":"object","doc":"The luminance of each of its model's own lights, cd/m², by the name of the light's material in the model: what lets one body carry lights that behave each their own way — a steady white at each end, a red one flashing between."}}},"sound":{"type":"object","doc":"What it sounds like: heard from where the observer stands, late by the time sound takes to come, shifted in pitch as it comes and goes, and masked by the noise of the place (see BodyHearing).","fields":{"kind":{"type":"enum","values":["unknown","airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet","light-piston","turboprop-light","helicopter-light","helicopter-medium","helicopter-heavy","military-jet","glider","balloon","ultralight","unmanned"]},"quieterDb":{"type":"number","doc":"Decibels less than the class's own sound power, across its spectrum."}}}}},"smoke":{"type":"array","doc":"Fires the interpretation lights on the ground, as their smoke — see SmokeSource.","fields":{"eastM":{"type":"number"},"northM":{"type":"number"},"fromT":{"type":"number"},"untilT":{"type":"number"},"halfLifeS":{"type":"number","doc":"How fast it dies down, seconds to half its thickness — brush flares and smoulders."}}},"flares":{"type":"array","doc":"Salvoes of decoy flares an aircraft dispensed, computed into bodies when shown — see FlareSalvoJson.","fields":{"id":{"type":"string"},"title":{"type":"string","loose":true},"aircraft":{"type":"object","doc":"The aircraft at one instant of the recording, flying straight and level from there on (and before).","fields":{"t":{"type":"number"},"eastM":{"type":"number"},"northM":{"type":"number"},"altitudeM":{"type":"number","doc":"Metres above the ground at the recording's origin — see BodyKeyframe.altitudeM."},"headingDeg":{"type":"number"},"speedMS":{"type":"number"},"originElevationM":{"type":"number","doc":"Its height above sea level at \`t\` would be this plus \`altitudeM\`: what sets how thick the air braking the flares is."},"model":{"type":"object","doc":"Drawn when given (a catalogue model or a primitive), dark and unlit as a fighter in an exercise often is.","fields":{"id":{"type":"string","doc":"Catalogue entry, resolved by the live DecorModelProvider."},"url":{"type":"string","doc":"Direct glTF/GLB address, taking precedence over \`id\`."},"headingOffsetDeg":{"type":"number","doc":"Degrees to turn the loaded model about its own vertical axis so its nose points the way this scene's heading convention expects (0 faces -Z — see DecorSystem's build)."},"credit":{"type":"object","doc":"Who made it and under what licence.","fields":{"title":{"type":"string"},"author":{"type":"string"},"license":{"type":"string","doc":"Licence name as its author states it, e.g."},"sourceUrl":{"type":"string","doc":"Where it came from, so the claim can be checked."}}}}},"sizeM":{"type":"object","fields":{"widthM":{"type":"number"},"lengthM":{"type":"number"},"heightM":{"type":"number"}}},"glow":{"type":"object","doc":"A light it gives off as it flies — its afterburner — which an observer may have taken for a phenomenon of its own.","fields":{"explains":{"type":"array","doc":"The phenomena of the account it claims to be — see BodyJson.explains."},"sizeM":{"type":"number","doc":"How wide it looks, m."},"luminousIntensityCd":{"type":"number"},"color":{"type":"string"},"fromT":{"type":"number","doc":"Ms of the recording."},"untilT":{"type":"number"},"onS":{"type":"number","doc":"Seconds lit, then seconds out, repeated from \`fromT\`; always lit when absent."},"offS":{"type":"number"}}},"sound":{"type":"object","doc":"What it sounds like (see BodySound): heard from the two minutes before the recording on, as its sound takes that long to come from afar.","fields":{"kind":{"type":"enum","values":["unknown","airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet","light-piston","turboprop-light","helicopter-light","helicopter-medium","helicopter-heavy","military-jet","glider","balloon","ultralight","unmanned"]},"quieterDb":{"type":"number","doc":"Decibels less than the class's own sound power, across its spectrum."}}}}},"releases":{"type":"array","doc":"When each flare leaves it, and which phenomena of the account it claims to be.","fields":{"t":{"type":"number","doc":"Ms of the recording."},"explains":{"type":"array","doc":"The phenomena of the account this flare claims to be — see BodyJson.explains."}}},"flare":{"type":"object","doc":"The flare dispensed: an MJU-7 when absent (see DecoyFlare.MJU_7).","fields":{"massKg":{"type":"number","doc":"Mass at ejection, kg."},"burnedKg":{"type":"number","doc":"Mass burned away by burnout, kg."},"dragAreaM2":{"type":"number","doc":"Drag coefficient times reference area, m²: how hard the air brakes it."},"ejectionMS":{"type":"number","doc":"The dispenser's kick, m/s, straight down out of the aircraft."},"burnS":{"type":"number","doc":"How long it burns, s."},"luminousIntensityCd":{"type":"number","doc":"Its luminous intensity at full burn, candela, in the visible: what the eye gets of it."},"flameSizeM":{"type":"number","doc":"How wide its burning plume looks, m: the size of the glowing sphere drawn."},"color":{"type":"string","doc":"The colour of its light, CSS."}}},"wind":{"type":"object","doc":"The wind at the flares' height: where it blows TOWARDS, degrees, and its speed.","fields":{"towardDeg":{"type":"number"},"speedMS":{"type":"number"}}}}},"variant":{"type":"object","doc":"When this interpretation is a VARIANT of the account: what the observer would have to have erred by for the account to be a misperception of a candidate, as the candidate search found it (see CandidateSearch, docs/witness-error-model.md).","fields":{"candidate":{"type":"string","doc":"Which candidate: a body of the sky (\\"Venus\\"), a satellite, a re-entry, an aircraft, or another interpretation."},"label":{"type":"string","doc":"What the candidate is called, as it was when the variant was kept."},"phenomenon":{"type":"string","doc":"The known phenomenon of Poher's matrix it is an instance of, when it is one."},"parameters":{"type":"object","doc":"The witness parameters applied: a clock offset in minutes, a rotation of the heading in degrees, factors on elevation and size.","fields":{"clockMinutes":{"type":"number"},"headingDeg":{"type":"number"},"elevationFactor":{"type":"number"},"sizeFactor":{"type":"number"},"durationFactor":{"type":"number"}}},"moved":{"type":"array","doc":"The values it moves: what the account says, what the variant reads, the bias and its status.","fields":{"field":{"type":"enum","values":["time","heading","elevation","size","duration","sweep"]},"stated":{"type":"number"},"variant":{"type":"number"},"parameter":{"type":"string"},"amount":{"type":"number"},"z":{"type":"number"},"status":{"type":"string"}}},"readings":{"type":"array","doc":"The structural readings it uses (see CandidateSearch's StructuralReading), each with what the studies say of it.","fields":{"reading":{"type":"string"},"status":{"type":"string"}}},"cost":{"type":"number","doc":"What it costs, in units of the laws' spread (σ), and the verdict it got."},"verdict":{"type":"enum","values":["consolidated","contested","incompatible"]},"modelId":{"type":"string","doc":"The error model it was computed with (see WitnessError.MODELS)."}}}}}`),L=JSON.parse(`{"type":"array","doc":"The variants of the account that were kept: each an interpretation saying what the observer would have erred by for it to be a misperception of a candidate (see InterpretationJson.variant).","fields":{"title":{"type":"string","doc":"What the claim is, in a few words — \\"Craft on its legs\\", \\"Weather balloon at 3 km\\".","loose":true},"bodies":{"type":"array","fields":{"id":{"type":"string"},"title":{"type":"string","loose":true},"explains":{"type":"array","doc":"The phenomena of the account (their \`sourceId\`s) this body claims to be — what its projected outline is measured against at each instant, and what is drawn as a ghost beside it."},"model":{"type":"object","doc":"What it is shaped like.","fields":{"id":{"type":"string","doc":"Catalogue entry, resolved by the live DecorModelProvider."},"url":{"type":"string","doc":"Direct glTF/GLB address, taking precedence over \`id\`."},"headingOffsetDeg":{"type":"number","doc":"Degrees to turn the loaded model about its own vertical axis so its nose points the way this scene's heading convention expects (0 faces -Z — see DecorSystem's build)."},"credit":{"type":"object","doc":"Who made it and under what licence.","fields":{"title":{"type":"string"},"author":{"type":"string"},"license":{"type":"string","doc":"Licence name as its author states it, e.g."},"sourceUrl":{"type":"string","doc":"Where it came from, so the claim can be checked."}}}}},"withObserver":{"type":"boolean","doc":"Whether the observer carries it: its keyframes, stated FROM THE OBSERVER, are offsets from their eye that go with the eye, instead of points of the world fixed where the eye was at each keyframe's instant."},"outlineNode":{"type":"string","doc":"The node of the model that IS what the observer drew — \\"hull\\" for a craft on legs the observer drew as an oval — and so what its outline is measured by (see BodyConfrontation)."},"track":{"type":"array","fields":{"t":{"type":"number"},"eastM":{"type":"number"},"northM":{"type":"number"},"azimuthDeg":{"type":"number"},"altitudeDeg":{"type":"number"},"distanceM":{"type":"number"},"onGround":{"type":"boolean","doc":"Standing on the ground."},"present":{"type":"boolean","doc":"Gone from here on — \`false\` — or back — \`true\`."},"altitudeAboveGroundM":{"type":"number","doc":"Metres between the ground under it and its lowest point."},"altitudeM":{"type":"number","doc":"Metres between its lowest point and the ground at the recording's own origin (where the observer stands at the start) — a height in the air that does NOT follow what is under the body."},"sizeM":{"type":"object","fields":{"widthM":{"type":"number"},"lengthM":{"type":"number"},"heightM":{"type":"number"}}},"attitude":{"type":"object","fields":{"headingDeg":{"type":"number"},"pitchDeg":{"type":"number"},"rollDeg":{"type":"number"}}},"appearance":{"type":"object","fields":{"color":{"type":"string","doc":"Its surface colour, CSS."},"albedo":{"type":"number","doc":"How much of the light falling on it it sends back, 0-1: aluminium ~0.7, a matt dark hull ~0.1."},"luminanceCdM2":{"type":"number","doc":"What it gives out of itself, candela per square metre — read through the scene's own photometry exactly as a flame's is (see BodyFlame), so that the same figure is a lamp at night and nothing at all against a noon sky."},"transparency":{"type":"number","doc":"How much of what is behind it shows through, 0 (opaque, the default) to 1 (gone): the same statement a drawn shape's transparency makes, for a body of the scene."},"haloScale":{"type":"number","doc":"How far the glare it throws round itself reaches, as a multiple of what its light gives (1, the default): 0 puts the glare out, 2 doubles its width."}}},"flame":{"type":"object","doc":"A flame coming out of it, from here on — see BodyFlame.","fields":{"node":{"type":"string"},"lengthM":{"type":"number","doc":"How far it reaches from the node, metres."},"widthM":{"type":"number","doc":"How wide it is at its widest, metres."},"color":{"type":"string","doc":"Its colour where it leaves the node, CSS."},"tipColor":{"type":"string","doc":"Its colour at its far end; the same as \`color\` when absent."},"luminanceCdM2":{"type":"number"},"raisesDust":{"type":"boolean","doc":"Whether it raises dust where it meets the ground — a flame reaching loose, dry soil does, the more the nearer it gets."}}},"motions":{"type":"object","doc":"How far along each of its model's own movements it is, by the movement's name in the model (a glTF animation): 0 at its start, 1 at its end, and on past 1 for one that repeats — a turn made three times is 3."},"lights":{"type":"object","doc":"The luminance of each of its model's own lights, cd/m², by the name of the light's material in the model: what lets one body carry lights that behave each their own way — a steady white at each end, a red one flashing between."}}},"sound":{"type":"object","doc":"What it sounds like: heard from where the observer stands, late by the time sound takes to come, shifted in pitch as it comes and goes, and masked by the noise of the place (see BodyHearing).","fields":{"kind":{"type":"enum","values":["unknown","airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet","light-piston","turboprop-light","helicopter-light","helicopter-medium","helicopter-heavy","military-jet","glider","balloon","ultralight","unmanned"]},"quieterDb":{"type":"number","doc":"Decibels less than the class's own sound power, across its spectrum."}}}}},"smoke":{"type":"array","doc":"Fires the interpretation lights on the ground, as their smoke — see SmokeSource.","fields":{"eastM":{"type":"number"},"northM":{"type":"number"},"fromT":{"type":"number"},"untilT":{"type":"number"},"halfLifeS":{"type":"number","doc":"How fast it dies down, seconds to half its thickness — brush flares and smoulders."}}},"flares":{"type":"array","doc":"Salvoes of decoy flares an aircraft dispensed, computed into bodies when shown — see FlareSalvoJson.","fields":{"id":{"type":"string"},"title":{"type":"string","loose":true},"aircraft":{"type":"object","doc":"The aircraft at one instant of the recording, flying straight and level from there on (and before).","fields":{"t":{"type":"number"},"eastM":{"type":"number"},"northM":{"type":"number"},"altitudeM":{"type":"number","doc":"Metres above the ground at the recording's origin — see BodyKeyframe.altitudeM."},"headingDeg":{"type":"number"},"speedMS":{"type":"number"},"originElevationM":{"type":"number","doc":"Its height above sea level at \`t\` would be this plus \`altitudeM\`: what sets how thick the air braking the flares is."},"model":{"type":"object","doc":"Drawn when given (a catalogue model or a primitive), dark and unlit as a fighter in an exercise often is.","fields":{"id":{"type":"string","doc":"Catalogue entry, resolved by the live DecorModelProvider."},"url":{"type":"string","doc":"Direct glTF/GLB address, taking precedence over \`id\`."},"headingOffsetDeg":{"type":"number","doc":"Degrees to turn the loaded model about its own vertical axis so its nose points the way this scene's heading convention expects (0 faces -Z — see DecorSystem's build)."},"credit":{"type":"object","doc":"Who made it and under what licence.","fields":{"title":{"type":"string"},"author":{"type":"string"},"license":{"type":"string","doc":"Licence name as its author states it, e.g."},"sourceUrl":{"type":"string","doc":"Where it came from, so the claim can be checked."}}}}},"sizeM":{"type":"object","fields":{"widthM":{"type":"number"},"lengthM":{"type":"number"},"heightM":{"type":"number"}}},"glow":{"type":"object","doc":"A light it gives off as it flies — its afterburner — which an observer may have taken for a phenomenon of its own.","fields":{"explains":{"type":"array","doc":"The phenomena of the account it claims to be — see BodyJson.explains."},"sizeM":{"type":"number","doc":"How wide it looks, m."},"luminousIntensityCd":{"type":"number"},"color":{"type":"string"},"fromT":{"type":"number","doc":"Ms of the recording."},"untilT":{"type":"number"},"onS":{"type":"number","doc":"Seconds lit, then seconds out, repeated from \`fromT\`; always lit when absent."},"offS":{"type":"number"}}},"sound":{"type":"object","doc":"What it sounds like (see BodySound): heard from the two minutes before the recording on, as its sound takes that long to come from afar.","fields":{"kind":{"type":"enum","values":["unknown","airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet","light-piston","turboprop-light","helicopter-light","helicopter-medium","helicopter-heavy","military-jet","glider","balloon","ultralight","unmanned"]},"quieterDb":{"type":"number","doc":"Decibels less than the class's own sound power, across its spectrum."}}}}},"releases":{"type":"array","doc":"When each flare leaves it, and which phenomena of the account it claims to be.","fields":{"t":{"type":"number","doc":"Ms of the recording."},"explains":{"type":"array","doc":"The phenomena of the account this flare claims to be — see BodyJson.explains."}}},"flare":{"type":"object","doc":"The flare dispensed: an MJU-7 when absent (see DecoyFlare.MJU_7).","fields":{"massKg":{"type":"number","doc":"Mass at ejection, kg."},"burnedKg":{"type":"number","doc":"Mass burned away by burnout, kg."},"dragAreaM2":{"type":"number","doc":"Drag coefficient times reference area, m²: how hard the air brakes it."},"ejectionMS":{"type":"number","doc":"The dispenser's kick, m/s, straight down out of the aircraft."},"burnS":{"type":"number","doc":"How long it burns, s."},"luminousIntensityCd":{"type":"number","doc":"Its luminous intensity at full burn, candela, in the visible: what the eye gets of it."},"flameSizeM":{"type":"number","doc":"How wide its burning plume looks, m: the size of the glowing sphere drawn."},"color":{"type":"string","doc":"The colour of its light, CSS."}}},"wind":{"type":"object","doc":"The wind at the flares' height: where it blows TOWARDS, degrees, and its speed.","fields":{"towardDeg":{"type":"number"},"speedMS":{"type":"number"}}}}},"variant":{"type":"object","doc":"When this interpretation is a VARIANT of the account: what the observer would have to have erred by for the account to be a misperception of a candidate, as the candidate search found it (see CandidateSearch, docs/witness-error-model.md).","fields":{"candidate":{"type":"string","doc":"Which candidate: a body of the sky (\\"Venus\\"), a satellite, a re-entry, an aircraft, or another interpretation."},"label":{"type":"string","doc":"What the candidate is called, as it was when the variant was kept."},"phenomenon":{"type":"string","doc":"The known phenomenon of Poher's matrix it is an instance of, when it is one."},"parameters":{"type":"object","doc":"The witness parameters applied: a clock offset in minutes, a rotation of the heading in degrees, factors on elevation and size.","fields":{"clockMinutes":{"type":"number"},"headingDeg":{"type":"number"},"elevationFactor":{"type":"number"},"sizeFactor":{"type":"number"},"durationFactor":{"type":"number"}}},"moved":{"type":"array","doc":"The values it moves: what the account says, what the variant reads, the bias and its status.","fields":{"field":{"type":"enum","values":["time","heading","elevation","size","duration","sweep"]},"stated":{"type":"number"},"variant":{"type":"number"},"parameter":{"type":"string"},"amount":{"type":"number"},"z":{"type":"number"},"status":{"type":"string"}}},"readings":{"type":"array","doc":"The structural readings it uses (see CandidateSearch's StructuralReading), each with what the studies say of it.","fields":{"reading":{"type":"string"},"status":{"type":"string"}}},"cost":{"type":"number","doc":"What it costs, in units of the laws' spread (σ), and the verdict it got."},"verdict":{"type":"enum","values":["consolidated","contested","incompatible"]},"modelId":{"type":"string","doc":"The error model it was computed with (see WitnessError.MODELS)."}}}}}`),Y={type:"object",doc:"What happened in the sky while it runs, as facts (a laser shot, a launch, a re-entry) — see SkyEventsJson.",fields:{beams:{type:"array",doc:"Beams of light sent through the air from the ground: a laser, a searchlight — see BeamJson.",fields:{id:{type:"string"},title:{type:"string",loose:!0},explains:{type:"array",doc:"The phenomena of the account (their `sourceId`s) this beam claims to be — see BodyJson.explains."},path:{type:"array",doc:"Where the light goes, in order: where it leaves the emitter, then where it is turned (a mirror) if it is, and where it ends (what it hits, or where it has gone far enough for nothing more of it to matter).",fields:{lat:{type:"number"},lng:{type:"number"},altitudeM:{type:"number",doc:"Altitude above the sea, metres."}}},wavelengthNm:{type:"number",doc:"The wavelength of the light, nm: 532 for the green of a frequency-doubled Nd:YAG laser, 520 for a green diode, 638 for a red one."},powerW:{type:"number",doc:"The optical power it carries, watts: its mean power for a pulsed laser, whose pulses an eye cannot tell apart."},divergenceMrad:{type:"number",doc:"How fast it widens, milliradians, full angle."},apertureM:{type:"number",doc:"How wide it leaves the emitter, metres."},fromT:{type:"number",doc:"When it is on, ms of the recording: from its start and until its end when absent."},untilT:{type:"number"}}},launches:{type:"array",doc:"Rocket launches, whose exhaust shows lit by a Sun the ground no longer sees — see LaunchJson.",fields:{id:{type:"string"},title:{type:"string",loose:!0},explains:{type:"array",doc:"The phenomena of the account (their `sourceId`s) this launch claims to be — see BodyJson.explains."},vehicle:{type:"object",doc:"What flew, as its operator names it.",fields:{name:{type:"string",doc:'"Falcon 9".'},mission:{type:"string",doc:'"Starlink Group 10-49".'},engine:{type:"object",doc:"The engine whose exhaust it is.",fields:{thrustKN:{type:"number",doc:"Thrust in vacuum, kN: a Merlin Vacuum's 934, an RL10's 110, a solid booster's thousands."},specificImpulseS:{type:"number",doc:"Specific impulse in vacuum, seconds: 348 for a Merlin Vacuum, 465 for an RL10, 285 for a solid."},propellant:{type:"enum",values:["rp1-lox","methane-lox","hydrogen-lox","hypergolic","solid"]}}}}},track:{type:"array",doc:"Where the stage stood at instants of the recording, ms.",fields:{t:{type:"number"},lat:{type:"number"},lng:{type:"number"},altitudeKm:{type:"number",doc:"Height above the ellipsoid, km."}}},burnFromT:{type:"number",doc:"When the engine started and stopped, ms of the recording."},burnUntilT:{type:"number"},plume:{type:"object",fields:{exhaustKgPerS:{type:"number",doc:"Mass of exhaust leaving the engine, kg per second."},condensedShare:{type:"number",doc:"The share of that exhaust that ends up as particles that scatter light, 0 to 1."},particleRadiusUm:{type:"number",doc:"Radius of those particles, micrometres."},expansionKmPerS:{type:"number",doc:"How fast a puff's radius grows, km per second, from `initialRadiusKm`."},initialRadiusKm:{type:"number"},lifetimeS:{type:"number",doc:"How long a puff lasts before the particles have gone, seconds."},collarShare:{type:"number",doc:"The share of the particles that is the collar: exhaust just let go, which leaves the nozzle at its exhaust velocity (3.4 km/s for a Merlin Vacuum) and, with almost no air to stop it, spreads into a wide, short-lived shell round the stage, where the rest stays behind as the narrow trail."},collarExpansionKmPerS:{type:"number",doc:"How fast the collar's radius grows, km per second, and how long it lasts, seconds."},collarLifetimeS:{type:"number"}}}}},reentries:{type:"array",doc:"Re-entries: placed on the Earth, not round the observer — see ReentryJson.",fields:{id:{type:"string"},title:{type:"string",loose:!0},explains:{type:"array",doc:"The phenomena of the account (their `sourceId`s) this re-entry claims to be — see BodyJson.explains."},object:{type:"object",doc:"The object that came down, when it is known — the catalogue says which piece it was.",fields:{name:{type:"string",doc:'Its catalogue name — "SL-12 R/B".'},cosparId:{type:"string",doc:'International designator — "1968-013C".'},norad:{type:"number",doc:"US Space Surveillance Network catalogue number — 3136."}}},track:{type:"array",doc:"Where the leading point of the break-up was, at instants of the recording.",fields:{t:{type:"number"},lat:{type:"number"},lng:{type:"number"},altitudeKm:{type:"number",doc:"Height above the ellipsoid, km."}}},fragments:{type:"array",doc:"The pieces seen, each following the same path some seconds behind the leading point.",fields:{id:{type:"string"},lagS:{type:"number",doc:"Seconds behind the leading point, along the same path."},fromT:{type:"number",doc:"When it is first seen, ms of the recording — when it broke off, or when it began to glow."},untilT:{type:"number",doc:"When it goes out, ms — burned up, or slowed below glowing."},absoluteMagnitude:{type:"number",doc:"Its brightness as a magnitude at 100 km — the meteor astronomers' absolute magnitude, which a fireball report gives — from which the brightness at the observer's actual distance follows."},color:{type:"string",doc:"Its colour, as a CSS hex colour."},trainS:{type:"number",doc:"How long a stretch of its own past path still glows behind it, seconds: the tail observers describe."}}}}}}},F={type:"object",doc:"Where the data its scene would otherwise ask third parties for is kept, beside this file — see FrozenData.",fields:{live:{type:"boolean",doc:"Every group asked of its source at every play, and nothing taken at save: off (absent) by default."},relief:{type:"object",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},imagery:{type:"object",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},roads:{type:"object",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},water:{type:"object",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},railways:{type:"object",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},upperAir:{type:"object",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},map:{type:"object",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},weather:{type:"object",doc:"Where the weather is kept, when it is not inside the recording (its `weatherTrack` and `weatherSource`): an annex holding them, read as the recording is loaded (see RecordingSections).",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},place:{type:"object",doc:"The place's name and coordinates (`place`), read from the recording's file rather than looked up by a geocoder when present: inside the recording, or in the annex `src` names.",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},lightPollution:{type:"object",doc:"The night sky's figure (`lightPollution`), read from the recording's file rather than looked up in the atlas when present: inside the recording, or in the annex `src` names.",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}},decor:{type:"object",doc:"The scenery (`decor`), read from the recording's file rather than taken again from a survey of the place as the observer moves, when present: inside the recording, or in the annex `src` names.",fields:{src:{type:"string",doc:"The annex holding it, relative to the recording's own file (as a model's `url` is), or a `data:` URL for an annex kept inside the recording itself."},live:{type:"boolean",doc:"Asked of its source at every play, and never taken at save: what an author chooses by picking a source rather than the file."},takenOn:{type:"string",doc:"The day it was taken from its source, YYYY-MM-DD: what the data is a picture of (a road network, a survey) is that day's."},attribution:{type:"string",doc:"Whom it was taken from, as their licence asks it to be said."},refresh:{type:"boolean",doc:"Asked of its source again, once: the scene does not read the annex, and the editor takes it again at the next save and drops this."}}}}},B={$schema:e,version:t,id:o,time:r,endTime:a,durationSeconds:n,durationText:s,utcOffsetHours:i,timeZone:d,place:h,observer:c,account:l,sway:p,vehicle:u,description:y,image:m,summary:g,summaryTime:b,tags:f,timeline:w,observerTrack:v,weatherTrack:k,weather:M,soundTrack:S,decor:T,roads:D,traces:j,weatherSource:x,instrument:W,exposureSeconds:H,iso:A,lightPollution:R,observerMap:z,milestones:E,references:I,sources:O,interpretation:C,variants:L,skyEvents:Y,frozen:F};export{e as $schema,l as account,T as decor,B as default,y as description,n as durationSeconds,s as durationText,a as endTime,H as exposureSeconds,F as frozen,o as id,m as image,W as instrument,C as interpretation,A as iso,R as lightPollution,E as milestones,c as observer,z as observerMap,v as observerTrack,h as place,I as references,D as roads,Y as skyEvents,S as soundTrack,O as sources,g as summary,b as summaryTime,p as sway,f as tags,r as time,d as timeZone,w as timeline,j as traces,i as utcOffsetHours,L as variants,u as vehicle,t as version,M as weather,x as weatherSource,k as weatherTrack};
@@ -0,0 +1,2 @@
1
+ import{A as ht,L as ut,T as K,R as P,a as L,r as dt,l as X}from"./rr0-sighting.mjs";import{C as J}from"./ContrailGrowth-CuAzwIoc.js";class f{static OCTAVES=[63,125,250,500,1e3,2e3,4e3,8e3];static STANDARD={temperatureC:15,relativeHumidity:.7,pressureKPa:101.325};static REFERENCE_PRESSURE_KPA=101.325;static REFERENCE_TEMPERATURE_K=293.15;static TRIPLE_POINT_K=273.16;static speedOfSound(t){return 20.0468*Math.sqrt(t+273.15)}static absorptionDbPerKm(t,e=f.STANDARD){const a=e.temperatureC+273.15,n=f.REFERENCE_TEMPERATURE_K,i=e.pressureKPa/f.REFERENCE_PRESSURE_KPA,o=10**(-6.8346*(f.TRIPLE_POINT_K/a)**1.261+4.6151),s=e.relativeHumidity*100*o/i,r=i*(24+40400*s*(.02+s)/(.391+s)),h=i*(a/n)**-.5*(9+280*s*Math.exp(-4.17*((a/n)**(-1/3)-1))),c=t*t;return 8.686*c*(184e-13*(1/i)*Math.sqrt(a/n)+(a/n)**-2.5*(.01275*Math.exp(-2239.1/a)/(r+c/r)+.1068*Math.exp(-3352/a)/(h+c/h)))*1e3}static aWeightingDb(t){const e=t*t,a=12194**2*e*e/((e+20.6**2)*Math.sqrt((e+107.7**2)*(e+737.9**2))*(e+12194**2));return 20*Math.log10(a)+2}static sumDb(t){return 10*Math.log10(t.reduce((e,a)=>e+10**(a/10),0))}}const pt=.25,x=.4,Z=6,U=12,mt=3,Q=.2,gt=.2,ft=24,Mt=3,At=12,tt=1,Et=.7,bt=1.5,Dt=.8,St=1.3,et=.9,at=5,Rt=25,vt=.5,Ot=.12,nt=[.13,.31],Bt=.16,It=1.6,Tt=3.6,it=1.1,_t=.3,Ct=1e3,st=.7;class ${context;noiseBuffer;roughBuffers=new Map;voices=new Map;bus;reverb;reverbOut;level=1;master;paused=!0;requested=[];headingDeg=0;resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(t){console.warn("AircraftAudio: Web Audio unavailable, aircraft stay silent:",t);return}}ht.unlock(this.context),this.apply()}setLevel(t){this.level=t,this.master&&(this.master.gain.value=t)}setPaused(t){t!==this.paused&&(this.paused=t,this.apply())}setVoices(t,e=0){this.requested=t,this.headingDeg=e,this.apply()}dispose(){for(const t of[...this.voices.keys()])this.release(t);this.context?.close(),this.context=void 0,this.master=void 0,this.bus=void 0}apply(){const t=this.context;if(!t)return;const e=this.paused?[]:this.requested,a=new Set(e.map(n=>n.id));for(const n of[...this.voices.keys()])a.has(n)||this.release(n);for(const n of e){const i=this.voices.get(n.id)??this.build(t,n);this.retarget(t,i,n)}}build(t,e){const a=t.createGain();a.gain.value=0;let n;const i=this.busOf(t);typeof t.createStereoPanner=="function"?(n=t.createStereoPanner(),a.connect(n).connect(i)):a.connect(i);const o=t.createGain(),s=e.character?.modulationDepth??0;o.gain.value=1-s/2;const r=t.createOscillator();r.type="sine";const h=t.createGain();h.gain.value=s/2,r.connect(h).connect(o.gain),o.connect(a);const c=t.createBufferSource();c.buffer=this.noise(t),c.loop=!0,c.loopStart=Math.random()*Z*.5;const d=[],l=[],u=[];for(const S of f.OCTAVES){const O=t.createBiquadFilter();O.type="bandpass",O.frequency.value=S,O.Q.value=tt;const C=t.createBiquadFilter();C.type="bandpass",C.frequency.value=S,C.Q.value=tt;const y=t.createGain();y.gain.value=0,c.connect(O).connect(C).connect(y).connect(o),d.push(O),l.push(C),u.push(y)}const p=[];for(const[S,O]of[[e.character?.toneHz,e.character?.toneShare],[e.character?.humHz,e.character?.humShare]])if(S!==void 0)for(let C=1;C<=Mt;C++){const y=t.createOscillator();y.type="sine",y.frequency.value=S*C;const V=t.createGain();V.gain.value=0,y.connect(V).connect(a),p.push({oscillator:y,gain:V,harmonic:C,baseHz:S,share:O??0})}const m=t.createGain();m.gain.value=0,m.connect(a.gain);const A=nt.map(S=>{const O=t.createOscillator();return O.type="sine",O.frequency.value=S,O.connect(m),O}),b=t.createGain();b.gain.value=e.character?.roughness??Q;const w=t.createBufferSource();w.buffer=this.roughTable(t,mt),w.loop=!0,w.loopStart=Math.random()*U*.5,w.connect(b).connect(o.gain);const _=t.createGain();_.gain.value=(e.character?.roughness??Q)*gt;const R=t.createBufferSource();R.buffer=this.roughTable(t,ft),R.loop=!0,R.loopStart=Math.random()*U*.5,R.connect(_).connect(o.gain);let B;const j=this.busOf(t)&&this.reverb;j&&(B=t.createGain(),B.gain.value=0,a.connect(B).connect(j));const W=[c,w,R,r,...p.map(S=>S.oscillator),...A];for(const S of W)S.start();const Y={nodes:[a,o,h,b,_,m,...p.map(S=>S.gain),...d,...l,...u,...B?[B]:[],...n?[n]:[],...W],sources:W,filters:d,seconds:l,gains:u,tones:p,lfo:r,lfoDepth:h,wander:A,wanderDepth:m,roughDepth:b,crackleDepth:_,beat:o,output:a,panner:n,send:B};return this.voices.set(e.id,Y),Y}retarget(t,e,a){const n=t.currentTime,i=(p,m)=>p.setTargetAtTime(m,n,pt),o=Math.min(bt,Math.max(Et,a.dopplerRatio)),s=Math.min(St,Math.max(Dt,Math.sqrt(a.dopplerRatio))),r=t.sampleRate*.45,h=a.bandAmplitudes.map((p,m)=>p*$.unweighting(f.OCTAVES[m])),c=Math.sqrt(h.reduce((p,m)=>p+m*m,0)),d=Math.min(1,Math.max(0,(a.distanceKm-at)/(Rt-at)));f.OCTAVES.forEach((p,m)=>{i(e.filters[m].frequency,Math.min(r,p*s)),i(e.seconds[m].frequency,Math.min(r,p*s)),i(e.gains[m].gain,h[m]*Math.sqrt(Ct/p))});const l=a.character;for(const{oscillator:p,gain:m,harmonic:A,baseHz:b,share:w}of e.tones){const _=b*A;i(p.frequency,_*o);const R=_*o;i(m.gain,R<r?w*Bt*h[$.bandOf(R)]/A:0)}l?.modulationHz!==void 0&&i(e.lfo.frequency,l.modulationHz*o);const u=c>0?st*(1-Math.exp(-c/st))/c:1;if(i(e.output.gain,u*(1-_t*d)),i(e.wanderDepth.gain,u*Ot*d/nt.length),e.send&&i(e.send.gain,It*d),e.panner){const p=(a.azimuthDeg-this.headingDeg)*Math.PI/180;i(e.panner.pan,Math.max(-et,Math.min(et,Math.sin(p)))*(1-vt*d))}}static unweighting(t){return 10**(Math.min(At,Math.max(0,-f.aWeightingDb(t)))/20)}static bandOf(t){let e=0;return f.OCTAVES.forEach((a,n)=>{Math.abs(Math.log(t/a))<Math.abs(Math.log(t/f.OCTAVES[e]))&&(e=n)}),e}roughTable(t,e){const a=this.roughBuffers.get(e);if(a)return a;const n=Math.floor(t.sampleRate*U),i=t.createBuffer(1,n,t.sampleRate),o=i.getChannelData(0),s=Array.from({length:U*e},()=>(Math.random()*2-1)**3),r=t.sampleRate/e;for(let h=0;h<o.length;h++){const c=h/r,d=Math.floor(c),l=c-d,u=l*l*(3-2*l);o[h]=s[d%s.length]*(1-u)+s[(d+1)%s.length]*u}return this.roughBuffers.set(e,i),i}roomImpulse(t){const e=Math.floor(t.sampleRate*Tt),a=t.createBuffer(2,e,t.sampleRate);for(let n=0;n<2;n++){const i=a.getChannelData(n);let o=0;for(let s=0;s<e;s++){const r=s/t.sampleRate,h=.6*Math.exp(-r/(it*2))+.04;o+=h*(Math.random()*2-1-o),i[s]=o*Math.exp(-r/it)}}return a}busOf(t){if(this.bus)return this.bus;const e=t.createGain();if(e.gain.value=this.level,e.connect(t.destination),this.master=e,typeof t.createConvolver=="function"){const a=t.createConvolver();a.buffer=this.roomImpulse(t);const n=t.createGain();n.gain.value=.9,a.connect(n),this.reverb=a,this.reverbOut=n}if(typeof t.createDynamicsCompressor=="function"){const a=t.createDynamicsCompressor();a.threshold.value=-6,a.knee.value=3,a.ratio.value=4,a.attack.value=.005,a.release.value=.25,a.connect(e),this.bus=a}else this.bus=e;return this.reverbOut?.connect(this.bus),this.bus}release(t){const e=this.voices.get(t);if(!e)return;this.voices.delete(t);const a=this.context;a&&(e.output.gain.setTargetAtTime(0,a.currentTime,x/3),setTimeout(()=>{for(const n of e.sources)try{n.stop()}catch{}for(const n of e.nodes)n.disconnect()},x*1e3*3))}noise(t){if(this.noiseBuffer)return this.noiseBuffer;const e=t.createBuffer(1,t.sampleRate*Z,t.sampleRate),a=e.getChannelData(0);for(let n=0;n<a.length;n++)a[n]=Math.random()*2-1;return this.noiseBuffer=e,e}}class I{static BASE_DB_A=30;static WIND_DB_A=[[0,10],[1,28],[2,36],[3,40],[5,46],[8,52],[12,58],[20,66]];static RAIN_DB_A=[[0,0],[.1,42],[.3,50],[.6,58],[1,65]];static BED_RMS=.2;static MINIMUM_REFERENCE=.008;static WIND_BED_MIN_MS=1;static WIND_BED_FULL_MS=20;static dbA(t){const e=[I.BASE_DB_A,I.along(I.WIND_DB_A,t.windSpeed)];return(t.precipitationType==="rain"||t.precipitationType==="hail")&&e.push(I.along(I.RAIN_DB_A,t.precipitationIntensity)),10*Math.log10(e.filter(a=>a>0).reduce((a,n)=>a+10**(n/10),0))}static bedVolume(t){const e=t.windSpeed>I.WIND_BED_MIN_MS?Math.min(t.windSpeed/I.WIND_BED_FULL_MS,1):0,a=t.precipitationType==="hail"?Math.min(1,t.precipitationIntensity*1.3+.2):t.precipitationType==="rain"?t.precipitationIntensity:0;return Math.hypot(e,a)}static referenceAmplitude(t){return Math.max(I.BED_RMS*I.bedVolume(t),I.MINIMUM_REFERENCE)}static along(t,e){if(e<=t[0][0])return t[0][1];for(let a=1;a<t.length;a++)if(e<=t[a][0]){const[n,i]=t[a-1],[o,s]=t[a];return i+(s-i)*(e-n)/(o-n)}return t[t.length-1][1]}}class N{static TYPES={A318:["Airbus A318","airliner-narrow",34.1,31.4],A319:["Airbus A319","airliner-narrow",34.1,33.8],A320:["Airbus A320","airliner-narrow",34.1,37.6],A321:["Airbus A321","airliner-narrow",34.1,44.5],A19N:["Airbus A319neo","airliner-narrow",35.8,33.8],A20N:["Airbus A320neo","airliner-narrow",35.8,37.6],A21N:["Airbus A321neo","airliner-narrow",35.8,44.5],B737:["Boeing 737-700","airliner-narrow",34.3,33.6],B738:["Boeing 737-800","airliner-narrow",35.8,39.5],B739:["Boeing 737-900","airliner-narrow",35.8,42.1],B38M:["Boeing 737 MAX 8","airliner-narrow",35.9,39.5],B39M:["Boeing 737 MAX 9","airliner-narrow",35.9,42.2],B752:["Boeing 757-200","airliner-narrow",38,47.3],B753:["Boeing 757-300","airliner-narrow",38,54.4],B762:["Boeing 767-200","airliner-wide",47.6,48.5],B763:["Boeing 767-300","airliner-wide",47.6,54.9],B764:["Boeing 767-400","airliner-wide",51.9,61.4],B772:["Boeing 777-200","airliner-wide",60.9,63.7],B77L:["Boeing 777-200LR","airliner-wide",64.8,63.7],B77W:["Boeing 777-300ER","airliner-wide",64.8,73.9],B788:["Boeing 787-8","airliner-wide",60.1,56.7],B789:["Boeing 787-9","airliner-wide",60.1,62.8],B78X:["Boeing 787-10","airliner-wide",60.1,68.3],B744:["Boeing 747-400","airliner-wide",64.4,70.7],B748:["Boeing 747-8","airliner-wide",68.4,76.3],A306:["Airbus A300-600","airliner-wide",44.8,54.1],A310:["Airbus A310","airliner-wide",43.9,46.7],A332:["Airbus A330-200","airliner-wide",60.3,58.8],A333:["Airbus A330-300","airliner-wide",60.3,63.7],A338:["Airbus A330-800","airliner-wide",64,58.8],A339:["Airbus A330-900","airliner-wide",64,63.7],A343:["Airbus A340-300","airliner-wide",60.3,63.7],A346:["Airbus A340-600","airliner-wide",63.5,75.4],A359:["Airbus A350-900","airliner-wide",64.8,66.8],A35K:["Airbus A350-1000","airliner-wide",64.8,73.8],A388:["Airbus A380-800","airliner-wide",79.8,72.7],E170:["Embraer 170","regional-jet",26,29.9],E75L:["Embraer 175","regional-jet",26,31.7],E75S:["Embraer 175","regional-jet",26,31.7],E190:["Embraer 190","regional-jet",28.7,36.2],E195:["Embraer 195","regional-jet",28.7,38.7],E290:["Embraer 190-E2","regional-jet",33.7,36.2],E295:["Embraer 195-E2","regional-jet",33.7,41.5],CRJ2:["Bombardier CRJ200","regional-jet",21.2,26.8],CRJ7:["Bombardier CRJ700","regional-jet",23.2,32.3],CRJ9:["Bombardier CRJ900","regional-jet",24.9,36.2],CRJX:["Bombardier CRJ1000","regional-jet",26.2,39.1],AT72:["ATR 72","regional-turboprop",27.1,27.2],AT76:["ATR 72-600","regional-turboprop",27.1,27.2],AT45:["ATR 42","regional-turboprop",24.6,22.7],DH8D:["Dash 8 Q400","regional-turboprop",28.4,32.8],DH8C:["Dash 8-300","regional-turboprop",27.4,25.7],SF34:["Saab 340","regional-turboprop",21.4,19.7],B190:["Beechcraft 1900","regional-turboprop",17.7,17.6],C25A:["Cessna CitationJet CJ2","business-jet",14.3,14.4],C56X:["Cessna Citation Excel","business-jet",17.2,16],C68A:["Cessna Citation Latitude","business-jet",22,18.9],C550:["Cessna Citation II","business-jet",15.8,14.4],E55P:["Embraer Phenom 300","business-jet",15.9,15.6],E50P:["Embraer Phenom 100","business-jet",12.3,12.8],GLF5:["Gulfstream G550","business-jet",28.5,29.4],FA7X:["Dassault Falcon 7X","business-jet",26.2,23.4],CL60:["Bombardier Challenger 600","business-jet",19.6,20.9],LJ45:["Learjet 45","business-jet",14.6,17.7],H25B:["Hawker 800","business-jet",15.7,15.6],C172:["Cessna 172","light-piston",11,8.3],C152:["Cessna 152","light-piston",10.2,7.3],C182:["Cessna 182","light-piston",10.9,8.8],P28A:["Piper Cherokee","light-piston",10.7,7.2],PA34:["Piper Seneca","light-piston",11.8,8.7],SR20:["Cirrus SR20","light-piston",10.9,7.9],SR22:["Cirrus SR22","light-piston",11.7,7.9],S22T:["Cirrus SR22T","light-piston",11.7,7.9],DA40:["Diamond DA40","light-piston",11.6,8.1],DA42:["Diamond DA42","light-piston",13.4,8.6],BE20:["Beechcraft King Air 200","turboprop-light",16.6,13.3],BE58:["Beechcraft Baron","light-piston",11.5,9.1],C208:["Cessna Caravan","turboprop-light",15.9,11.5],PC12:["Pilatus PC-12","turboprop-light",16.3,14.4],TBM9:["Daher TBM 900","turboprop-light",12.8,10.7],EC35:["Airbus H135","helicopter-light",10.2,12.1],EC45:["Airbus H145","helicopter-medium",11,13.6],AS50:["Airbus H125","helicopter-light",10.7,12.9],EC30:["Airbus H130","helicopter-light",10.7,12.6],B407:["Bell 407","helicopter-light",10.7,12.7],B06:["Bell 206","helicopter-light",10.2,12],B429:["Bell 429","helicopter-medium",10.9,13],B505:["Bell 505","helicopter-light",10.4,11.9],R44:["Robinson R44","helicopter-light",10.1,11.7],R22:["Robinson R22","helicopter-light",7.7,8.8],A109:["Agusta A109","helicopter-medium",11,13],A139:["Leonardo AW139","helicopter-medium",13.8,16.7],S92:["Sikorsky S-92","helicopter-heavy",17.2,20.9],H60:["Sikorsky UH-60 Black Hawk","helicopter-heavy",16.4,19.8],T38:["Northrop T-38 Talon","military-jet",7.7,14.1],HAWK:["BAE Hawk","military-jet",9.4,11.9],GLID:["Glider","glider",17,7],BALL:["Balloon","balloon",15,20],ULAC:["Ultralight","ultralight",9.5,6],C42:["Ikarus C42","ultralight",9.4,6.3],DRON:["Drone","unmanned",1,.6]};static CATEGORIES={A1:["Light aircraft","light-piston",11,8.3],A2:["Small aircraft","business-jet",15,15],A3:["Large aircraft","airliner-narrow",34.1,37.6],A4:["High-vortex large aircraft","airliner-narrow",38,47.3],A5:["Heavy aircraft","airliner-wide",60.3,63.7],A6:["High-performance aircraft","military-jet",8,14],A7:["Rotorcraft","helicopter-medium",10.7,12.7],B1:["Glider","glider",17,7],B2:["Lighter-than-air","balloon",15,20],B4:["Ultralight","ultralight",9.5,6],B6:["Unmanned aircraft","unmanned",1.5,1]};static GENERIC={name:"Airliner",kind:"airliner-narrow",spanM:34.1,lengthM:37.6,basis:"nothing"};static of(t){const e=t?.type?.toUpperCase(),a=e?N.TYPES[e]:void 0;if(a)return{code:e,name:a[0],kind:a[1],spanM:a[2],lengthM:a[3],basis:"type"};const n=t?.category?N.CATEGORIES[t.category]:void 0;return n?{name:n[0],kind:n[1],spanM:n[2],lengthM:n[3],basis:"category"}:{...N.GENERIC}}static isHelicopter(t){return t.kind.startsWith("helicopter")}}class H{static DUSK_SUN_ELEVATION_DEG=-.83;static ALWAYS=new Set(["airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet"]);static NONE=new Set(["glider","balloon"]);static BRIGHTNESS={"light-piston":[.5,.2,.5],"turboprop-light":[.7,.4,.8],ultralight:[.4,.2,.4],unmanned:[0,.05,0],"helicopter-light":[1,1,1],"helicopter-medium":[1,1,1],"helicopter-heavy":[1,1,1],"military-jet":[1,1,1]};static lampsOn(t,e){if(H.NONE.has(t))return{navigation:!1,beacon:!1,strobes:!1};if(H.ALWAYS.has(t))return{navigation:!0,beacon:!0,strobes:!0};const a=e<H.DUSK_SUN_ELEVATION_DEG;return t==="unmanned"?{navigation:!1,beacon:!1,strobes:a}:{navigation:a,beacon:a,strobes:a}}static lights(t,e){const a=H.lampsOn(t.kind,e),n=t.kind.startsWith("helicopter"),i=ut.find(u=>u.id===(n?"helicopter":"airliner")).create(),[o,s]=n?[5,7]:[17,18],r=t.spanM/2/o,h=t.lengthM/2/s,[c,d,l]=H.BRIGHTNESS[t.kind]??[1,1,1];return i.filter(u=>u.id.startsWith("nav")?a.navigation:u.id.startsWith("strobe")?a.strobes:u.id.startsWith("beacon")?a.beacon:!0).filter(u=>!(u.id.startsWith("beacon")&&!a.beacon)).map(u=>{const p=u.id.startsWith("nav")?c:u.id.startsWith("strobe")?d:l;return{...u,offsetM:{x:u.offsetM.x*r,y:u.offsetM.y,z:u.offsetM.z*h},intensity:(u.intensity??1)*p}}).filter(u=>(u.intensity??1)>0)}static bodyColor(t){return t.kind==="military-jet"?"#8a8e94":t.kind.startsWith("helicopter")?"#c8ccd1":t.kind==="unmanned"?"#2c2e33":"#dde0e4"}}class G{static FAMILIES={"amvlab-a320":["A318","A319","A320","A321","A19N","A20N","A21N"],"amvlab-b737":["B732","B733","B734","B735","B736","B737","B738","B739","B37M","B38M","B39M","B3XM"],"amvlab-a350":["A359","A35K"],"amvlab-a380":["A388"],"amvlab-b787":["B788","B789","B78X"]};static BY_TYPE=new Map(Object.entries(G.FAMILIES).flatMap(([t,e])=>e.map(a=>[a,t])));static idOf(t){return t?G.BY_TYPE.get(t.toUpperCase()):void 0}}class E{static ID_PREFIX=K.ID_PREFIX;static MAX_OBJECTS=40;static FT_TO_M=.3048;static DEG=Math.PI/180;static from(t,e,a,n=E.MAX_OBJECTS,i={}){return new wt(t,e,a,n,i).build()}static idOf(t,e){return K.idOf(t,e)}static keyOf(t){return K.keyOf(t)}static HEIGHT_OVER_LENGTH=.29;static sizeOf(t){return{widthM:t.spanM,lengthM:t.lengthM,heightM:t.lengthM*E.HEIGHT_OVER_LENGTH}}static offsetOf(t,e){const a=P.seenFrom(t,{lat:e.lat,lng:e.lng,heightM:e.altitudeFt*E.FT_TO_M}),n=a.distanceKm*1e3,i=n*Math.cos(a.altitudeDeg*E.DEG);return{eastM:i*Math.sin(a.azimuthDeg*E.DEG),northM:i*Math.cos(a.azimuthDeg*E.DEG),upM:n*Math.sin(a.altitudeDeg*E.DEG),altitudeDeg:a.altitudeDeg,distanceKm:a.distanceKm}}static segments(t){const e=[];let a=[];for(const n of t.points){const i=a[a.length-1];i&&n.t-i.t>L.MAX_GAP_S*1e3&&(e.push(a),a=[]),a.push(n)}return e.push(a),e.filter(n=>n.length>=2)}static bearingDeg(t,e){return(Math.atan2(e.eastM-t.eastM,e.northM-t.northM)/E.DEG+360)%360}}class wt{constructor(t,e,a,n,i){this.tracks=t,this.observer=e,this.startMs=a,this.maxObjects=n,this.options=i}build(){const t=[];for(const a of this.tracks){const n=E.keyOf(a),i=this.options.models?.get(n)??N.of(void 0);E.segments(a).forEach((o,s)=>{const r=o.map(u=>({point:u,at:E.offsetOf(this.observer,u)}));if(!r.some(u=>u.at.altitudeDeg>=0))return;const h=r.map((u,p)=>({t:u.point.t-this.startMs,eastM:u.at.eastM,northM:u.at.northM,altitudeM:u.at.upM,headingDeg:u.point.trackDeg??(p+1<r.length?E.bearingDeg(u.at,r[p+1].at):E.bearingDeg(r[p-1].at,u.at))})),c=E.idOf(a,s),d=r[Math.floor(r.length/2)].point,l=this.options.sunElevationAt?.(d)??90;t.push({object:{id:c,kind:"aircraft",eastM:h[0].eastM,northM:h[0].northM,headingDeg:h[0].headingDeg,sizeM:E.sizeOf(i),model:G.idOf(i.code)?{id:G.idOf(i.code)}:void 0,color:H.bodyColor(i),lights:H.lights(i,l),track:h},presence:{fromMs:h[0].t,untilMs:h[h.length-1].t},flight:{icao:a.icao,nonIcao:a.nonIcao,points:o},closestKm:Math.min(...r.map(u=>u.at.distanceKm))})})}t.sort((a,n)=>a.closestKm-n.closestKm);const e=t.slice(0,this.maxObjects);return{objects:e.map(a=>a.object),presence:new Map(e.map(a=>[a.object.id,a.presence])),flights:new Map(e.map(a=>[a.object.id,a.flight])),total:t.length,shown:e.length}}}const lt=[{id:"turbofan-narrow-body",name:"Turbofan airliner, narrow-body",kinds:["airliner-narrow"],totalDbA:148,shapeDb:[-32,-17,-9,-6,-5,-7,-12,-22],character:{toneHz:1800,toneShare:.3,humHz:90,humShare:.7}},{id:"turbofan-wide-body",name:"Turbofan airliner, wide-body",kinds:["airliner-wide"],totalDbA:151,shapeDb:[-28,-14,-7,-4,-3,-6,-12,-22],character:{toneHz:1200,toneShare:.3,humHz:70,humShare:.7}},{id:"regional-jet",name:"Regional jet",kinds:["regional-jet"],totalDbA:144,shapeDb:[-32,-17,-9,-5,-4,-6,-11,-21],character:{toneHz:1900,toneShare:.3,humHz:95,humShare:.7}},{id:"business-jet",name:"Business jet",kinds:["business-jet"],totalDbA:141,shapeDb:[-30,-15,-8,-4,-3,-4,-9,-19],character:{toneHz:2500,toneShare:.25,humHz:110,humShare:.7}},{id:"turboprop",name:"Turboprop",kinds:["regional-turboprop","turboprop-light"],totalDbA:138,shapeDb:[-14,-9,-8,-6,-8,-13,-20,-28],character:{toneHz:80,toneShare:.5}},{id:"light-piston",name:"Light piston aircraft",kinds:["light-piston"],totalDbA:130,shapeDb:[-18,-9,-5,-4,-8,-14,-22,-30],character:{toneHz:80,toneShare:.4}},{id:"ultralight",name:"Ultralight",kinds:["ultralight"],totalDbA:124,shapeDb:[-16,-8,-5,-4,-9,-15,-23,-31],character:{toneHz:140,toneShare:.4}},{id:"helicopter-light",name:"Light helicopter",kinds:["helicopter-light"],totalDbA:134,shapeDb:[-15,-8,-4,-3,-6,-10,-16,-24],character:{modulationHz:20,modulationDepth:.5}},{id:"helicopter-medium",name:"Medium helicopter",kinds:["helicopter-medium"],totalDbA:138,shapeDb:[-14,-7,-4,-3,-6,-10,-16,-24],character:{modulationHz:22,modulationDepth:.5}},{id:"helicopter-heavy",name:"Heavy helicopter",kinds:["helicopter-heavy"],totalDbA:144,shapeDb:[-12,-6,-4,-4,-7,-11,-17,-25],character:{modulationHz:17,modulationDepth:.5}},{id:"military-jet",name:"Military jet",kinds:["military-jet"],totalDbA:152,shapeDb:[-26,-12,-6,-3,-2,-3,-7,-15]},{id:"glider",name:"Glider",kinds:["glider"],totalDbA:85,shapeDb:[-30,-22,-15,-10,-8,-8,-14,-22]},{id:"balloon",name:"Hot-air balloon",kinds:["balloon"],totalDbA:100,shapeDb:[-25,-15,-9,-5,-3,-6,-12,-20]},{id:"unmanned",name:"Unmanned aircraft",kinds:["unmanned"],totalDbA:88,shapeDb:[-40,-30,-20,-12,-6,-3,-3,-8],character:{toneHz:450,toneShare:1}}],rt=lt.map(T=>({id:T.id,name:T.name,soundPowerA:T.shapeDb.map(t=>t+T.totalDbA-f.sumDb(T.shapeDb)),character:T.character}));class g{static DEFAULT_AMBIENT_DB_A=35;static DETECTION_MARGIN_DB=3;static AMBIENT_SHAPE_DB=[-12,-7,-5,-5,-7,-11,-17,-25];static HEARING_FLOOR_DB_A=0;static ITERATIONS=30;static CONVERGED_MS=.5;static VELOCITY_STEP_MS=500;static noiseOfKind(t){const e=lt.find(a=>a.kinds.includes(t));return rt.find(a=>a.id===(e?.id??"turbofan-narrow-body"))}static bandsAt(t,e,a=f.STANDARD){const n=20*Math.log10(Math.max(e*1e3,1))+11;return f.OCTAVES.map((i,o)=>t.soundPowerA[o]-n-f.absorptionDbPerKm(i,a)*e)}static couldBeHeard(t,e,a=g.DEFAULT_AMBIENT_DB_A,n=f.STANDARD){const i=g.ambientBands(a);return g.bandsAt(t,e,n).some((o,s)=>o>=Math.max(i[s]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A))}static ambientBands(t){const e=g.AMBIENT_SHAPE_DB,a=f.sumDb(e);return e.map(n=>t+n-a)}static heardAt(t,e,a,n={}){const i=n.air??f.STANDARD,o=f.speedOfSound(i.temperatureC),s=t.points[t.points.length-1]?.t;if(s===void 0)return;let r=Math.min(a,s),h=L.positionAt(t,r);if(!h)return;let c=P.seenFrom(e,h.geo);for(let R=0;R<g.ITERATIONS;R++){const B=a-c.distanceKm*1e3*1e3/o,j=Math.abs(B-r);if(r=B,h=L.positionAt(t,r),!h)return;if(c=P.seenFrom(e,h.geo),j<g.CONVERGED_MS)break}const d=L.positionAt(t,a),l=d?P.seenFrom(e,d.geo):c,u=n.noise??rt[0],p=n.ambientDbA??g.DEFAULT_AMBIENT_DB_A,m=g.ambientBands(p),A=g.bandsAt(u,c.distanceKm,i),b=A.map((R,B)=>R>=Math.max(m[B]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A)),w=A.indexOf(Math.max(...A)),_=b.lastIndexOf(!0);return{track:t,audible:b.some(Boolean),levelDbA:f.sumDb(A),bandsDbA:A,ambientDbA:p,delayS:(a-r)/1e3,emittedAtMs:r,sound:c,seen:l,lagDeg:g.angleBetween(c,l),dopplerRatio:g.doppler(t,e,r,o),dominantHz:f.OCTAVES[w],cutoffHz:_<0?void 0:f.OCTAVES[_]}}static profile(t,e,a,n,i=2e3,o={}){const s=[];let r,h,c=a;for(let d=a;d<=n;d+=i){const l=g.heardAt(t,e,d,o);l&&(!h||l.levelDbA>h.levelDbA)&&(h=l,c=d),l?.audible?r?r.untilMs=d:s.push(r={fromMs:d,untilMs:d}):r=void 0}return{track:t,audible:s,peakDbA:h?.levelDbA??-1/0,peakAtMs:c,peakDelayS:h?.delayS??0}}static angleBetween(t,e){const a=c=>{const d=c.altitudeDeg*Math.PI/180,l=c.azimuthDeg*Math.PI/180;return[Math.cos(d)*Math.sin(l),Math.cos(d)*Math.cos(l),Math.sin(d)]},[n,i,o]=a(t),[s,r,h]=a(e);return Math.acos(Math.min(1,Math.max(-1,n*s+i*r+o*h)))*180/Math.PI}static doppler(t,e,a,n){const i=g.VELOCITY_STEP_MS,o=L.positionAt(t,a-i),s=L.positionAt(t,a+i);if(!o||!s)return 1;const r=P.seenFrom(e,o.geo).distanceKm*1e3,h=P.seenFrom(e,s.geo).distanceKm*1e3;return 1/(1-(r-h)/(2*i/1e3)/n)}}class Lt{static at(t,e,a,n,i={}){const o=L.seenFrom(t,a,n);if(!o)return;const s=N.of(e),r=g.heardAt(t,a,n,{noise:g.noiseOfKind(s.kind),...i});return{hex:`${t.nonIcao?"~":""}${t.icao.toString(16).padStart(6,"0")}`,registration:e?.registration,typeCode:s.code??e?.type,name:s.basis==="nothing"?void 0:s.name,kind:s.kind,basis:s.basis,military:e?.military===!0,restricted:e?.restricted===!0,altitudeFt:o.altitudeFt,groundSpeedKt:o.groundSpeedKt,trackDeg:o.trackDeg,sky:o.sky,angularRateDegPerS:o.angularRateDegPerS,hearing:r&&{audible:r.audible,levelDbA:r.levelDbA,ambientDbA:r.ambientDbA,delayS:r.delayS,lagDeg:r.lagDeg,dopplerRatio:r.dopplerRatio,cutoffHz:r.cutoffHz,dominantHz:r.dominantHz}}}}class D{static REFERENCE_AMPLITUDE=.02;static MASKING_RANGE_DB=6;static KNEE_DB=20;static COMPRESSION_RATIO=1.5;static EXPANSION_RATIO=1.8;static DEFAULT_MAX_VOICES=4;static candidates(t,e,a,n,i={}){const o=new Set;for(const[s,r]of t){const h=g.noiseOfKind(N.of(e.get(a(r))).kind);let c=1/0;for(const d of r.points)c=Math.min(c,P.seenFrom(n,{lat:d.lat,lng:d.lng,heightM:d.altitudeFt*.3048}).distanceKm);g.couldBeHeard(h,c,i.ambientDbA,i.air)&&o.add(s)}return o}static voices(t,e,a,n,i,o,s={}){const r=[];for(const h of t){const c=e.get(h);if(!c||s.only?.(h)===!1)continue;const d=s.kindOf?.(h)??N.of(a.get(n(c))).kind,l=s.noiseOf?.(h)??g.noiseOfKind(d),u=g.heardAt(c,i,o,{...s,noise:l});u?.audible&&r.push({id:h,kind:d,bandAmplitudes:D.bandAmplitudes(u.bandsDbA,u.ambientDbA,s.referenceAmplitude),levelDbA:u.levelDbA,distanceKm:u.sound.distanceKm,dopplerRatio:u.dopplerRatio,azimuthDeg:u.sound.azimuthDeg,elevationDeg:u.sound.altitudeDeg,character:l.character})}return r.sort((h,c)=>c.levelDbA-h.levelDbA).slice(0,s.maxVoices??D.DEFAULT_MAX_VOICES)}static bandAmplitudes(t,e,a=D.REFERENCE_AMPLITUDE){const n=g.ambientBands(e),i=g.DETECTION_MARGIN_DB,o=f.sumDb(t),s=o-e,r=s>=D.KNEE_DB?D.KNEE_DB+(s-D.KNEE_DB)/D.COMPRESSION_RATIO:D.KNEE_DB-(D.KNEE_DB-s)*D.EXPANSION_RATIO,h=a*10**(r/20);return t.map((c,d)=>{const l=Math.min(1,Math.max(0,(c-n[d]-i+D.MASKING_RANGE_DB)/(2*D.MASKING_RANGE_DB)));return l*l*(3-2*l)*h*10**((c-o)/20)})}static BANDS_HZ=f.OCTAVES}class z{static ENGLISH={unnamed:"Aircraft {hex}",altitude:"{value} ft",speed:"{value} kt",heading:"heading {value}°",position:"{distance} km away, {elevation}° above the horizon, {bearing}",heard:"Heard at {level} dB(A), left the aircraft {delay} s ago, {lag}° behind it: {character}{pitch}",rumble:"a low rumble, nothing above {cutoff} Hz",muffled:"a dull noise, nothing above {cutoff} Hz",broad:"a broad roar",pitchHigher:", pitch {percent} % higher",pitchLower:", pitch {percent} % lower",inaudible:"Not audible here: {level} dB(A) against {ambient} dB(A) of ambient noise",soundUnknown:"Its sound cannot be worked out: the aircraft was not recorded yet when it left",contrailPersistent:"Leaves a trail that lasts: the air is supersaturated over ice ({rhi} % over ice)",contrailShort:"Leaves a short-lived trail: the air is dry over ice ({rhi} % over ice)",military:"military",restricted:"identity withheld by its owner",candidate:"A compatible candidate, not an identification"};static RUMBLE_BELOW_HZ=500;static DULL_BELOW_HZ=2e3;static PITCH_NOTICED=.03;static text(t,e,a,n){const i=(l,u=0)=>l.toLocaleString(n,{maximumFractionDigits:u}),o=(l,u)=>l.replace(/\{(\w+)\}/g,(p,m)=>u[m]??`{${m}}`),s=[],r=[t.registration,t.name].filter(Boolean).join(" · ");s.push(r||o(e.unnamed,{hex:t.hex}));const h=[o(e.altitude,{value:i(Math.round(t.altitudeFt/100)*100)}),t.groundSpeedKt===void 0?void 0:o(e.speed,{value:i(Math.round(t.groundSpeedKt))}),t.trackDeg===void 0?void 0:o(e.heading,{value:i(Math.round(t.trackDeg))})].filter(Boolean);s.push(h.join(" · ")),s.push(o(e.position,{distance:i(t.sky.distanceKm,t.sky.distanceKm<10?1:0),elevation:i(Math.round(t.sky.altitudeDeg)),bearing:a(t.sky.azimuthDeg)}));const c=t.hearing;if(!c)s.push(e.soundUnknown);else if(!c.audible)s.push(o(e.inaudible,{level:i(Math.round(c.levelDbA)),ambient:i(Math.round(c.ambientDbA))}));else{const l=c.cutoffHz??0,u=l<=z.RUMBLE_BELOW_HZ?e.rumble:l<=z.DULL_BELOW_HZ?e.muffled:e.broad,p=c.dopplerRatio-1,m=Math.abs(p)<z.PITCH_NOTICED?"":o(p>0?e.pitchHigher:e.pitchLower,{percent:i(Math.round(Math.abs(p)*100))});s.push(o(e.heard,{level:i(Math.round(c.levelDbA)),delay:i(Math.round(c.delayS)),lag:i(Math.round(c.lagDeg)),character:o(u,{cutoff:i(l)}),pitch:m}))}t.contrail&&s.push(o(t.contrail.persistent?e.contrailPersistent:e.contrailShort,{rhi:i(Math.round(t.contrail.iceRelativeHumidity*100))}));const d=[t.military?e.military:void 0,t.restricted?e.restricted:void 0].filter(Boolean);return d.length>0&&s.push(d.join(" · ")),s.push(e.candidate),s.join(`
2
+ `)}}class q{static EFFICIENCY={"airliner-narrow":.34,"airliner-wide":.38,"regional-jet":.32,"business-jet":.3,"military-jet":.22,unknown:.34};static efficiencyOf(t){return q.EFFICIENCY[t]}}class M{static EMISSION_INDEX_WATER=1.25;static COMBUSTION_HEAT=432e5;static AIR_HEAT_CAPACITY=1004;static MOLAR_MASS_RATIO=.622;static FT_TO_M=.3048;static TROPOPAUSE_M=11e3;static TROPOPAUSE_HPA=226.32;static ISOTHERMAL_SCALE_HEIGHT_M=6341.62;static pressureAtAltitudeFt(t){const e=t*M.FT_TO_M;return e<=M.TROPOPAUSE_M?1013.25*(1-225577e-10*e)**5.25588:M.TROPOPAUSE_HPA*Math.exp(-(e-M.TROPOPAUSE_M)/M.ISOTHERMAL_SCALE_HEIGHT_M)}static saturationOverWaterPa(t){const e=t+273.15;return Math.exp(54.842763-6763.22/e-4.21*Math.log(e)+367e-6*e+Math.tanh(.0415*(e-218.8))*(53.878-1331.22/e-9.44523*Math.log(e)+.014025*e))}static saturationOverIcePa(t){const e=t+273.15;return Math.exp(9.550426-5723.265/e+3.53068*Math.log(e)-.00728332*e)}static iceRelativeHumidity(t,e){return e*M.saturationOverWaterPa(t)/M.saturationOverIcePa(t)}static mixingSlope(t,e){return M.EMISSION_INDEX_WATER*M.AIR_HEAT_CAPACITY*t*100/(M.MOLAR_MASS_RATIO*M.COMBUSTION_HEAT*(1-e))}static criticalTemperatureC(t,e){const a=Math.log(M.mixingSlope(t,e)-.053);return-46.46+9.43*a+.72*a*a}static requiredHumidity(t,e,a){const n=M.criticalTemperatureC(t,e);return(M.mixingSlope(t,e)*(a-n)+M.saturationOverWaterPa(n))/M.saturationOverWaterPa(a)}static evaluate(t,e){const a=M.criticalTemperatureC(t.pressureHpa,e),n=M.requiredHumidity(t.pressureHpa,e,t.temperatureC),i=M.iceRelativeHumidity(t.temperatureC,t.relativeHumidity),o=t.temperatureC<a&&t.relativeHumidity>=n;return{forms:o,persistent:o&&i>=1,criticalTemperatureC:a,requiredHumidity:n,iceRelativeHumidity:i}}}class k{static HOLD_MS=36e5;static DEG=Math.PI/180;static GAS_CONSTANT_OVER_GRAVITY=287.05/9.80665;static at(t,e,a){if(t.length===0)return;const n=t[0],i=t[t.length-1];if(e<n.t-k.HOLD_MS||e>i.t+k.HOLD_MS)return;const o=t.findIndex(u=>u.t>e),s=o===0?t[0]:t[(o===-1?t.length:o)-1],r=o===-1||o===0?s:t[o],h=k.atLevel(s,a),c=k.atLevel(r,a);if(!h||!c)return;const d=r.t>s.t?Math.min(1,Math.max(0,(e-s.t)/(r.t-s.t))):0,l=(u,p)=>u+(p-u)*d;return{pressureHpa:a,temperatureC:l(h.temperatureC,c.temperatureC),relativeHumidity:l(h.relativeHumidity,c.relativeHumidity),driftEastMs:l(h.driftEastMs,c.driftEastMs),driftNorthMs:l(h.driftNorthMs,c.driftNorthMs),shearPerS:l(h.shearPerS,c.shearPerS)}}static atLevel(t,e){const a=t.levels;for(let n=0;n+1<a.length;n++){const i=a[n],o=a[n+1];if(e>i.pressureHpa||e<o.pressureHpa)continue;const s=(Math.log(i.pressureHpa)-Math.log(e))/(Math.log(i.pressureHpa)-Math.log(o.pressureHpa)),r=(u,p)=>u+(p-u)*s,h=u=>{const p=u.windFromDeg*k.DEG;return{east:-u.windSpeedMs*Math.sin(p),north:-u.windSpeedMs*Math.cos(p)}},c=h(i),d=h(o),l=k.GAS_CONSTANT_OVER_GRAVITY*((i.temperatureC+o.temperatureC)/2+273.15)*Math.log(i.pressureHpa/o.pressureHpa);return{pressureHpa:e,temperatureC:r(i.temperatureC,o.temperatureC),relativeHumidity:r(i.relativeHumidity,o.relativeHumidity),driftEastMs:r(c.east,d.east),driftNorthMs:r(c.north,d.north),shearPerS:Math.hypot(d.east-c.east,d.north-c.north)/l}}}}class Ft{static plan(t,e,a,n){if(a.length===0)return[];const i=[];for(const o of t.objects){const s=t.flights.get(o.id),r=o.track;if(!s||!r||r.length!==s.points.length)continue;const h=e?.get(K.keyOf(s))??N.of(void 0),c=q.efficiencyOf(h.kind);if(c===void 0)continue;const d=[];r.forEach((l,u)=>{const p=s.points[u],m=M.pressureAtAltitudeFt(p.altitudeFt),A=k.at(a,n+l.t,m),b=A&&M.evaluate(A,c);d.push({tMs:l.t,eastM:l.eastM,northM:l.northM,upM:l.altitudeM??0,forms:b?.forms??!1,persistent:b?.persistent??!1,lifetimeS:b?J.lifetimeS(b.iceRelativeHumidity):0,driftEastMs:A?.driftEastMs??0,driftNorthMs:A?.driftNorthMs??0,shearPerS:A?.shearPerS??J.TYPICAL_SHEAR_PER_S,iceRelativeHumidity:b?.iceRelativeHumidity??0})}),d.some((l,u)=>l.forms&&d[u+1]?.forms)&&i.push({id:o.id,spanM:h.spanM,points:d})}return i}}const ot=[500,400,300,250,200,150],Nt=["temperature","relative_humidity","wind_speed","wind_direction"],yt="2022-01-01",ct=.25;class kt{fetchImpl;baseUrl;cache=new Map;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.baseUrl=t.baseUrl??"https://historical-forecast-api.open-meteo.com/v1/forecast"}between(t,e,a){const n=new Date(e).toISOString().slice(0,10);if(n<yt)return Promise.resolve({status:"outside"});const i=new Date(a).toISOString().slice(0,10),s=`${`${Math.round(t.lat/ct)},${Math.round(t.lng/ct)}`}|${n}|${i}`;let r=this.cache.get(s);return r||(r=this.read(t,n,i),this.cache.set(s,r),r.then(h=>{h.status==="failed"&&this.cache.delete(s)})),r}async read(t,e,a){const n=ot.flatMap(s=>Nt.map(r=>`${r}_${s}hPa`)),i=new URLSearchParams({latitude:String(t.lat),longitude:String(t.lng),start_date:e,end_date:a,hourly:n.join(","),wind_speed_unit:"ms",timezone:"UTC"}),o=`${this.baseUrl}?${i}`;try{const s=await this.fetchImpl(o);if(!s.ok)return{status:"failed"};const r=await s.json();return this.decode(r,{id:"open-meteo-forecast",name:"Open-Meteo (historical forecast)",url:o})}catch{return{status:"failed"}}}decode(t,e){const a=t.hourly;if(!a?.time)return{status:"outside"};const n=[];return a.time.forEach((i,o)=>{const s=[];for(const r of ot){const h=p=>a[`${p}_${r}hPa`]?.[o],c=h("temperature"),d=h("relative_humidity"),l=h("wind_speed"),u=h("wind_direction");if([c,d,l,u].some(p=>p==null))return;s.push({pressureHpa:r,temperatureC:c,relativeHumidity:d/100,windSpeedMs:l,windFromDeg:u})}n.push({t:Date.parse(`${i}Z`),levels:s})}),n.length>0?{status:"found",samples:n,source:e}:{status:"outside"}}}const Gt=[{id:"open-meteo-forecast",name:"Open-Meteo (historical forecast)",credit:"Weather data by Open-Meteo.com, CC BY 4.0",creditUrl:"https://open-meteo.com/en/docs/historical-forecast-api",create:()=>new kt}];class v{static DEFAULT_KIND="airliner-narrow";static STEP_MS=1e3;static LEAD_MS=12e4;static FT_PER_M=1/.3048;static ID_PREFIX="decor:";tracks=new Map;static kindOf(t,e){if(t.kind!=="aircraft"||!v.flies(t))return;const a=t.aircraftSound??e??v.DEFAULT_KIND;return a==="silent"?void 0:a}static flies(t){return(t.track??[]).some(e=>(e.altitudeM??0)>0)}voices(t,e,a,n={},i=()=>{}){const o=t.event.place?.[0];if(!o)return[];const s=new Map,r=new Map,h=Math.max(t.observerTrack.duration,(t.event.durationSeconds??0)*1e3);for(const c of t.decor){const d=v.kindOf(c,i(c));if(!d)continue;const l=`${v.ID_PREFIX}${c.id}`;s.set(l,this.trackOf(c,l,o,h)),r.set(l,d)}for(const c of this.tracks.keys())s.has(c)||this.tracks.delete(c);return s.size===0?[]:D.voices(new Set(s.keys()),s,new Map,c=>String(c.icao),a,e,{...n,kindOf:c=>r.get(c)})}trackOf(t,e,a,n){const i=JSON.stringify([t.track,t.eastM,t.northM,t.headingDeg,a.lat,a.lng,n]),o=this.tracks.get(e);if(o?.key===i)return o.track;const s=[];for(let l=0;l<=n;l+=v.STEP_MS)s.push(v.pointAt(t,l,a));(s.length===0||s[s.length-1].t<n)&&s.push(v.pointAt(t,n,a));const r=s[0],h=s[1]??r,c=l=>(h[l]-r[l])/(h.t-r.t||1);for(let l=v.STEP_MS*10;l<=v.LEAD_MS;l+=v.STEP_MS*10)s.unshift({t:-l,lat:r.lat-c("lat")*l,lng:r.lng-c("lng")*l,altitudeFt:Math.max(0,r.altitudeFt-c("altitudeFt")*l)});const d={icao:v.hash(e),nonIcao:!0,points:s};return this.tracks.set(e,{key:i,track:d}),d}static pointAt(t,e,a){const n=dt(t,e),i=X(n.eastM,-n.northM,a.lat,a.lng);return{t:e,lat:i.lat,lng:i.lng,altitudeFt:n.altitudeM*v.FT_PER_M}}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}class F{static STEP_MS=250;static FT_PER_M=1/.3048;static ID_PREFIX="body:";tracks=new Map;static noiseOf(t){const e=g.noiseOfKind(t.kind),a=t.quieterDb??0;return a===0?e:{...e,id:`${e.id}-${a}dB`,soundPowerA:e.soundPowerA.map(n=>n-a)}}voices(t,e,a,n,i,o,s={}){const r=new Map,h=new Map,c=new Map;for(const l of t){if(!l.sound)continue;const u=`${F.ID_PREFIX}${l.id}`,p=this.trackOf(l,u,e,n,o);p&&(r.set(u,p),h.set(u,l.sound.kind),c.set(u,F.noiseOf(l.sound)))}for(const l of this.tracks.keys())r.has(l)||this.tracks.delete(l);if(r.size===0)return[];const d=X(a.eastM,-a.northM,n.lat,n.lng);return D.voices(new Set(r.keys()),r,new Map,l=>String(l.icao),{lat:d.lat,lng:d.lng,heightM:a.upM},i,{...s,kindOf:l=>h.get(l),noiseOf:l=>c.get(l)})}trackOf(t,e,a,n,i){const o=`${n.lat},${n.lng},${i}`,s=this.tracks.get(e);if(s&&s.body===t&&s.origin===o)return s.track;const r=[];for(let c=-12e4;c<=i;c+=F.STEP_MS){const d=a(t,c);if(!d)continue;const l=X(d.eastM,-d.northM,n.lat,n.lng);r.push({t:c,lat:l.lat,lng:l.lng,altitudeFt:d.upM*F.FT_PER_M})}if(r.length<2)return;const h={icao:F.hash(e),nonIcao:!0,points:r};return this.tracks.set(e,{body:t,origin:o,track:h}),h}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}export{$ as AircraftAudio,Ft as AircraftContrails,N as AircraftModels,I as AmbientNoise,F as BodyHearing,v as DecorAircraftHearing,E as TrafficDecor,Lt as TrafficInfos,D as TrafficSound,z as TrafficTooltip,Gt as UPPER_AIR_SOURCES};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SightingFileEditor-BH0OaQlU.js","./index-DSNA74v6.js","./sightingSchema-DqeNTmuQ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SightingFileEditor-DcOCyimm.js","./index-DSNA74v6.js","./sightingSchema-CNCtrneh.js"])))=>i.map(i=>d[i]);
2
2
  import{S as L,a as T,H as j,s as P,U as H,l as I,I as W,P as z,b as y,W as O,r as J,c as D,E as C,A as U,d as E,M as q,_ as A,e as V}from"./rr0-sighting-editor.mjs";import{interviewMessages_en as S}from"./InterviewMessages_en-CRvWVmlL.js";import{InterviewMedia as N}from"./InterviewMedia-CvAxC62V.js";import{InterviewFile as g}from"./interviewJson-DXD8FSBX.js";const F="rr0-interview",G=`
3
3
  rr0-interview { display: block; --rr0-interview-line: color-mix(in srgb, currentColor 35%, transparent); }
4
4
  rr0-interview [hidden] { display: none !important; }
@@ -226,4 +226,4 @@ rr0-interview .turn .ref svg { width: 1.1em; height: 1.1em; }
226
226
  </section>
227
227
  </div>
228
228
  `;class m extends HTMLElement{shadow=this.attachShadow({mode:"open"});get importInput(){return this.shadow.getElementById("import")}messages=S;said=new L(["en"]);language="en";localeToken=0;current;options=[];group="summary";base;text;fileEditor;fileEditorLoading;shownFor;player;drawn;takenOut=new Map;constructor(){super(),this.shadow.innerHTML=K,customElements.upgrade(this.shadow),this.importInput.build();for(const e of["title","time","by","url","summary","witness","medium"])this.shadow.getElementById(e).addEventListener(e==="witness"||e==="medium"?"change":"input",()=>this.write(e));for(const e of this.shadow.querySelectorAll("#tabs .group-tab"))e.addEventListener("click",()=>this.openGroup(m.GROUPS[e.getAttribute("aria-controls")]??"summary"));this.shadow.getElementById("url").addEventListener("change",()=>{this.shownFor=void 0,this.text===void 0&&this.group==="file"&&this.showTranscript()}),this.importInput.addEventListener("filepick",e=>{const t=e.detail;t.file?this.importFromFile(t.file):this.importFromUrl(t.url)}),this.shadow.getElementById("save").addEventListener("click",()=>this.save()),this.player=new B(this.shadow.getElementById("player"),{timeChanged:e=>this.markCurrentTurn(e),recordingsChanged:e=>void this.editTranscript(t=>{e.length===0?delete t.recordings:t.recordings=e})},this.messages),this.shadow.getElementById("redact-selection").addEventListener("click",()=>void this.redactSelection()),this.shadow.getElementById("exchanges").addEventListener("click",e=>{const t=e.target.closest(".bar[data-restorable]");t&&this.restore(t.dataset.restorable)})}static GROUPS={"group-summary":"summary","group-exchanges":"exchanges","group-transcript":"file"};static get observedAttributes(){return["readonly"]}attributeChangedCallback(){this.applyReadonly()}connectedCallback(){this.loadLocale()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor&&(this.text=this.fileEditor.text,this.fileEditor.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0,this.shownFor=void 0)}get event(){return this.current}set event(e){e!==this.current&&(this.shownFor=void 0),this.current=e,this.render(),this.takenOut.clear(),this.group==="file"&&this.showTranscript(),queueMicrotask(()=>{this.current===e&&this.showExchanges()})}set witnesses(e){this.options=e,this.render()}set documentUrl(e){this.base=e}get transcriptText(){return this.text}set transcriptText(e){this.text=e,this.shownFor=void 0}field(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=j.preferencesFor(this),r=P(t,H),s=r==="en"?S:await I(r);e===this.localeToken&&(this.language=r,this.said=new L(t),this.messages=s,this.render())}applyReadonly(){const e=this.hasAttribute("readonly");for(const t of["title","time","by","url","summary"])this.field(t).readOnly=e;for(const t of this.shadow.querySelectorAll("#witness input"))t.disabled=e;this.field("medium").disabled=e,this.importInput.disabled=e}static byText(e){return(e??[]).map(t=>"people"in t?t.people:"org"in t?t.org:t.title??"").filter(t=>t!=="").join(", ")}render(){const e=this.messages,t=(o,d)=>{this.shadow.getElementById(o).textContent=d};t("label-summary-group",e.summaryTab),t("label-file-group",e.fileTab),t("label-exchanges-group",e.exchangesTab),t("label-title",e.title),t("label-witness",e.witness),t("label-medium",e.medium),t("label-time",e.time),t("label-by",e.by),t("label-summary",e.summary),t("label-url",e.transcript),t("label-import-file",e.importFile),t("redact-selection",e.redactSelection),this.player?.setMessages(e),this.importInput.messages=e,t("save",e.saveButton),this.field("url").title=e.transcriptHint,this.field("by").title=e.byHint;const r=this.current,s=this.shadow.activeElement,i=(o,d)=>{this.field(o)!==s&&(this.field(o).value=d)};i("title",this.said.read(r?.title)??""),i("time",r?.time??""),i("by",m.byText(r?.by)),i("url",r?.url??""),i("summary",this.said.read(r?.summary)??"");const a=[r?.interviewOf].flat().filter(o=>typeof o=="string"),n=this.shadow.getElementById("witness"),l=[...this.options,...a.filter(o=>!this.options.some(d=>d.id===o)).map(o=>({id:o,label:o}))];n.replaceChildren(n.querySelector("legend"),...l.map(o=>{const d=document.createElement("label"),h=document.createElement("input");return h.type="checkbox",h.value=o.id,h.checked=a.includes(o.id),d.append(h,o.label),d}));const c=this.shadow.getElementById("medium");if(c.replaceChildren(...N.ALL.map(o=>new Option(N.label(o,this.language),o))),r?.medium!==void 0&&!N.ALL.includes(r.medium)&&c.append(new Option(String(r.medium),String(r.medium))),r?.medium===void 0){const o=new Option(e.witnessNone,"");o.disabled=!0,o.hidden=!0,c.prepend(o)}c.value=r?.medium??"",this.applyReadonly()}write(e){const t=this.current;if(!t)return;const r=e==="witness"?"":this.field(e).value;switch(e){case"title":{const s=this.said.write(t.title,r,this.language);s===void 0?delete t.title:t.title=s;break}case"summary":{const s=this.said.write(t.summary,r,this.language);s===void 0?delete t.summary:t.summary=s;break}case"time":r.trim()===""?delete t.time:t.time=r.trim();break;case"url":r.trim()===""?delete t.url:t.url=r.trim();break;case"by":{const s=r.split(",").map(i=>i.trim()).filter(i=>i!=="");s.length===0?delete t.by:t.by=s.map(i=>({people:i}));break}case"witness":{const s=[...this.shadow.querySelectorAll("#witness input:checked")].map(i=>i.value);if(s.length===0){this.render();return}t.interviewOf=s.length===1?s[0]:s;break}case"medium":r===""?delete t.medium:t.medium=r;break}this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:e,event:t}})),e==="medium"&&this.render(),e!=="url"&&this.syncFileFromEvent()}openGroup(e){this.group=e;const t={summary:"group-summary",exchanges:"group-exchanges",file:"group-transcript"};for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.setAttribute("aria-expanded",String(r.getAttribute("aria-controls")===t[e]));for(const[r,s]of Object.entries(t))this.shadow.getElementById(s).hidden=r!==e;e==="file"&&this.showTranscript(),e==="exchanges"&&this.showExchanges()}exchangesToken=0;async transcriptJson(e){try{const t=this.fileEditor?.text??this.text;if(t!==void 0)return g.read(JSON.parse(t));const r=this.transcriptUrl(e);if(r!==void 0)return g.read(await T.json(r))}catch{}}async showExchanges(){const e=this.current;if(!e)return;const t=++this.exchangesToken,r=await this.transcriptJson(e);t!==this.exchangesToken||this.current!==e||this.drawExchanges(r)}drawExchanges(e){const t=this.shadow.getElementById("exchanges");t.documentUrl=this.current?this.transcriptUrl(this.current):void 0,t.interview=e,this.drawn=e,this.player.show(e,this.current?this.transcriptUrl(this.current):void 0),this.renderReview(e),this.decorateExchanges(e)}async editTranscript(e){const t=this.current;if(!t||this.hasAttribute("readonly"))return;const r=await this.transcriptJson(t)??JSON.parse(this.template(t));Array.isArray(r.segments)||(r.segments=[]),e(r);const s=m.pretty(m.withEventFields(r,t));this.fileEditor?.replaceText(s,!1),this.onEdited(s)}get redactReason(){return this.said.write(void 0,this.messages.redactReason,this.language)??this.messages.redactReason}speakerLabel(e,t){const r=g.speakerName(e,t),s=e.speakers?.[t]?.role;return r===s&&s in this.messages.roles?this.messages.roles[s]:r}renderReview(e){const t=this.shadow.getElementById("review"),r=Object.keys(e?.speakers??{});if(t.hidden=!e||r.length===0,!e||r.length===0)return;const s=l=>["approved","covered"].includes(e.proofreading?.[l]?.status??""),i=r.filter(l=>!s(l)),a=document.createElement("span");a.textContent=i.length===0?this.messages.proofreadAll:this.messages.proofreadPending.replace("{names}",i.map(l=>this.speakerLabel(e,l)).join(", ")),t.toggleAttribute("data-done",i.length===0);const n=document.createElement("span");n.className="review-boxes";for(const l of r){const c=document.createElement("label"),o=document.createElement("input");o.type="checkbox",o.checked=s(l),o.disabled=this.hasAttribute("readonly"),o.addEventListener("change",()=>void this.editTranscript(d=>{d.proofreading??={},o.checked?d.proofreading[l]={status:"approved",date:new Date().toISOString().slice(0,10)}:d.proofreading[l]={status:"pending"}})),c.append(o,this.messages.reviewedBy.replace("{name}",this.speakerLabel(e,l))),n.append(c)}t.replaceChildren(a,n)}momentsOf(e,t){const r=e.speakers?.[t]?.of??g.sightingsOf(e)[0];return this.options.find(s=>s.id===r)?.moments??this.options.flatMap(s=>s.moments??[])}decorateExchanges(e){if(!e)return;const t=this.messages,r=this.hasAttribute("readonly");for(const s of this.shadow.querySelectorAll("#exchanges .turn[data-segment]")){const i=Number(s.dataset.segment),a=e.segments[i];if(!a)continue;if(a.start!==void 0){const c=document.createElement("button");c.type="button",c.className="turn-time",c.textContent=g.clock(a.start),c.addEventListener("click",()=>this.player.seek(a.start)),s.prepend(c)}const n=a.redacted?[a.redacted]:f.partsOf(a).flatMap(c=>"redacted"in c?[c.redacted]:[]);s.querySelectorAll(".bar").forEach((c,o)=>{const d=n[o]?.words;c.textContent=d!==void 0?t.redactedWords.replace("{n}",String(d)):t.redacted,c.classList.add("redacted-label");const h=a.redacted?`${i}:all`:`${i}:${o}`;this.takenOut.has(h)&&(c.dataset.restorable=h)});const l=this.momentsOf(e,a.speaker);s.querySelectorAll(".ref").forEach((c,o)=>{const d=a.refs?.[o];if(!d)return;const h=l.find(p=>Math.abs(p.at-d.at)<.05);if(h){const p=document.createElement("span");p.className="moment-letter",p.textContent=h.label.slice(0,2),c.replaceChildren(p,t.momentLabel.replace("{k}",h.label).replace("{text}",h.note??g.clock(d.at)))}if(r)return;const u=document.createElement("button");u.type="button",u.className="ref-unlink",u.textContent="×",u.title=t.unlinkMoment,u.setAttribute("aria-label",t.unlinkMoment),u.addEventListener("click",()=>void this.editTranscript(p=>{p.segments[i].refs?.splice(o,1),p.segments[i].refs?.length===0&&delete p.segments[i].refs})),c.after(u)}),r||s.append(this.turnTools(e,i,a,l))}}turnTools(e,t,r,s){const i=this.messages,a=document.createElement("div");a.className="turn-tools";const n=(o,d)=>{const h=document.createElement("button");return h.type="button",h.textContent=o,h.addEventListener("click",d),h};if(e.speakers?.[r.speaker]?.role==="witness"&&!r.redacted){const o=n(i.linkMoment,()=>{});a.append(o),new U(o,`moment-menu-${t}`,h=>void this.editTranscript(u=>{const p=u.segments[t].refs??[];p.some(b=>Math.abs(b.at-Number(h))<.05)||p.push({at:Number(h)}),u.segments[t].refs=p}),h=>`moment-${t}-${h}`).setKinds(s.length>0?s.map(h=>({value:String(h.at),label:i.momentLabel.replace("{k}",h.label).replace("{text}",h.note??g.clock(h.at))})):[{value:"",label:i.noMoments,disabledReason:i.noMoments}])}r.redacted||a.append(n(i.editTurn,()=>this.editTurn(t)));const l=this.takenOut.has(`${t}:all`)||[...this.takenOut.keys()].some(o=>o.startsWith(`${t}:`));if(r.redacted||r.parts&&l){const o=n(i.restoreAll,()=>void this.restoreAll(t));o.disabled=!l,a.append(o)}else a.append(n(i.redactAll,()=>void this.editTranscript(o=>{this.forget(t),this.takenOut.set(`${t}:all`,f.redactWhole(o.segments[t],this.redactReason))})));const c=n("",()=>void this.editTranscript(o=>{o.segments.splice(t,1),this.shiftTakenOut(t)}));return c.className="icon-btn",c.innerHTML=y.TRASH,c.title=i.deleteTurn,c.setAttribute("aria-label",i.deleteTurn),a.append(c),a}async redactSelection(){const e=this.messages,t=this.shadow.getElementById("redact-note"),r=(h,u=!1)=>{t.textContent=h,t.classList.toggle("error",u)},s=this.shadow.getSelection?.()??document.getSelection(),i=s&&s.rangeCount>0?s.getRangeAt(0):void 0;if(!i||i.collapsed){r(e.selectionNone);return}const a=h=>h instanceof Element?h:h.parentElement,n=a(i.startContainer)?.closest(".said");if(!n||a(i.endContainer)?.closest(".said")!==n||a(i.startContainer)?.closest(".bar")||a(i.endContainer)?.closest(".bar")){r(e.selectionOnePassage,!0);return}const l=Number(n.closest(".turn").dataset.segment),c=m.offsetIn(n,i.startContainer,i.startOffset),o=m.offsetIn(n,i.endContainer,i.endOffset);let d=!1;await this.editTranscript(h=>{const u=f.redact(h.segments[l],Math.min(c,o),Math.max(c,o),this.redactReason);u&&(d=!0,this.shiftParts(l,u.nth),this.takenOut.set(`${l}:${u.nth}`,u.text))}),s?.removeAllRanges(),r(d?"":e.selectionOnePassage,!d)}static offsetIn(e,t,r){let s=0;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:a=>a.parentElement?.closest(".bar")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(let a=i.nextNode();a;a=i.nextNode()){if(a===t)return s+r;if(t.contains(a)&&t!==a){const l=[...t.childNodes].slice(0,r);return s+l.reduce((c,o)=>c+(o instanceof Element&&o.closest(".bar")?0:(o.textContent??"").length),0)}s+=(a.textContent??"").length}return s}async restore(e){const t=this.takenOut.get(e);if(t===void 0)return;const[r,s]=e.split(":"),i=Number(r);await this.editTranscript(a=>{s==="all"?f.restoreWhole(a.segments[i],t):(f.restorePart(a.segments[i],Number(s),t),this.shiftParts(i,Number(s),-1)),this.takenOut.delete(e)})}async restoreAll(e){if(this.takenOut.has(`${e}:all`)){await this.restore(`${e}:all`);return}const t=[...this.takenOut.keys()].filter(r=>r.startsWith(`${e}:`)).map(r=>Number(r.split(":")[1])).sort((r,s)=>s-r);for(const r of t)await this.restore(`${e}:${r}`)}editTurn(e){const r=this.drawn?.segments[e],s=this.shadow.querySelector(`#exchanges .turn[data-segment="${e}"] .said`);if(!r||!s)return;const i=this.messages,a=document.createElement("div");a.className="turn-edit";const n=document.createElement("textarea");n.value=f.raw(r,h=>this.takenOut.get(`${e}:${h}`));const l=document.createElement("span");l.className="hint",l.textContent=i.turnEditHint;const c=document.createElement("div");c.className="buttons";const o=document.createElement("button");o.type="button",o.className="pill-btn primary",o.textContent=i.saveTurn,o.addEventListener("click",()=>void this.editTranscript(h=>{const u=f.fromRaw(h.segments[e],n.value,this.redactReason);this.forget(e);for(const[p,b]of u)this.takenOut.set(`${e}:${p}`,b)}));const d=document.createElement("button");d.type="button",d.className="pill-btn",d.textContent=i.cancelTurn,d.addEventListener("click",()=>this.drawExchanges(this.drawn)),c.append(o,d),a.append(n,l,c),s.replaceWith(a),n.focus()}forget(e){for(const t of[...this.takenOut.keys()])t.startsWith(`${e}:`)&&this.takenOut.delete(t)}shiftParts(e,t,r=1){const s=[...this.takenOut].filter(([i])=>i.startsWith(`${e}:`)&&i!==`${e}:all`&&Number(i.split(":")[1])>=t+(r<0?1:0));for(const[i]of s)this.takenOut.delete(i);for(const[i,a]of s)this.takenOut.set(`${e}:${Number(i.split(":")[1])+r}`,a)}shiftTakenOut(e){const t=[...this.takenOut];this.takenOut.clear();for(const[r,s]of t){const[i,a]=r.split(":"),n=Number(i);n<e?this.takenOut.set(r,s):n>e&&this.takenOut.set(`${n-1}:${a}`,s)}}markCurrentTurn(e){const t=this.drawn?.segments??[];let r=-1;t.forEach((a,n)=>{a.start!==void 0&&a.start<=e&&(r=n)});for(const a of this.shadow.querySelectorAll("#exchanges .turn.current"))a.classList.remove("current");const s=this.shadow.querySelector(`#exchanges .turn[data-segment="${r}"]`);if(!s)return;s.classList.add("current");const i=s.closest(".rr0-interview-turns");i&&(s.offsetTop<i.scrollTop||s.offsetTop>i.scrollTop+i.clientHeight-s.offsetHeight)&&i.scrollTo({top:s.offsetTop-i.clientHeight/3,behavior:"smooth"})}async revealSegment(e){this.openGroup("exchanges"),await this.showExchanges(),this.shadow.getElementById("exchanges").revealSegment(e)}note(e,t="info"){q.show(this.shadow.getElementById("file-note"),e,t)}transcriptUrl(e){return e.url?new URL(e.url,this.base??location.href).href:void 0}static pretty(e){return JSON.stringify(e,null,2)+`
229
- `}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of m.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const i of m.SHARED)t[i]===void 0?delete r[i]:r[i]=structuredClone(t[i]);const s=r.speakers;if(typeof s=="object"&&s!==null){const i={...s},a=(n,l,c)=>{c.forEach((o,d)=>{const h=d===0?n:`${n}${d+1}`;i[h]?i[h]={...i[h],[l]:o}:d>0&&(i[h]={role:n,[l]:o})})};a("interviewer","by",t.by??[]),a("witness","of",m.witnessesOf(t.interviewOf)),r.speakers=i}return m.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const s=JSON.stringify(m.SHARED.map(n=>r[n])),i=n=>typeof n=="string"||typeof n=="object"&&n!==null&&!Array.isArray(n),a={title:i,summary:i,time:n=>typeof n=="string",medium:n=>typeof n=="string",by:n=>Array.isArray(n),interviewOf:n=>typeof n=="string"||Array.isArray(n)};for(const n of m.SHARED){const l=e[n];l!==void 0&&a[n](l)?r[n]=structuredClone(l):t&&delete r[n]}return JSON.stringify(m.SHARED.map(n=>r[n]))!==s}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const s=m.pretty(m.withEventFields(r,e));s!==t&&(this.text=s,this.fileEditor?.replaceText(s,!1),this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:s}})))}template(e){return m.pretty(m.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},s]=await Promise.all([A(()=>import("./SightingFileEditor-BH0OaQlU.js"),__vite__mapDeps([0,1,2]),import.meta.url),A(()=>import("./interviewSchema-D82l9P1r.js"),[],import.meta.url),V(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,i=>this.onEdited(i),this.messages.editorLabel,{baseline:e,phrases:s.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const s=await T.json(r);this.current===e&&typeof s=="object"&&s!==null&&!Array.isArray(s)?(this.applyFileToEvent(s,!1)&&this.fileChangedEvent(),t=m.pretty(m.withEventFields(s,e))):t=m.pretty(s)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const s=this.current;if(r&&s&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),s&&!s.url&&e.trim()!==""){const i=s.id??"1";s.url=`${i.startsWith("interview")?i:`interview-${i}`}.json`,this.field("url").value=s.url,this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"url",event:s}}))}this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"transcript",event:s,text:e}})),this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=m.pretty(t?m.withEventFields(e,t):e);await this.loadFileEditor(r).then(s=>s.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}if(typeof r!="object"||r===null){const{InterviewImport:s}=await A(async()=>{const{InterviewImport:l}=await import("./interviewImport-C-TiARLK.js");return{InterviewImport:l}},[],import.meta.url),i=this.current,a=[i?.interviewOf].flat().filter(l=>typeof l=="string"),n=s.parse(t,{by:(i?.by??[]).map(l=>m.byText([l])).filter(l=>l!==""),witnesses:this.options.filter(l=>a.length===0||a.includes(l.id))});r=n&&{...n,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}async importFromUrl(e){try{await this.take(await T.json(new URL(e,this.base??location.href).href))}catch{this.note(this.messages.loadFailed,"error")}}save(){const e=this.fileEditor?.text??this.text;if(e===void 0)return;const t=(this.current?.url??"").split("/").pop()||`${this.current?.id??"interview"}.json`,r=URL.createObjectURL(new Blob([e],{type:"application/json"})),s=document.createElement("a");s.href=r,s.download=t,s.click(),URL.revokeObjectURL(r)}}function te(){Y(),J(),customElements.get($)||customElements.define($,m)}export{E as INTERVIEW_CHANGE_EVENT,$ as INTERVIEW_EDITOR_ELEMENT_NAME,W as INTERVIEW_SEEK_EVENT,m as InterviewEditorElement,te as register};
229
+ `}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of m.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const i of m.SHARED)t[i]===void 0?delete r[i]:r[i]=structuredClone(t[i]);const s=r.speakers;if(typeof s=="object"&&s!==null){const i={...s},a=(n,l,c)=>{c.forEach((o,d)=>{const h=d===0?n:`${n}${d+1}`;i[h]?i[h]={...i[h],[l]:o}:d>0&&(i[h]={role:n,[l]:o})})};a("interviewer","by",t.by??[]),a("witness","of",m.witnessesOf(t.interviewOf)),r.speakers=i}return m.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const s=JSON.stringify(m.SHARED.map(n=>r[n])),i=n=>typeof n=="string"||typeof n=="object"&&n!==null&&!Array.isArray(n),a={title:i,summary:i,time:n=>typeof n=="string",medium:n=>typeof n=="string",by:n=>Array.isArray(n),interviewOf:n=>typeof n=="string"||Array.isArray(n)};for(const n of m.SHARED){const l=e[n];l!==void 0&&a[n](l)?r[n]=structuredClone(l):t&&delete r[n]}return JSON.stringify(m.SHARED.map(n=>r[n]))!==s}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const s=m.pretty(m.withEventFields(r,e));s!==t&&(this.text=s,this.fileEditor?.replaceText(s,!1),this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:s}})))}template(e){return m.pretty(m.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},s]=await Promise.all([A(()=>import("./SightingFileEditor-DcOCyimm.js"),__vite__mapDeps([0,1,2]),import.meta.url),A(()=>import("./interviewSchema-D82l9P1r.js"),[],import.meta.url),V(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,i=>this.onEdited(i),this.messages.editorLabel,{baseline:e,phrases:s.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const s=await T.json(r);this.current===e&&typeof s=="object"&&s!==null&&!Array.isArray(s)?(this.applyFileToEvent(s,!1)&&this.fileChangedEvent(),t=m.pretty(m.withEventFields(s,e))):t=m.pretty(s)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const s=this.current;if(r&&s&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),s&&!s.url&&e.trim()!==""){const i=s.id??"1";s.url=`${i.startsWith("interview")?i:`interview-${i}`}.json`,this.field("url").value=s.url,this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"url",event:s}}))}this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"transcript",event:s,text:e}})),this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=m.pretty(t?m.withEventFields(e,t):e);await this.loadFileEditor(r).then(s=>s.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}if(typeof r!="object"||r===null){const{InterviewImport:s}=await A(async()=>{const{InterviewImport:l}=await import("./interviewImport-C-TiARLK.js");return{InterviewImport:l}},[],import.meta.url),i=this.current,a=[i?.interviewOf].flat().filter(l=>typeof l=="string"),n=s.parse(t,{by:(i?.by??[]).map(l=>m.byText([l])).filter(l=>l!==""),witnesses:this.options.filter(l=>a.length===0||a.includes(l.id))});r=n&&{...n,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}async importFromUrl(e){try{await this.take(await T.json(new URL(e,this.base??location.href).href))}catch{this.note(this.messages.loadFailed,"error")}}save(){const e=this.fileEditor?.text??this.text;if(e===void 0)return;const t=(this.current?.url??"").split("/").pop()||`${this.current?.id??"interview"}.json`,r=URL.createObjectURL(new Blob([e],{type:"application/json"})),s=document.createElement("a");s.href=r,s.download=t,s.click(),URL.revokeObjectURL(r)}}function te(){Y(),J(),customElements.get($)||customElements.define($,m)}export{E as INTERVIEW_CHANGE_EVENT,$ as INTERVIEW_EDITOR_ELEMENT_NAME,W as INTERVIEW_SEEK_EVENT,m as InterviewEditorElement,te as register};
@@ -1,4 +1,4 @@
1
- import{S as T,g as de,E as M,a as it,s as rt,b as O,P as ot,c as V,d as Le,F as me,e as pe,f as lt,h as at,V as Qe,D as P,R as _,i as ce,j as ct,C as L,k as Ee,l as b,r as ht,L as ut,m as ft,t as w,n as dt,o as mt,p as pt,q as ke,u as gt,v as xt,w as vt,x as We,y as Ie,z as bt,A as yt,G as Ne,W as Ot,B as wt,H as kt,I as Ce,J as Ct,K as St,M as Mt,N as Pt,O as Rt,Q as Tt,T as At,U as Lt,X as Qt,Y as Et,Z as Wt,_ as It,$ as Nt,a0 as Dt,a1 as Bt,a2 as $t,a3 as qt,a4 as Vt,a5 as Ht,a6 as Kt,a7 as jt,a8 as Xt,a9 as Gt,aa as zt,ab as Ft}from"./index-DSNA74v6.js";import Yt from"./sightingSchema-DqeNTmuQ.js";const Se=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class K{constructor(e,n,t=0,s=e.length,r,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(t,s),this.bufferStart=t,this.normalize=r?o=>r(Se(o)):Se,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return lt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=ct(e),t=this.bufferStart+this.bufferPos;this.bufferPos+=at(e);let s=this.normalize(n);if(s.length)for(let r=0,l=t,o=!0;;r++){let a=s.charCodeAt(r),c=this.match(a,l,o,this.bufferPos+this.bufferStart,r==s.length-1);if(c)return this.value=c,this;if(r==s.length-1)break;o&&r<n.length&&n.charCodeAt(r)==a?l++:o=!1}}}match(e,n,t,s,r){let l=null;for(let o=0;o<this.matches.length;){let a=this.matches[o],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:s,precise:r&&a.precise}:(a.index++,c=!0)),c?o++:this.matches.splice(o,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:n,to:s,precise:t&&r}:this.matches.push({from:n,index:1,precise:t})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}}typeof Symbol<"u"&&(K.prototype[Symbol.iterator]=function(){return this});const De={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ge="gm"+(/x/.unicode==null?"":"u");class Be{constructor(e,n,t,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=De,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new $e(e,n,t,s,r);this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.iter=e.iter();let l=e.lineAt(s);this.curLineStart=l.from,this.matchPos=ee(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let t=this.curLineStart+n.index,s=t+n[0].length;if(this.matchPos=ee(this.text,s+(t==s?1:0)),t==this.curLineStart+this.curLine.length&&this.nextLine(),(t<s||t>this.value.to)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const le=new WeakMap;class ${constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,t){let s=le.get(e);if(!s||s.from>=t||s.to<=n){let o=new $(n,e.sliceString(n,t));return le.set(e,o),o}if(s.from==n&&s.to==t)return s;let{text:r,from:l}=s;return l>n&&(r=e.sliceString(n,l)+r,l=n),s.to<t&&(r+=e.sliceString(s.to,t)),le.set(e,new $(l,r)),new $(n,r.slice(n-l,t-l))}}class $e{constructor(e,n,t,s,r){this.text=e,this.to=r,this.done=!1,this.value=De,this.matchPos=ee(e,s),this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.flat=$.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let t=this.flat.from+n.index,s=t+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this.matchPos=ee(this.text,s+(t==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=$.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Be.prototype[Symbol.iterator]=$e.prototype[Symbol.iterator]=function(){return this});function Zt(i){try{return new RegExp(i,ge),!0}catch{return!1}}function ee(i,e){if(e>=i.length)return e;let n=i.lineAt(e),t;for(;e<n.to&&(t=n.text.charCodeAt(e-n.from))>=56320&&t<57344;)e++;return e}const Ut=i=>{let e=it(i,"cm-goto-line");if(e){let l=e.dom.querySelector("input[type=text]");return l&&l.select(),!0}let{state:n}=i,t=String(n.doc.lineAt(i.state.selection.main.head).number),{close:s,result:r}=rt(i,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:n.phrase("go")});return r.then(l=>{let o=l&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(l.elements.line.value);if(!o){i.dispatch({effects:s});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,h,f]=o,d=h?+h.slice(1):0,m=u?+u:a.number;if(u&&f){let S=m/100;c&&(S=S*(c=="-"?-1:1)+a.number/n.doc.lines),m=Math.round(n.doc.lines*S)}else u&&c&&(m=m*(c=="-"?-1:1)+a.number);let g=n.doc.line(Math.max(1,Math.min(n.doc.lines,m))),x=M.cursor(g.from+Math.max(0,Math.min(d,g.length)));i.dispatch({effects:[s,O.scrollIntoView(x.from,{y:"center"})],selection:x})}),!0},Jt=({state:i,dispatch:e})=>{let{selection:n}=i,t=M.create(n.ranges.map(s=>i.wordAt(s.head)||M.cursor(s.head)),n.mainIndex);return t.eq(n)?!1:(e(i.update({selection:t})),!0)};function _t(i,e){let{main:n,ranges:t}=i.selection,s=i.wordAt(n.head),r=s&&s.from==n.from&&s.to==n.to;for(let l=!1,o=new K(i.doc,e,t[t.length-1].to);;)if(o.next(),o.done){if(l)return null;o=new K(i.doc,e,0,Math.max(0,t[t.length-1].from-1)),l=!0}else{if(l&&t.some(a=>a.from==o.value.from))continue;if(r){let a=i.wordAt(o.value.from);if(!a||a.from!=o.value.from||a.to!=o.value.to)continue}return o.value}}const en=({state:i,dispatch:e})=>{let{ranges:n}=i.selection;if(n.some(r=>r.from===r.to))return Jt({state:i,dispatch:e});let t=i.sliceDoc(n[0].from,n[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=t))return!1;let s=_t(i,t);return s?(e(i.update({selection:i.selection.addRange(M.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},I=me.define({combine(i){return pe(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new gn(e),scrollToMatch:e=>O.scrollIntoView(e)})}});function tn(i){return i?[I.of(i),ue]:ue}class qe{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Zt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,t)=>t=="n"?`
1
+ import{S as T,g as de,E as M,a as it,s as rt,b as O,P as ot,c as V,d as Le,F as me,e as pe,f as lt,h as at,V as Qe,D as P,R as _,i as ce,j as ct,C as L,k as Ee,l as b,r as ht,L as ut,m as ft,t as w,n as dt,o as mt,p as pt,q as ke,u as gt,v as xt,w as vt,x as We,y as Ie,z as bt,A as yt,G as Ne,W as Ot,B as wt,H as kt,I as Ce,J as Ct,K as St,M as Mt,N as Pt,O as Rt,Q as Tt,T as At,U as Lt,X as Qt,Y as Et,Z as Wt,_ as It,$ as Nt,a0 as Dt,a1 as Bt,a2 as $t,a3 as qt,a4 as Vt,a5 as Ht,a6 as Kt,a7 as jt,a8 as Xt,a9 as Gt,aa as zt,ab as Ft}from"./index-DSNA74v6.js";import Yt from"./sightingSchema-CNCtrneh.js";const Se=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class K{constructor(e,n,t=0,s=e.length,r,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(t,s),this.bufferStart=t,this.normalize=r?o=>r(Se(o)):Se,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return lt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=ct(e),t=this.bufferStart+this.bufferPos;this.bufferPos+=at(e);let s=this.normalize(n);if(s.length)for(let r=0,l=t,o=!0;;r++){let a=s.charCodeAt(r),c=this.match(a,l,o,this.bufferPos+this.bufferStart,r==s.length-1);if(c)return this.value=c,this;if(r==s.length-1)break;o&&r<n.length&&n.charCodeAt(r)==a?l++:o=!1}}}match(e,n,t,s,r){let l=null;for(let o=0;o<this.matches.length;){let a=this.matches[o],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:s,precise:r&&a.precise}:(a.index++,c=!0)),c?o++:this.matches.splice(o,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:n,to:s,precise:t&&r}:this.matches.push({from:n,index:1,precise:t})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}}typeof Symbol<"u"&&(K.prototype[Symbol.iterator]=function(){return this});const De={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ge="gm"+(/x/.unicode==null?"":"u");class Be{constructor(e,n,t,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=De,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new $e(e,n,t,s,r);this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.iter=e.iter();let l=e.lineAt(s);this.curLineStart=l.from,this.matchPos=ee(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let t=this.curLineStart+n.index,s=t+n[0].length;if(this.matchPos=ee(this.text,s+(t==s?1:0)),t==this.curLineStart+this.curLine.length&&this.nextLine(),(t<s||t>this.value.to)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const le=new WeakMap;class ${constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,t){let s=le.get(e);if(!s||s.from>=t||s.to<=n){let o=new $(n,e.sliceString(n,t));return le.set(e,o),o}if(s.from==n&&s.to==t)return s;let{text:r,from:l}=s;return l>n&&(r=e.sliceString(n,l)+r,l=n),s.to<t&&(r+=e.sliceString(s.to,t)),le.set(e,new $(l,r)),new $(n,r.slice(n-l,t-l))}}class $e{constructor(e,n,t,s,r){this.text=e,this.to=r,this.done=!1,this.value=De,this.matchPos=ee(e,s),this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.flat=$.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let t=this.flat.from+n.index,s=t+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this.matchPos=ee(this.text,s+(t==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=$.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Be.prototype[Symbol.iterator]=$e.prototype[Symbol.iterator]=function(){return this});function Zt(i){try{return new RegExp(i,ge),!0}catch{return!1}}function ee(i,e){if(e>=i.length)return e;let n=i.lineAt(e),t;for(;e<n.to&&(t=n.text.charCodeAt(e-n.from))>=56320&&t<57344;)e++;return e}const Ut=i=>{let e=it(i,"cm-goto-line");if(e){let l=e.dom.querySelector("input[type=text]");return l&&l.select(),!0}let{state:n}=i,t=String(n.doc.lineAt(i.state.selection.main.head).number),{close:s,result:r}=rt(i,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:n.phrase("go")});return r.then(l=>{let o=l&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(l.elements.line.value);if(!o){i.dispatch({effects:s});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,h,f]=o,d=h?+h.slice(1):0,m=u?+u:a.number;if(u&&f){let S=m/100;c&&(S=S*(c=="-"?-1:1)+a.number/n.doc.lines),m=Math.round(n.doc.lines*S)}else u&&c&&(m=m*(c=="-"?-1:1)+a.number);let g=n.doc.line(Math.max(1,Math.min(n.doc.lines,m))),x=M.cursor(g.from+Math.max(0,Math.min(d,g.length)));i.dispatch({effects:[s,O.scrollIntoView(x.from,{y:"center"})],selection:x})}),!0},Jt=({state:i,dispatch:e})=>{let{selection:n}=i,t=M.create(n.ranges.map(s=>i.wordAt(s.head)||M.cursor(s.head)),n.mainIndex);return t.eq(n)?!1:(e(i.update({selection:t})),!0)};function _t(i,e){let{main:n,ranges:t}=i.selection,s=i.wordAt(n.head),r=s&&s.from==n.from&&s.to==n.to;for(let l=!1,o=new K(i.doc,e,t[t.length-1].to);;)if(o.next(),o.done){if(l)return null;o=new K(i.doc,e,0,Math.max(0,t[t.length-1].from-1)),l=!0}else{if(l&&t.some(a=>a.from==o.value.from))continue;if(r){let a=i.wordAt(o.value.from);if(!a||a.from!=o.value.from||a.to!=o.value.to)continue}return o.value}}const en=({state:i,dispatch:e})=>{let{ranges:n}=i.selection;if(n.some(r=>r.from===r.to))return Jt({state:i,dispatch:e});let t=i.sliceDoc(n[0].from,n[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=t))return!1;let s=_t(i,t);return s?(e(i.update({selection:i.selection.addRange(M.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},I=me.define({combine(i){return pe(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new gn(e),scrollToMatch:e=>O.scrollIntoView(e)})}});function tn(i){return i?[I.of(i),ue]:ue}class qe{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Zt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,t)=>t=="n"?`
2
2
  `:t=="r"?"\r":t=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new an(this):new rn(this)}getCursor(e,n=0,t){let s=e.doc?e:ce.create({doc:e});return t==null&&(t=s.doc.length),this.regexp?B(this,s,n,t):D(this,s,n,t)}}class Ve{constructor(e){this.spec=e}}function nn(i,e,n){return(t,s,r,l)=>{if(n&&!n(t,s,r,l))return!1;let o=t>=l&&s<=l+r.length?r.slice(t-l,s-l):e.doc.sliceString(t,s);return i(o,e,t,s)}}function D(i,e,n,t){let s;return i.wholeWord&&(s=sn(e.doc,e.charCategorizer(e.selection.main.head))),i.test&&(s=nn(i.test,e,s)),new K(e.doc,i.unquoted,n,t,i.caseSensitive?void 0:r=>r.toLowerCase(),s)}function sn(i,e){return(n,t,s,r)=>((r>n||r+s.length<t)&&(r=Math.max(0,n-2),s=i.sliceString(r,Math.min(i.length,t+2))),(e(te(s,n-r))!=L.Word||e(ne(s,n-r))!=L.Word)&&(e(ne(s,t-r))!=L.Word||e(te(s,t-r))!=L.Word))}class rn extends Ve{constructor(e){super(e)}nextMatch(e,n,t){let s=D(this.spec,e,t,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,n+this.spec.unquoted.length);s=D(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==t?null:s.value}prevMatchInRange(e,n,t){for(let s=t;;){let r=Math.max(n,s-1e4-this.spec.unquoted.length),l=D(this.spec,e,r,s),o=null;for(;!l.nextOverlapping().done;)o=l.value;if(o)return o;if(r==n)return null;s-=1e4}}prevMatch(e,n,t){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,t-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=t)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let t=D(this.spec,e,0,e.doc.length),s=[];for(;!t.next().done;){if(s.length>=n)return null;s.push(t.value)}return s}highlight(e,n,t,s){let r=D(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(t+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function on(i,e,n){return(t,s,r)=>(!n||n(t,s,r))&&i(r[0],e,t,s)}function B(i,e,n,t){let s;return i.wholeWord&&(s=ln(e.charCategorizer(e.selection.main.head))),i.test&&(s=on(i.test,e,s)),new Be(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:s},n,t)}function te(i,e){return i.slice(Ee(i,e,!1),e)}function ne(i,e){return i.slice(e,Ee(i,e))}function ln(i){return(e,n,t)=>!t[0].length||(i(te(t.input,t.index))!=L.Word||i(ne(t.input,t.index))!=L.Word)&&(i(ne(t.input,t.index+t[0].length))!=L.Word||i(te(t.input,t.index+t[0].length))!=L.Word)}class an extends Ve{nextMatch(e,n,t){let s=B(this.spec,e,t,e.doc.length).next();return s.done&&(s=B(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,t){for(let s=1;;s++){let r=Math.max(n,t-s*1e4),l=B(this.spec,e,r,t),o=null;for(;!l.next().done;)o=l.value;if(o&&(r==n||o.from>r+10))return o;if(r==n)return null}}prevMatch(e,n,t){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,t,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,t)=>{if(t=="&")return e.match[0];if(t=="$")return"$";for(let s=t.length;s>0;s--){let r=+t.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+t.slice(s)}return n})}matchAll(e,n){let t=B(this.spec,e,0,e.doc.length),s=[];for(;!t.next().done;){if(s.length>=n)return null;s.push(t.value)}return s}highlight(e,n,t,s){let r=B(this.spec,e,Math.max(0,n-250),Math.min(t+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const j=T.define(),xe=T.define(),Q=V.define({create(i){return new ae(he(i).create(),null)},update(i,e){for(let n of e.effects)n.is(j)?i=new ae(n.value.create(),i.panel):n.is(xe)&&(i=new ae(i.query,n.value?ve:null));return i},provide:i=>Le.from(i,e=>e.panel)});class ae{constructor(e,n){this.query=e,this.panel=n}}const cn=P.mark({class:"cm-searchMatch"}),hn=P.mark({class:"cm-searchMatch cm-searchMatch-selected"}),un=Qe.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Q))}update(i){let e=i.state.field(Q);(e!=i.startState.field(Q)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return P.none;let{view:n}=this,t=new _;for(let s=0,r=n.visibleRanges,l=r.length;s<l;s++){let{from:o,to:a}=r[s];for(;s<l-1&&a>r[s+1].from-500;)a=r[++s].to;i.highlight(n.state,o,a,(c,u)=>{let h=n.state.selection.ranges.some(f=>f.from==c&&f.to==u);t.add(c,u,h?hn:cn)})}return t.finish()}},{decorations:i=>i.decorations});function z(i){return e=>{let n=e.state.field(Q,!1);return n&&n.query.spec.valid?i(e,n):be(e)}}const se=z((i,{query:e})=>{let{to:n}=i.state.selection.main,t=e.nextMatch(i.state,n,n);if(!t)return!1;let s=M.single(t.from,t.to),r=i.state.facet(I);return i.dispatch({selection:s,effects:[ye(i,t),r.scrollToMatch(s.main,i)],userEvent:"select.search"}),Ke(i),!0}),ie=z((i,{query:e})=>{let{state:n}=i,{from:t}=n.selection.main,s=e.prevMatch(n,t,t);if(!s)return!1;let r=M.single(s.from,s.to),l=i.state.facet(I);return i.dispatch({selection:r,effects:[ye(i,s),l.scrollToMatch(r.main,i)],userEvent:"select.search"}),Ke(i),!0}),fn=z((i,{query:e})=>{let n=e.matchAll(i.state,1e3);return!n||!n.length?!1:(i.dispatch({selection:M.create(n.map(t=>M.range(t.from,t.to))),userEvent:"select.search.matches"}),!0)}),dn=({state:i,dispatch:e})=>{let n=i.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:t,to:s}=n.main,r=[],l=0;for(let o=new K(i.doc,i.sliceDoc(t,s));!o.next().done;){if(r.length>1e3)return!1;o.value.from==t&&(l=r.length),r.push(M.range(o.value.from,o.value.to))}return e(i.update({selection:M.create(r,l),userEvent:"select.search.matches"})),!0},Me=z((i,{query:e})=>{let{state:n}=i,{from:t,to:s}=n.selection.main;if(n.readOnly)return!1;let r=e.nextMatch(n,t,t);if(!r)return!1;let l=r,o=[],a,c,u=[];l.precise?l.from==t&&l.to==s&&(c=n.toText(e.getReplacement(l)),o.push({from:l.from,to:l.to,insert:c}),l=e.nextMatch(n,l.from,l.to),u.push(O.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(t).number)+"."))):l=e.nextMatch(n,l.from,l.to);let h=i.state.changes(o);return l&&(a=M.single(l.from,l.to).map(h),u.push(ye(i,l)),u.push(n.facet(I).scrollToMatch(a.main,i))),i.dispatch({changes:h,selection:a,effects:u,userEvent:"input.replace"}),!0}),mn=z((i,{query:e})=>{if(i.state.readOnly)return!1;let n=[];for(let s of e.matchAll(i.state,1e9)){let{from:r,to:l,precise:o}=s;o&&n.push({from:r,to:l,insert:e.getReplacement(s)})}if(!n.length)return!1;let t=i.state.phrase("replaced $ matches",n.length)+".";return i.dispatch({changes:n,effects:O.announce.of(t),userEvent:"input.replace.all"}),!0});function ve(i){return i.state.facet(I).createPanel(i)}function he(i,e){var n,t,s,r,l;let o=i.selection.main,a=o.empty||o.to>o.from+100?"":i.sliceDoc(o.from,o.to);if(e&&!a)return e;let c=i.facet(I);return new qe({search:((n=e?.literal)!==null&&n!==void 0?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(t=e?.caseSensitive)!==null&&t!==void 0?t:c.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:c.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:c.wholeWord})}function He(i){let e=de(i,ve);return e&&e.dom.querySelector("[main-field]")}function Ke(i){let e=He(i);e&&e==i.root.activeElement&&e.select()}const be=i=>{let e=i.state.field(Q,!1);if(e&&e.panel){let n=He(i);if(n&&n!=i.root.activeElement){let t=he(i.state,e.query.spec);t.valid&&i.dispatch({effects:j.of(t)}),n.focus(),n.select()}}else i.dispatch({effects:[xe.of(!0),e?j.of(he(i.state,e.query.spec)):T.appendConfig.of(ue)]});return!0},je=i=>{let e=i.state.field(Q,!1);if(!e||!e.panel)return!1;let n=de(i,ve);return n&&n.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:xe.of(!1)}),!0},pn=[{key:"Mod-f",run:be,scope:"editor search-panel"},{key:"F3",run:se,shift:ie,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:se,shift:ie,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:je,scope:"editor search-panel"},{key:"Mod-Shift-l",run:dn},{key:"Mod-Alt-g",run:Ut},{key:"Mod-d",run:en,preventDefault:!0}];class gn{constructor(e){this.view=e;let n=this.query=e.state.field(Q).query.spec;this.commit=this.commit.bind(this),this.searchField=b("input",{value:n.search,placeholder:k(e,"Find"),"aria-label":k(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=b("input",{value:n.replace,placeholder:k(e,"Replace"),"aria-label":k(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=b("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=b("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=b("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function t(s,r,l){return b("button",{class:"cm-button",name:s,onclick:r,type:"button"},l)}this.dom=b("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,t("next",()=>se(e),[k(e,"next")]),t("prev",()=>ie(e),[k(e,"previous")]),t("select",()=>fn(e),[k(e,"all")]),b("label",null,[this.caseField,k(e,"match case")]),b("label",null,[this.reField,k(e,"regexp")]),b("label",null,[this.wordField,k(e,"by word")]),...e.state.readOnly?[]:[b("br"),this.replaceField,t("replace",()=>Me(e),[k(e,"replace")]),t("replaceAll",()=>mn(e),[k(e,"replace all")])],b("button",{name:"close",onclick:()=>je(e),"aria-label":k(e,"close"),type:"button"},["×"])])}commit(){let e=new qe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:j.of(e)}))}keydown(e){ht(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ie:se)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Me(this.view))}update(e){for(let n of e.transactions)for(let t of n.effects)t.is(j)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I).top}}function k(i,e){return i.state.phrase(e)}const Y=30,Z=/[\s\.,:;?!]/;function ye(i,{from:e,to:n}){let t=i.state.doc.lineAt(e),s=i.state.doc.lineAt(n).to,r=Math.max(t.from,e-Y),l=Math.min(s,n+Y),o=i.state.sliceDoc(r,l);if(r!=t.from){for(let a=0;a<Y;a++)if(!Z.test(o[a+1])&&Z.test(o[a])){o=o.slice(a);break}}if(l!=s){for(let a=o.length-1;a>o.length-Y;a--)if(!Z.test(o[a-1])&&Z.test(o[a])){o=o.slice(0,a);break}}return O.announce.of(`${i.state.phrase("current match")}. ${o} ${i.state.phrase("on line")} ${t.number}.`)}const xn=O.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),ue=[Q,ot.low(un),xn],vn=ft({String:w.string,Number:w.number,"True False":w.bool,PropertyName:w.propertyName,Null:w.null,", :":w.separator,"[ ]":w.squareBracket,"{ }":w.brace}),bn=ut.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[vn],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),yn=()=>i=>{try{JSON.parse(i.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=On(e,i.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function On(i,e){let n;return(n=i.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=i.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Xe=mt.define({name:"json",parser:bn.configure({props:[pt.add({Object:ke({except:/^\s*\}/}),Array:ke({except:/^\s*\]/})}),gt.add({"Object Array":xt})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function wn(){return new dt(Xe)}class Pe{constructor(e,n,t){this.from=e,this.to=n,this.diagnostic=t}}class W{constructor(e,n,t){this.diagnostics=e,this.panel=n,this.selected=t}static init(e,n,t){let s=t.facet(R).markerFilter;s&&(e=s(e,t));let r=e.slice().sort((d,m)=>d.from-m.from||d.to-m.to),l=new _,o=[],a=0,c=t.doc.iter(),u=0,h=t.doc.length;for(let d=0;;){let m=d==r.length?null:r[d];if(!m&&!o.length)break;let g,x;if(o.length)g=a,x=o.reduce((v,y)=>Math.min(v,y.to),m&&m.from>g?m.from:1e8);else{if(g=m.from,g>h)break;x=m.to,o.push(m),d++}for(;d<r.length;){let v=r[d];if(v.from==g&&(v.to>v.from||v.to==g))o.push(v),d++,x=Math.min(v.to,x);else{x=Math.min(v.from,x);break}}x=Math.min(x,h);let S=!1;if(o.some(v=>v.from==g&&(v.to==x||x==h))&&(S=g==x,!S&&x-g<10)){let v=g-(u+c.value.length);v>0&&(c.next(v),u=g);for(let y=g;;){if(y>=x){S=!0;break}if(!c.lineBreak&&u+c.value.length>y)break;y=u+c.value.length,u+=c.value.length,c.next()}}let N=_e(o);if(S)l.add(g,g,P.widget({widget:new Qn(N),diagnostics:o.slice()}));else{let v=o.reduce((y,F)=>F.markClass?y+" "+F.markClass:y,"");l.add(g,x,P.mark({class:"cm-lintRange cm-lintRange-"+N+v,diagnostics:o.slice(),inclusiveEnd:o.some(y=>y.to>x)}))}if(a=x,a==h)break;for(let v=0;v<o.length;v++)o[v].to<=a&&o.splice(v--,1)}let f=l.finish();return new W(f,n,E(f))}}function E(i,e=null,n=0){let t=null;return i.between(n,1e9,(s,r,{spec:l})=>{if(!(e&&l.diagnostics.indexOf(e)<0))if(!t)t=new Pe(s,r,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(t.diagnostic)<0)return!1;t=new Pe(t.from,r,t.diagnostic)}}),t}function Ge(i,e){let n=e.pos,t=e.end||n,s=i.state.facet(R).hideOn(i,n,t);if(s!=null)return s;let r=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(l=>l.is(re))||i.changes.touchesRange(r.from,Math.max(r.to,t)))}function ze(i,e){return i.field(C,!1)?e:e.concat(T.appendConfig.of(st))}function kn(i,e){return{effects:ze(i,[re.of(e)])}}const re=T.define(),Oe=T.define(),Fe=T.define(),C=V.define({create(){return new W(P.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let n=i.diagnostics.map(e.changes),t=null,s=i.panel;if(i.selected){let r=e.changes.mapPos(i.selected.from,1);t=E(n,i.selected.diagnostic,r)||E(n,null,r)}!n.size&&s&&e.state.facet(R).autoPanel&&(s=null),i=new W(n,s,t)}for(let n of e.effects)if(n.is(re)){let t=e.state.facet(R).autoPanel?n.value.length?X.open:null:i.panel;i=W.init(n.value,t,e.state)}else n.is(Oe)?i=new W(i.diagnostics,n.value?X.open:null,i.selected):n.is(Fe)&&(i=new W(i.diagnostics,i.panel,n.value));return i},provide:i=>[Le.from(i,e=>e.panel),O.decorations.from(i,e=>e.diagnostics)]}),Cn=P.mark({class:"cm-lintRange cm-lintRange-active"});function Sn(i,e,n){let{diagnostics:t}=i.state.field(C),s,r=-1,l=-1;t.between(e-(n<0?1:0),e+(n>0?1:0),(a,c,{spec:u})=>{if(e>=a&&e<=c&&(a==c||(e>a||n>0)&&(e<c||n<0)))return s=u.diagnostics,r=a,l=c,!1});let o=i.state.facet(R).tooltipFilter;return s&&o&&(s=o(s,i.state)),s?{pos:r,end:l,above:!0,create(){return{dom:Ye(i,s)}}}:null}function Ye(i,e){return b("ul",{class:"cm-tooltip-lint"},e.map(n=>Je(i,n,!1)))}const Mn=i=>{let e=i.state.field(C,!1);(!e||!e.panel)&&i.dispatch({effects:ze(i.state,[Oe.of(!0)])});let n=de(i,X.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Re=i=>{let e=i.state.field(C,!1);return!e||!e.panel?!1:(i.dispatch({effects:Oe.of(!1)}),!0)},Pn=i=>{let e=i.state.field(C,!1);if(!e)return!1;let n=i.state.selection.main,t=E(e.diagnostics,null,n.to+1);return!t&&(t=E(e.diagnostics,null,0),!t||t.from==n.from&&t.to==n.to)?!1:(i.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),vt(i,t.from,1,{tooltip:nt,until:s=>s.docChanged||s.newSelection.main.head<t.from||s.newSelection.main.head>t.to}),!0)},Rn=[{key:"Mod-Shift-m",run:Mn,preventDefault:!0},{key:"F8",run:Pn}],Ze=Qe.fromClass(class{constructor(i){this.view=i,this.timeout=-1,this.set=!0;let{delay:e}=i.state.facet(R);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let i=Date.now();if(i<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-i);else{this.set=!1;let{state:e}=this.view,{sources:n}=e.facet(R);n.length&&Tn(n.map(t=>Promise.resolve(t(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(kn(this.view.state,t.reduce((s,r)=>s.concat(r))))},t=>{wt(this.view.state,t)})}}update(i){let e=i.state.facet(R);(i.docChanged||e!=i.startState.facet(R)||e.needsRefresh&&e.needsRefresh(i))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Tn(i,e,n){let t=[],s=-1;for(let r of i)r.then(l=>{t.push(l),clearTimeout(s),t.length==i.length?e(t):s=setTimeout(()=>e(t),200)},n)}const R=me.define({combine(i){return{sources:i.map(e=>e.source).filter(e=>e!=null),...pe(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Te,tooltipFilter:Te,needsRefresh:(e,n)=>e?n?t=>e(t)||n(t):e:n,hideOn:(e,n)=>e?n?(t,s,r)=>e(t,s,r)||n(t,s,r):e:n,autoPanel:(e,n)=>e||n})}}});function Te(i,e){return i?e?(n,t)=>e(i(n,t),t):i:e}function An(i,e={}){return[R.of({source:i,config:e}),Ze,st]}function Ln(i){let e=i.plugin(Ze);e&&e.force()}function Ue(i){let e=[];if(i)e:for(let{name:n}of i){for(let t=0;t<n.length;t++){let s=n[t];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Je(i,e,n){var t;let s=n?Ue(e.actions):[];return b("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},b("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(t=e.actions)===null||t===void 0?void 0:t.map((r,l)=>{let o=!1,a=d=>{if(d.preventDefault(),o)return;o=!0;let m=E(i.state.field(C).diagnostics,e);m&&r.apply(i,m.from,m.to)},{name:c}=r,u=s[l]?c.indexOf(s[l]):-1,h=u<0?c:[c.slice(0,u),b("u",c.slice(u,u+1)),c.slice(u+1)],f=r.markClass?" "+r.markClass:"";return b("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${s[l]})"`}.`},h)}),e.source&&b("div",{class:"cm-diagnosticSource"},e.source))}class Qn extends Ot{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return b("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ae{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Je(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class X{constructor(e){this.view=e,this.items=[];let n=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)Re(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],l=Ue(r.actions);for(let o=0;o<l.length;o++)if(l[o].toUpperCase().charCodeAt(0)==s.keyCode){let a=E(this.view.state.field(C).diagnostics,r);a&&r.actions[o].apply(e,a.from,a.to)}}else return;s.preventDefault()}},t=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=b("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:t}),this.dom=b("div",{class:"cm-panel-lint"},this.list,b("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Re(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(C).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(C),t=0,s=!1,r=null,l=new Set;for(e.between(0,this.view.state.doc.length,(o,a,{spec:c})=>{for(let u of c.diagnostics){if(l.has(u))continue;l.add(u);let h=-1,f;for(let d=t;d<this.items.length;d++)if(this.items[d].diagnostic==u){h=d;break}h<0?(f=new Ae(this.view,u),this.items.splice(t,0,f),s=!0):(f=this.items[h],h>t&&(this.items.splice(t,h-t),s=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),r=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),t++}});t<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new Ae(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let c=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/c:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let t=e;e=t.nextSibling,t.remove()}for(let t of this.items)if(t.dom.parentNode==this.list){for(;e!=t.dom;)n();e=t.dom.nextSibling}else this.list.insertBefore(t.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(C),t=E(n.diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Fe.of(t)})}static open(e){return new X(e)}}function J(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function U(i){return J(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const En=O.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:U("#f11")},".cm-lintRange-warning":{backgroundImage:U("orange")},".cm-lintRange-info":{backgroundImage:U("#999")},".cm-lintRange-hint":{backgroundImage:U("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Wn(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}function _e(i){let e="hint",n=1;for(let t of i){let s=Wn(t.severity);s>n&&(n=s,e=t.severity)}return e}class et extends Ne{constructor(e){super(),this.diagnostics=e,this.severity=_e(e)}toDOM(e){let n=document.createElement("div");n.className="cm-lint-marker cm-lint-marker-"+this.severity;let t=this.diagnostics,s=e.state.facet(oe).tooltipFilter;return s&&(t=s(t,e.state)),t.length&&(n.onmouseover=()=>Nn(e,n,t)),n}}function In(i,e){let n=t=>{let s=e.getBoundingClientRect();if(!(t.clientX>s.left-10&&t.clientX<s.right+10&&t.clientY>s.top-10&&t.clientY<s.bottom+10)){for(let r=t.target;r;r=r.parentNode)if(r.nodeType==1&&r.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",n),i.state.field(tt)&&i.dispatch({effects:we.of(null)})}};window.addEventListener("mousemove",n)}function Nn(i,e,n){function t(){let l=i.elementAtHeight(e.getBoundingClientRect().top+5-i.documentTop);i.coordsAtPos(l.from)&&i.dispatch({effects:we.of({pos:l.from,above:!1,clip:!1,create(){return{dom:Ye(i,n),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,In(i,e)}let{hoverTime:s}=i.state.facet(oe),r=setTimeout(t,s);e.onmouseout=()=>{clearTimeout(r),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(r),r=setTimeout(t,s)}}function Dn(i,e){let n=Object.create(null);for(let s of e){let r=i.lineAt(s.from);(n[r.from]||(n[r.from]=[])).push(s)}let t=[];for(let s in n)t.push(new et(n[s]).range(+s));return We.of(t,!0)}const Bn=Ie({class:"cm-gutter-lint",markers:i=>i.state.field(fe),widgetMarker:(i,e,n)=>{let t=[];return i.state.field(fe).between(n.from,n.to,(s,r,l)=>{s>n.from&&s<n.to&&t.push(...l.diagnostics)}),t.length?new et(t):null}}),fe=V.define({create(){return We.empty},update(i,e){i=i.map(e.changes);let n=e.state.facet(oe).markerFilter;for(let t of e.effects)if(t.is(re)){let s=t.value;n&&(s=n(s||[],e.state)),i=Dn(e.state.doc,s.slice(0))}return i}}),we=T.define(),tt=V.define({create(){return null},update(i,e){return i&&e.docChanged&&(i=Ge(e,i)?null:{...i,pos:e.changes.mapPos(i.pos)}),e.effects.reduce((n,t)=>t.is(we)?t.value:n,i)},provide:i=>bt.from(i)}),$n=O.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:J('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:J('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:J('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),nt=yt(Sn,{hideOn:Ge}),st=[C,O.decorations.compute([C],i=>{let{selected:e,panel:n}=i.field(C);return!e||!n||e.from==e.to?P.none:P.set([Cn.range(e.from,e.to)])}),nt,En],oe=me.define({combine(i){return pe(i,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function qn(i={}){return[oe.of(i),fe,Bn,$n,tt]}class H{constructor(e=[],n=H.FIELDS){this.at=e,this.format=n}static FIELDS=Yt;fieldsAt(e){let n=this.format;for(const t of e)n=n?.[t]?.fields;return n}pathTo(e,n){const t=[];for(let s=e;s;s=s.parent)if(s.name==="Property"){const r=s.getChild("PropertyName");r&&t.unshift(n.slice(r.from,r.to).replace(/^"|"$/g,""))}return[...this.at,...t]}keyCompletions(e){return Object.entries(e).map(([n,t])=>({label:`"${n}"`,apply:`"${n}": `,type:t.type==="enum"?"enum":t.type==="object"||t.type==="array"?"class":"property",detail:t.type==="enum"?t.values?.join(" | "):t.type,...t.doc===void 0?{}:{info:t.doc}}))}valueCompletions(e){return(e.values??e.suggest??[]).map(n=>({label:`"${n}"`,apply:`"${n}"`,type:"enum"}))}get source(){return e=>{const n=e.state.doc.toString(),t=kt(e.state).resolveInner(e.pos,-1),s=n.slice(0,e.pos);if(t.name==="PropertyName")return this.keys(this.pathTo(t.parent?.parent??null,n),t.from,t.to);if(t.name==="String"&&t.parent?.name==="Property")return this.values(this.fieldAt(this.pathTo(t.parent,n)),t.from,t.to);if(/:\s*$/.test(s)){const l=t.name==="Property"?t:this.propertyBefore(t,e.pos);return this.values(l?this.fieldAt(this.pathTo(l,n)):void 0,e.pos)}if(!e.explicit&&!/[{,[]\s*$/.test(s))return null;const r=t.name==="Object"?t:t.parent?.name==="Object"?t.parent:t;return this.keys(this.pathTo(r,n),e.pos)}}keys(e,n,t){const s=this.fieldsAt(e);return s===void 0?null:{from:n,...t===void 0?{}:{to:t},options:this.keyCompletions(s),validFor:H.WORD}}values(e,n,t){return e?.values===void 0&&e?.suggest===void 0?null:{from:n,...t===void 0?{}:{to:t},options:this.valueCompletions(e),validFor:H.WORD}}static WORD=/^"?[\w-]*"?$/;fieldAt(e){return this.fieldsAt(e.slice(0,-1))?.[e[e.length-1]]}propertyBefore(e,n){let t;for(let s=e.firstChild;s;s=s.nextSibling)s.name==="Property"&&s.from<n&&(t=s);return t}}class q{static at(e,n){const t=Ce(e,e.doc.length,50);if(t===null)return[];const s=[];let r=null;for(let l=t.resolveInner(n,-1);l!==null;r=l,l=l.parent)if(l.name==="Property"){const o=l.getChild("PropertyName");o!==null&&s.unshift(JSON.parse(e.sliceDoc(o.from,o.to)))}else l.name==="Array"&&r!==null&&s.unshift(q.indexOf(l,r));return s}static range(e,n){const t=Ce(e,e.doc.length,50);if(t===null)return;let s=t.topNode.firstChild,r;for(const l of n){if(s===null)return;if(typeof l=="number"){if(s.name!=="Array"||(s=q.elements(s)[l]??null,s===null))return;r={from:s.from,to:s.to}}else{if(s.name!=="Object")return;let o=null;for(let a=s.firstChild;a!==null;a=a.nextSibling){if(a.name!=="Property")continue;const c=a.getChild("PropertyName");if(c!==null&&JSON.parse(e.sliceDoc(c.from,c.to))===l){o=a;break}}if(o===null)return;r={from:o.from,to:o.to},s=o.lastChild}}return r}static elements(e){const n=[];for(let t=e.firstChild;t!==null;t=t.nextSibling)["[","]",",","LineComment","BlockComment"].includes(t.name)||n.push(t);return n}static indexOf(e,n){return q.elements(e).findIndex(t=>t.from===n.from&&t.to===n.to)}}class A{static MAX_EDITS=1500;static MAX_WORK=1e6;static changed(e,n){return A.compare(e,n).changed}static compare(e,n){let t=0;for(;t<e.length&&t<n.length&&e[t]===n[t];)t++;let s=e.length,r=n.length;for(;s>t&&r>t&&e[s-1]===n[r-1];)s--,r--;const l=e.slice(t,s),o=n.slice(t,r),a=(g,x)=>Array.from({length:Math.max(0,x-g)},(S,N)=>g+N);if(l.length===0)return{changed:a(t,t+o.length),removed:[]};if(o.length===0)return{changed:[],removed:[t]};const c=A.matchedOf(l,o);if(c===void 0){const g=A.nearOf(l,o);return{changed:g.changed.map(x=>t+x),removed:g.removed.map(x=>t+x)}}const u=[],h=[];let f=-1,d=-1;const m=(g,x)=>{g-f-1>x-d-1&&h.push(t+x)};for(let g=0;g<o.length;g++){const x=c.get(g);if(x===void 0){u.push(t+g);continue}m(x,g),f=x,d=g}return m(l.length,o.length),{changed:u,removed:h}}static LOOKAHEAD=64;static nearOf(e,n){const t=[],s=[];let r=0,l=0;const o=(a,c,u)=>{for(let h=1;h<=A.LOOKAHEAD&&c+h<a.length;h++)if(a[c+h]===u)return h;return 0};for(;r<e.length&&l<n.length;){if(e[r]===n[l]){r++,l++;continue}const a=o(n,l,e[r]),c=o(e,r,n[l]);if(a>0&&(c===0||a<=c)){for(let u=0;u<a;u++)t.push(l+u);l+=a}else c>0?(s.push(l),r+=c):(t.push(l),r++,l++)}for(;l<n.length;l++)t.push(l);return r<e.length&&s.push(n.length),{changed:t,removed:s}}static matchedOf(e,n){const t=e.length,s=n.length,r=Math.min(t+s,A.MAX_EDITS),l=r+1,o=new Int32Array(2*r+3),a=[];let c=0;for(let u=0;u<=r;u++){a.push(o.slice());for(let h=-u;h<=u;h+=2){const f=h===-u||h!==u&&o[l+h-1]<o[l+h+1];let d=f?o[l+h+1]:o[l+h-1]+1,m=d-h;for(;d<t&&m<s&&e[d]===n[m];)d++,m++;if(c+=1+d-(f?o[l+h+1]:o[l+h-1]+1),c>A.MAX_WORK)return;if(o[l+h]=d,d>=t&&m>=s)return A.walkBack(a,u,t,s,l)}}}static walkBack(e,n,t,s,r){const l=new Map;let o=t,a=s;for(let c=n;c>0;c--){const u=e[c],h=o-a,d=h===-c||h!==c&&u[r+h-1]<u[r+h+1]?h+1:h-1,m=u[r+d],g=m-d;for(;o>m&&a>g;)o--,a--,l.set(a,o);o=m,a=g}for(;o>0&&a>0;)o--,a--,l.set(a,o);return l}}class G{static CHUNK=65536;static commonPrefix(e,n){const t=Math.min(e.length,n.length),s=G.CHUNK;let r=0;for(;r+s<=t&&e.slice(r,r+s)===n.slice(r,r+s);)r+=s;for(;r<t&&e.charCodeAt(r)===n.charCodeAt(r);)r++;return r}static commonSuffix(e,n,t){const s=G.CHUNK;let r=0;for(;r+s<=t&&e.slice(e.length-r-s,e.length-r)===n.slice(n.length-r-s,n.length-r);)r+=s;for(;r<t&&e.charCodeAt(e.length-1-r)===n.charCodeAt(n.length-1-r);)r++;return r}}class p{static COLOURS=Ct.define([{tag:w.propertyName,color:"var(--file-key)"},{tag:[w.string,w.attributeValue],color:"var(--file-string)"},{tag:[w.number,w.bool,w.null],color:"var(--file-literal)"},{tag:w.invalid,color:"var(--rr0-alert)"}]);view;placement;changing=!1;cachedText;editedSinceWritten=!1;changedField;silent=!1;static SET_BASELINE=T.define();static WHOLE_TEXT=St.define();static marker(e,n){return new class extends Ne{toDOM(){const t=document.createElement("div");if(t.className=e?"cm-changed-bar":"cm-changed-none",n){const s=document.createElement("div");s.className="cm-removed-tick",t.appendChild(s)}return t}}}static JSON_LINT=yn();static CHANGED_MARKER=p.marker(!0,!1);static REMOVED_MARKER=p.marker(!1,!0);static BOTH_MARKER=p.marker(!0,!0);static REVEAL=T.define();static revealed=V.define({create:()=>null,update:(e,n)=>{for(const t of n.effects)if(t.is(p.REVEAL))return t.value;return e===null?null:{from:n.changes.mapPos(e.from,1),to:n.changes.mapPos(e.to,-1)}},provide:e=>O.decorations.compute([e],n=>{const t=n.field(e),s=new _;if(t!==null)for(let r=n.doc.lineAt(t.from).number;r<=n.doc.lineAt(Math.min(t.to,n.doc.length)).number;r++)s.add(n.doc.line(r).from,n.doc.line(r).from,P.line({class:"cm-revealed-line"}));return s.finish()})});static removedLines(e,n){return new Set([...n].map(t=>Math.min(t,e.doc.lines-1)))}static changeMarks(e){const n=o=>({text:o,doc:Ft.of(o.split(`
3
3
  `))}),t=(o,a,c)=>{const u=c??a.doc.toString(),h=p.commonPrefix(o.text,u);if(h===o.text.length&&h===u.length)return{baseline:o,changed:new Set,removed:new Set};const f=p.commonSuffix(o.text,u,Math.min(o.text.length,u.length)-h),d=a.doc.lineAt(h).number,m=o.doc.lineAt(o.text.length-f).number,g=a.doc.lineAt(u.length-f).number,x=(y,F)=>y.sliceString(y.line(d).from,y.line(F).to).split(`
4
4
  `),{changed:S,removed:N}=A.compare(x(o.doc,m),x(a.doc,g)),v=d-1;return{baseline:o,changed:new Set(S.map(y=>y+v)),removed:new Set(N.map(y=>y+v))}},s=V.define({create:o=>t(n(e),o),update:(o,a)=>{let c=o.baseline;for(const u of a.effects)u.is(p.SET_BASELINE)&&(c=n(u.value));return!a.docChanged&&c===o.baseline?o:t(c,a.state,a.annotation(p.WHOLE_TEXT))}}),r=O.decorations.compute([s],o=>{const a=o.field(s),c=p.removedLines(o,a.removed),u=new Set([...a.changed,...c]),h=new _;for(const f of[...u].sort((d,m)=>d-m)){if(f>=o.doc.lines)continue;const d=[a.changed.has(f)?"cm-changed-line":"",[...a.removed].some(m=>m===f)?"cm-removed-above":"",[...a.removed].some(m=>m>=o.doc.lines)&&f===o.doc.lines-1?"cm-removed-below":""].filter(Boolean).join(" ");h.add(o.doc.line(f+1).from,o.doc.line(f+1).from,P.line({class:d}))}return h.finish()}),l=Ie({class:"cm-changed-gutter",lineMarker:(o,a)=>{const c=o.state.field(s),u=o.state.doc.lineAt(a.from).number-1,h=c.changed.has(u),f=p.removedLines(o.state,c.removed).has(u);return h&&f?p.BOTH_MARKER:h?p.CHANGED_MARKER:f?p.REMOVED_MARKER:null},lineMarkerChange:o=>o.docChanged||o.transactions.some(a=>a.effects.some(c=>c.is(p.SET_BASELINE))),initialSpacer:()=>p.CHANGED_MARKER});return{field:s,extensions:[s,r,l]}}constructor(e,n,t,s,r={}){const l=[...Nt,...Dt,...Bt,...$t,...qt,...Rn,...pn,Vt],o=p.changeMarks(r.baseline??n);this.changedField=o.field,l.unshift({key:"F7",run:()=>this.gotoChange(1),preventDefault:!0},{key:"Shift-F7",run:()=>this.gotoChange(-1),preventDefault:!0}),this.view=new O({...p.rootOf(e),doc:n,extensions:[...o.extensions,p.revealed,Mt(),tn({top:!0}),ce.phrases.of(r.phrases??{}),Pt(),Rt(),Tt(),At(),Lt(),Qt(),Et(),Wt(),It.of(l),ce.tabSize.of(2),Ht(p.COLOURS,{fallback:!0}),wn(),Xe.data.of({autocomplete:new H([],r.schema).source}),qn(),An(a=>a.dom.isConnected?p.JSON_LINT(a):[]),O.contentAttributes.of({"aria-label":s}),O.theme({"&":{maxHeight:"28rem",fontSize:"0.82em",border:"1px solid color-mix(in srgb, currentColor 25%, transparent)",borderRadius:"4px"},"&.cm-focused":{outline:"2px solid color-mix(in srgb, currentColor 45%, transparent)"},".cm-scroller":{overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},".cm-tooltip":{backgroundColor:"Canvas",color:"CanvasText",border:"1px solid color-mix(in srgb, CanvasText 30%, transparent)"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"Highlight",color:"HighlightText"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"currentColor"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:"color-mix(in srgb, currentColor 22%, transparent)"},".cm-gutters":{backgroundColor:"transparent",color:"color-mix(in srgb, currentColor 55%, transparent)",border:"none"},".cm-changed-gutter":{width:"4px"},".cm-changed-bar":{width:"3px",height:"100%",backgroundColor:"#2f81f7"},".cm-changed-gutter .cm-gutterElement":{position:"relative"},".cm-changed-none":{width:"3px",height:"100%"},".cm-removed-tick":{position:"absolute",left:"0",top:"0",width:"0",height:"0",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"6px solid #e5534b"},".cm-removed-above":{boxShadow:"inset 0 2px 0 #e5534b"},".cm-removed-below":{boxShadow:"inset 0 -2px 0 #e5534b"},".cm-changed-line":{backgroundColor:"color-mix(in srgb, #2f81f7 13%, transparent)"},".cm-revealed-line":{backgroundColor:"color-mix(in srgb, #f2cc60 30%, transparent)",boxShadow:"inset 3px 0 0 #f2cc60"},".cm-panels":{backgroundColor:"color-mix(in srgb, currentColor 6%, transparent)",color:"inherit",borderColor:"color-mix(in srgb, currentColor 25%, transparent)"},".cm-panel.cm-search input, .cm-panel.cm-search button":{fontSize:"inherit",color:"inherit"},".cm-panel.cm-search input[type=text], .cm-panel.cm-search input:not([type])":{backgroundColor:"color-mix(in srgb, currentColor 8%, transparent)",border:"1px solid color-mix(in srgb, currentColor 35%, transparent)",borderRadius:"3px",padding:"2px 5px"},".cm-panel.cm-search button":{backgroundImage:"none",backgroundColor:"color-mix(in srgb, currentColor 12%, transparent)",border:"1px solid color-mix(in srgb, currentColor 35%, transparent)",borderRadius:"3px"},".cm-panel.cm-search label, .cm-panel.cm-search [name=close]":{color:"inherit"},".cm-searchMatch":{backgroundColor:"color-mix(in srgb, #f2cc60 40%, transparent)"},".cm-searchMatch-selected":{backgroundColor:"color-mix(in srgb, #f2cc60 75%, transparent)"}}),O.updateListener.of(a=>{a.docChanged&&(this.cachedText=void 0),a.docChanged&&!this.changing&&(this.editedSinceWritten=!0,t(this.text)),a.selectionSet&&!this.silent&&!this.changing&&a.view.hasFocus&&(a.state.field(p.revealed)!==null&&queueMicrotask(()=>this.view.dispatch({effects:p.REVEAL.of(null)})),r.caretMoved?.(q.at(a.state,a.state.selection.main.head)))})]}),this.placement=this.placeWhileShown(e)}placeWhileShown(e){const n=()=>{e.append(this.view.dom),Ln(this.view);const{root:s}=p.rootOf(e);s&&s!==this.view.root&&this.view.setRoot(s)};if((typeof e.checkVisibility!="function"||e.checkVisibility())&&n(),typeof ResizeObserver>"u")return;const t=new ResizeObserver(s=>{const r=s[s.length-1].contentRect.width>0;r&&!this.view.dom.isConnected?(n(),this.view.requestMeasure()):!r&&this.view.dom.isConnected&&this.view.dom.remove()});return t.observe(e),t}get text(){return this.cachedText??=this.view.state.doc.toString()}get edited(){return this.editedSinceWritten}set text(e){this.replaceText(e,!1)}replaceText(e,n){const t=this.text;if(e!==t){this.changing=!0;try{const s=Math.min(this.view.state.selection.main.head,e.length);this.view.dispatch({changes:p.changesBetween(t,e),selection:{anchor:s},annotations:[Kt.of("full"),p.WHOLE_TEXT.of(e)]})}finally{this.changing=!1}this.cachedText=e,this.editedSinceWritten=!1,n&&this.revealChange(t,p.MOST_LINES_SHOWN)}}static rootOf(e){const n=e.getRootNode();return n instanceof Document||n instanceof ShadowRoot?{root:n}:{}}static changeBetween(e,n){const t=p.commonPrefix(e,n),s=p.commonSuffix(e,n,Math.min(e.length,n.length)-t);return{from:t,to:e.length-s,insert:n.slice(t,n.length-s)}}static changesBetween(e,n){const t=p.commonPrefix(e,n);if(t===e.length&&t===n.length)return[];const s=p.commonSuffix(e,n,Math.min(e.length,n.length)-t),r=e.lastIndexOf(`