{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://explora4d.eu/viewer/schema/AIM3DViewer-schema.json",
  "title": "AIM3DViewer Manifest",
  "type": "object",
  "required": ["@context", "id", "type", "items"],
  "properties": {
    "@context": {
      "anyOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": ["string", "object"] } }
      ]
    },
    "id": { "type": "string" },
    "type": { "type": "string", "const": "Manifest" },
    "label": { "type": "object" },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "type"],
        "properties": {
          "id": { "type": "string" },
          "type": { "type": "string" },
          "items": { "type": "array" },
          "annotations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "AIM3DViewer": {
                        "type": "object",
                        "properties": {
                          "certainty": { "$ref": "#/$defs/certaintyAssessment" }
                        },
                        "additionalProperties": true
                      }
                    },
                    "additionalProperties": true
                  }
                }
              },
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      }
    },
    "AIM3DViewer": {
      "type": "object",
      "properties": {
        "version": { "type": "string", "pattern": "^\\d+(\\.\\d+)?$", "description": "Manifest format version, MAJOR.MINOR (manifest-version.js): a newer MINOR opens in an older viewer without what it does not know; a newer MAJOR does not." },
        "generatedAt": { "type": "string" },
        "camera": {
          "type": "object",
          "properties": {
            "position": { "$ref": "#/$defs/vector3" },
            "target": { "$ref": "#/$defs/vector3" },
            "up": { "$ref": "#/$defs/vector3" },
            "fov": { "type": "number" },
            "zoom": { "type": "number" },
            "distance": { "type": "number" },
            "perspectiveMode": { "enum": ["perspective", "orthographic"] },
            "aspect": { "type": "number", "exclusiveMinimum": 0 },
            "orientation": { "enum": ["landscape", "portrait"] }
          },
          "additionalProperties": true
        },
        "viewer": {
          "type": "object",
          "properties": {
            "container": { "type": "string" },
            "mailUrl": { "type": "string" },
            "mainUrl": { "type": "string" },
            "baseModulePath": { "type": "string" },
            "background": { "type": "string" },
            "credits": { "type": "object" },
            "auth": {
              "type": "object",
              "properties": {
                "enabled": { "type": "boolean" },
                "allowRegistration": { "type": "boolean" }
              },
              "additionalProperties": true
            },
            "manifestoForm": { "$ref": "#/$defs/panelState" },
            "metadataContainer": { "$ref": "#/$defs/panelState" },
            "baseNamespace": { "type": "string" },
            "metadataUrl": { "type": "string" },
            "theme": { "enum": ["light", "dark"] },
            "language": { "enum": ["en", "pl", "de"] },
            "backgroundColor": { "type": "string" },
            "environmentMap": {
              "type": "object",
              "properties": {
                "intensity": { "type": "number" },
                "preset": { "type": "string" },
                "enabled": { "type": "boolean" }
              },
              "additionalProperties": true
            },
            "rendering": {
              "type": "object",
              "properties": {
                "toneMapping": { "enum": ["none", "linear", "reinhard", "cineon", "aces", "agx", "neutral"] },
                "exposure": { "type": "number", "minimum": 0 },
                "postprocessing": {
                  "type": "object",
                  "properties": {
                    "enabled": { "type": "boolean" },
                    "antialias": { "enum": ["msaa", "smaa", "fxaa", "none"] },
                    "ao": { "type": "boolean" },
                    "aoIntensity": { "type": "number", "minimum": 0, "maximum": 2 }
                  },
                  "additionalProperties": true
                }
              },
              "additionalProperties": true
            },
            "lightweight": { "type": "boolean" },
            "editor": { "type": "boolean" },
            "presentationMode": { "type": "boolean" },
            "sandbox": { "type": "boolean" },
            "forceLocalPreview": { "type": "boolean" },
            "autorotate": { "type": "boolean" },
            "autorotateSpeed": { "type": "number" },
            "disableInteraction": { "type": "boolean" },
            "hideUi": { "type": "boolean" },
            "hideMetadata": { "type": "boolean" },
            "showNotifications": { "type": "boolean" },
            "scale": { "$ref": "#/$defs/vector2orObject" },
            "window": {
              "type": "object",
              "properties": {
                "position": { "$ref": "#/$defs/vector2orObject" },
                "size": {
                  "type": "object",
                  "properties": {
                    "width": { "type": "number", "minimum": 0 },
                    "height": { "type": "number", "minimum": 0 }
                  },
                  "additionalProperties": true
                }
              },
              "additionalProperties": true
            },
            "performance": { "type": "string" },
            "units": { "type": ["number", "string"] },
            "gallery": { "type": "object" },
            "editorToolbar": {
              "type": "object",
              "properties": {
                "enabled": { "type": "boolean" },
                "position": { "$ref": "#/$defs/vector2orObject" },
                "expanded": { "type": "boolean" },
                "visible": { "type": "boolean" },
                "profile": {
                  "description": "The tools for the kind of model shown (mesh, bim, pointcloud, splats, volume): false keeps the toolbar as it is; promote replaces the tools brought onto the bar, in order of importance; hide replaces those left out.",
                  "oneOf": [
                    { "const": false },
                    {
                      "type": "object",
                      "properties": {
                        "enabled": { "type": "boolean" },
                        "promote": { "type": "array", "items": { "type": "string", "minLength": 1 } },
                        "hide": { "type": "array", "items": { "type": "string", "minLength": 1 } }
                      },
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "additionalProperties": true
            },
            "menuToolbar": {
              "type": "object",
              "properties": {
                "enabled": { "type": "boolean" },
                "position": { "$ref": "#/$defs/vector2orObject" }
              },
              "additionalProperties": true
            },
            "clipping": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "object",
                  "properties": {
                    "x": { "type": "boolean" },
                    "y": { "type": "boolean" },
                    "z": { "type": "boolean" }
                  },
                  "additionalProperties": true
                },
                "negated": {
                  "description": "The planes flipped to keep the other side (default: each keeps the side below its cut).",
                  "type": "object",
                  "properties": {
                    "x": { "type": "boolean" },
                    "y": { "type": "boolean" },
                    "z": { "type": "boolean" }
                  },
                  "additionalProperties": true
                },
                "constants": { "$ref": "#/$defs/vector3" },
                "outlineVisible": { "type": "boolean" }
              },
              "additionalProperties": true
            }
          },
          "additionalProperties": true
        },
        "integration": {
          "type": "object",
          "properties": {
            "type": { "type": "string" },
            "exportViewerUrl": { "type": "string" },
            "api": {
              "type": "object",
              "properties": {
                "thumbnailUploadEndpoint": { "type": "string" }
              },
              "additionalProperties": true
            }
          },
          "additionalProperties": true
        },
        "lights": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": { "type": "string" },
              "position": { "$ref": "#/$defs/vector3" },
              "target": { "$ref": "#/$defs/vector3" },
              "color": { "type": "string" },
              "intensity": { "type": "number" },
              "name": { "type": "string" },
              "castShadow": { "type": "boolean" }
            },
            "additionalProperties": true
          }
        },
        "certainty": { "$ref": "#/$defs/certaintyScale" },
        "rakingLight": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean" },
            "direction": { "type": "number", "minimum": 0, "maximum": 360 },
            "height": { "type": "number", "minimum": 1, "maximum": 89 },
            "sweep": { "type": "boolean" }
          },
          "additionalProperties": true
        },
        "timeline": { "$ref": "#/$defs/timeline" },
        "variants": { "$ref": "#/$defs/variants" },
        "compare": { "$ref": "#/$defs/compare" },
        "location": {
          "description": "Where the model stands on the Earth, for the sun.",
          "type": "object",
          "required": ["latitude", "longitude"],
          "properties": {
            "latitude": { "type": "number", "minimum": -90, "maximum": 90 },
            "longitude": { "type": "number", "minimum": -180, "maximum": 180 },
            "north": { "type": "number", "description": "Direction of north in the scene: degrees clockwise from -Z, seen from above (default 0)." },
            "utcOffset": { "type": "number", "minimum": -14, "maximum": 14, "description": "Hours the local time is ahead of UTC (default: longitude / 15, rounded)." }
          },
          "additionalProperties": true
        },
        "sun": {
          "description": "The sun at a place (AIM3DViewer.location) on a day and hour, casting shadows; exported while on.",
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean" },
            "date": { "type": "string", "pattern": "^(-?\\d{1,4}-)?\\d{1,2}-\\d{1,2}$", "description": "\"MM-DD\", or \"YYYY-MM-DD\" (the year is the timeline's while followTimeline is on; default: today at the model's place)." },
            "time": { "type": "string", "pattern": "^\\d{1,2}:\\d{2}$", "description": "Local time, \"HH:MM\" (default: the time now at the model's place)." },
            "followTimeline": { "type": "boolean", "description": "Take the year from the 4D timeline (default true)." },
            "animate": { "type": "boolean", "description": "Play the day on open (default false)." }
          },
          "additionalProperties": true
        },
        "weather": {
          "description": "The weather around the model (Look > Weather); exported while on.",
          "type": "object",
          "required": ["type"],
          "properties": {
            "type": { "enum": ["clear", "fog", "rain", "snow", "storm"] },
            "intensity": { "type": "number", "minimum": 0, "maximum": 1, "description": "Default 0.6." },
            "wind": { "type": "number", "minimum": 0, "maximum": 1, "description": "Default 0.2; a storm brings at least some." },
            "windDirection": { "type": "number", "description": "Where the wind blows to: degrees clockwise from -Z, seen from above (default 230)." },
            "mistHeight": { "type": "number", "minimum": 0, "maximum": 1, "description": "The mist's height: 0 to 1 is 0.15 to 1.15 model sizes (default 0.4)." },
            "mistDensity": { "type": "number", "minimum": 0, "maximum": 1, "description": "The mist's density (default 0.5)." },
            "mistSpread": { "type": "number", "minimum": 0, "maximum": 1, "description": "0: clumps with gaps; 1: an even blanket thinning upwards (default 0.6)." },
            "season": { "enum": ["spring", "summer", "autumn", "winter", null], "description": "A season (Look > Seasons): a colour grade of the model and petals, pollen, leaves or snow in the air." },
            "sky": { "type": "boolean", "description": "Show the sky with clouds around the model (default true)." },
            "surfaces": { "type": "boolean", "description": "Wet surfaces and snow cover on the model (default true)." }
          },
          "additionalProperties": true
        },
        "measurements": {
          "description": "The measurements placed in the viewer (Measure): distances, angles and areas, drawn when the manifest loads. Their points are in the model's own coordinates (before modelTransform), so they stay on the model.",
          "type": "array",
          "items": {
            "type": "object",
            "required": ["mode", "points"],
            "properties": {
              "mode": { "enum": ["distance", "angle", "area"], "description": "distance: a path through the points, each segment and the total; angle: start, vertex, end; area: the corners of a polygon, closed back to the first." },
              "points": {
                "type": "array",
                "minItems": 2,
                "description": "The points as [x, y, z]: at least 2 for a distance, 3 for an angle (only the first 3 count) and an area.",
                "items": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number" } }
              }
            },
            "allOf": [
              { "if": { "properties": { "mode": { "enum": ["angle", "area"] } } }, "then": { "properties": { "points": { "minItems": 3 } } } }
            ],
            "additionalProperties": true
          }
        },
        "materials": {
          "description": "The model's materials as edited in the viewer (Look > Materials); exported while any is edited. The model's own materials stay as they are in its file.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "index": { "type": "integer", "minimum": 0, "description": "The material's place in the model (the order the viewer meets them in)." },
              "name": { "type": "string", "description": "The material's name in the file; with the index it finds the material." },
              "preset": { "enum": ["glass", "frostedGlass", "tintedGlass", "water", "lightWood", "darkWood", "varnishedWood", "plaster", "paintedWall", "concrete", "brick", "sandstone", "marble", "terracotta", "ceramic", "steel", "aluminium", "iron", "brass", "gold", "copper", "bronze", "mirror", "plastic", "rubber", "fabric", "clay", "light", null], "description": "The built-in material type applied first." },
              "keepTexture": { "type": "boolean", "description": "The type keeps the colour texture (default true)." },
              "params": {
                "type": "object",
                "description": "The properties over the type: colours as \"#rrggbb\", the rest as numbers.",
                "properties": {
                  "color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
                  "emissive": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
                  "roughness": { "type": "number", "minimum": 0, "maximum": 1 },
                  "metalness": { "type": "number", "minimum": 0, "maximum": 1 },
                  "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
                  "transmission": { "type": "number", "minimum": 0, "maximum": 1 },
                  "thickness": { "type": "number", "minimum": 0 },
                  "ior": { "type": "number", "minimum": 0 },
                  "clearcoat": { "type": "number", "minimum": 0, "maximum": 1 },
                  "clearcoatRoughness": { "type": "number", "minimum": 0, "maximum": 1 },
                  "sheen": { "type": "number", "minimum": 0, "maximum": 1 },
                  "emissiveIntensity": { "type": "number", "minimum": 0 },
                  "doubleSided": { "type": "boolean" }
                },
                "additionalProperties": true
              }
            },
            "additionalProperties": true
          }
        },
        "surroundings": {
          "description": "Generated surroundings: a typical setting (a settlement, fields, a forest) drawn schematically round the model from its kind, period and seed. A hypothesis about the kind of place, not a reconstruction of this one; exported while shown.",
          "type": "object",
          "required": ["kind"],
          "properties": {
            "generated": { "type": "boolean", "description": "Always true in exports: says what the block is to whoever reads the manifest." },
            "life": { "type": "boolean", "description": "People walking the streets, carts and later cars on the roads, boats on the water, in the realistic look (default true); generated like the rest." },
            "pastTerrain": { "type": "boolean", "description": "On the real terrain: what was made later (reservoirs, dams, quarries, landfills, spoil heaps, embankments, from OpenStreetMap with their start_date) taken away for the years before (default true)." },
            "open": { "type": "boolean", "description": "Their window open on load: the year's slider with its milestones, and play through the years." },
            "kind": { "enum": ["castle", "town", "church", "village", "monastery", "manor", "manor-farm", "shtetl", "port"], "description": "What the model is: a castle gets a settlement beside it; a church, a house or a town's building stands in the middle of theirs; a monastery its precinct, a manor house its park and farm, a manor farm its yard (a village beyond each); a shtetl's building a market square of timber houses; a port's building a town on the shore with quays and warehouses." },
            "period": { "enum": ["early-medieval", "medieval", "early-modern", "industrial", "modern", "postwar", "contemporary"], "description": "From 900, 1250, 1550, 1800, 1914, 1945 or 1990 (to 2025) (default: from `year`)." },
            "year": { "type": "number", "description": "The year shown (default 1350)." },
            "season": { "enum": ["spring", "summer", "autumn", "winter"], "description": "Winter is drawn under snow (default summer)." },
            "seed": { "type": "integer", "minimum": 0, "maximum": 4294967295, "description": "The same seed gives the same layout." },
            "density": { "type": "number", "minimum": 0, "maximum": 1, "description": "How built-up the settlement is (default 0.6)." },
            "style": { "enum": ["schematic", "realistic"], "description": "Plain pale shapes (default), or the materials, openings, vegetation and haze of the period, cast shadows, wind and smoke. Marked as generated either way." },
            "water": { "type": "boolean", "description": "A moat round a castle, a river past a town or a village (by the seed); default true." },
            "terrain": { "enum": ["generated", "real"], "description": "Generated low hills (default), or the real terrain of the place from elevation data (needs latitude and longitude, else the manifest's location)." },
            "layoutUrl": { "type": "string", "description": "GeoJSON of an old map's roads, fields, buildings and walls (dated), which take the place of the generated ones; relative: next to the manifest." },
            "mapOverlay": {
              "type": "object",
              "description": "An old map's tiles draped over the ground.",
              "required": ["url"],
              "properties": {
                "url": { "type": "string", "description": "XYZ tiles: {z}, {x}, {y} (and {s}); they must allow cross-origin use." },
                "opacity": { "type": "number", "minimum": 0, "maximum": 1, "description": "Default 0.85." },
                "attribution": { "type": "string", "description": "What the map's licence asks to be shown; shown in the badge." }
              },
              "additionalProperties": true
            },
            "waterUrl": { "type": "string", "description": "GeoJSON of the water as it was, digitised from an old map (relative: next to the manifest); used before any map on the real terrain." },
            "region": { "enum": ["central", "mediterranean", "nordic", "british", "eastern"], "description": "The building tradition: Central Europe (default), the Mediterranean (stone and render, low tiled or flat roofs, cypresses and olive groves), the North (painted timber, turf roofs, whitewashed churches), the British Isles (stone and brick, thatch and slate, square church towers, hedgerows) or Eastern Europe (log houses, wooden churches with onion domes); the Suggested scene picks it by the place." },
            "masonry": { "enum": ["brick", "stone"], "description": "What churches, towers and town walls are built of (default brick; the Suggested scene picks it by the region)." },
            "followTimeline": { "type": "boolean", "description": "Follow the 4D timeline's year: its period and how far the settlement has grown; hidden in years outside 900-2025." },
            "growth": { "type": "number", "minimum": 0, "maximum": 1, "description": "The share of the settlement's houses built (default 1); set from the year while following the timeline." },
            "latitude": { "type": "number", "minimum": -85, "maximum": 85, "description": "The place, for the real terrain." },
            "longitude": { "type": "number", "minimum": -180, "maximum": 180, "description": "The place, for the real terrain." }
          },
          "additionalProperties": true
        },
        "sceneSuggest": {
          "description": "The Suggested scene window (Look > Suggested scene) open when the manifest loads; nothing is applied until the user does.",
          "type": "object",
          "properties": {
            "open": { "type": "boolean", "description": "Open the window on load (default false)." },
            "purpose": { "enum": ["documentation", "presentation"], "description": "The purpose shown first (default: the one the rules pick)." }
          },
          "additionalProperties": true
        },
        "data": {
          "description": "Live data: a table (CSV, TSV, JSON) that drives the model. Each row belongs to the part of the model its key cell names; its other cells give the part's colour, label, alert and visibility. The table stays connected (its URL read again every `refresh` seconds), and what changes moves to its new look without the model being loaded again.",
          "type": "object",
          "properties": {
            "src": { "type": "string", "description": "The table's URL: CSV or TSV with the column names in the first line (comma, semicolon or tab), or JSON (an array of objects, or { rows: [...] })." },
            "refresh": { "type": "number", "minimum": 0, "description": "Seconds between two reads of `src` (0.5 to 3600); 0 or absent: read once." },
            "rows": { "type": "array", "items": { "type": "object" }, "description": "The table itself, one object per row, instead of `src` (or shown until `src` has been read)." },
            "key": { "type": "string", "description": "The column with the part's name: an object's name in the model (compared without case, spaces and punctuation), or an IFC element's GlobalId. Default: the column that names most objects." },
            "color": {
              "description": "The colour: a column's name, or an object. A numeric column runs along the ramp from `min` to `max`; a text column gets a colour per value; a cell that is a colour (#rrggbb) is used as it is.",
              "oneOf": [
                { "type": "string" },
                {
                  "type": "object",
                  "properties": {
                    "column": { "type": "string" },
                    "ramp": { "oneOf": [{ "enum": ["heat", "viridis", "blue", "green", "traffic", "diverging"] }, { "type": "array", "items": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }, "minItems": 2 }], "description": "A ramp's name (default heat) or its colours, lowest value first." },
                    "reverse": { "type": "boolean", "description": "The ramp the other way round (default false)." },
                    "min": { "type": "number", "description": "The value at the ramp's start (default: the column's lowest)." },
                    "max": { "type": "number", "description": "The value at the ramp's end (default: the column's highest)." },
                    "categories": { "type": "object", "additionalProperties": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }, "description": "A text column's colours: value -> colour. Values not listed get the palette's next colour." }
                  },
                  "required": ["column"],
                  "additionalProperties": true
                }
              ]
            },
            "label": {
              "description": "A cell shown above the part: a column's name, or { column, unit, name }.",
              "oneOf": [
                { "type": "string" },
                {
                  "type": "object",
                  "properties": {
                    "column": { "type": "string" },
                    "unit": { "type": "string", "description": "Written after the value (%, °C, mm)." },
                    "name": { "type": "boolean", "description": "The part's name before the value (default false)." }
                  },
                  "required": ["column"],
                  "additionalProperties": true
                }
              ]
            },
            "alert": {
              "description": "The part pulses while its cell is above `above`, below `below`, or equal to `equals`.",
              "oneOf": [
                { "type": "string" },
                {
                  "type": "object",
                  "properties": {
                    "column": { "type": "string" },
                    "above": { "type": "number" },
                    "below": { "type": "number" },
                    "equals": { "type": ["string", "number"] }
                  },
                  "required": ["column"],
                  "additionalProperties": true
                }
              ]
            },
            "visible": {
              "description": "The part is hidden while its cell says 0, false, no or off (an empty cell hides nothing): a column's name, or { column }.",
              "oneOf": [
                { "type": "string" },
                { "type": "object", "properties": { "column": { "type": "string" } }, "required": ["column"], "additionalProperties": true }
              ]
            },
            "strength": { "type": "number", "minimum": 0, "maximum": 1, "description": "How much of the colour covers the part's own material (default 0.75)." },
            "transition": { "type": "number", "minimum": 0, "description": "Seconds a change takes to show (default 0.9; 0: at once)." },
            "open": { "type": "boolean", "description": "The Live data window open on load (default true)." }
          },
          "additionalProperties": true
        },
        "sounds": {
          "description": "Sound in the scene: sources heard from where the camera is. Also written as AmbientAudio / PointAudio / SpotAudio annotations painted into the scene, for other viewers; this block wins when both are there.",
          "type": "object",
          "properties": {
            "autoplay": { "type": "boolean", "description": "Play from the first click or key press in the page (browsers allow sound only after one); default false: from the Sounds window's play button." },
            "volume": { "type": "number", "minimum": 0, "maximum": 1, "description": "All of them (default 1)." },
            "sources": { "type": "array", "items": { "$ref": "#/$defs/sound" } },
            "acoustics": {
              "description": "The room's acoustics: the sounds heard with the reverberation worked out from the model's geometry at a listening point (worked out again when they play).",
              "type": "object",
              "properties": {
                "on": { "type": "boolean", "description": "Hear the sounds in the room (default false)." },
                "position": { "$ref": "#/$defs/vector3", "description": "The listening point, in scene coordinates (default: where the camera is)." },
                "material": { "enum": ["stone", "plaster", "brick", "wood", "glass", "fabric", "ground"], "description": "The surfaces whose material's name does not say what they are (default plaster)." },
                "floor": { "enum": ["material", "pews", "people"], "description": "What covers the floors (surfaces facing up): their material (default), empty benches or pews, benches with people." },
                "amount": { "type": "number", "minimum": 0, "maximum": 2, "description": "The reverberation, louder or quieter than worked out (default 1)." }
              },
              "additionalProperties": true
            }
          },
          "additionalProperties": true
        },
        "image": {
          "description": "A 2D image's tools (when the scene shows an Image): the settings that are not the defaults.",
          "type": "object",
          "properties": {
            "brightness": { "type": "number", "minimum": -0.5, "maximum": 0.5 },
            "contrast": { "type": "number", "minimum": 0, "maximum": 3 },
            "gamma": { "type": "number", "minimum": 0.2, "maximum": 3 },
            "saturation": { "type": "number", "minimum": 0, "maximum": 3 },
            "invert": { "type": "boolean" },
            "channel": { "enum": ["rgb", "red", "green", "blue", "luminance"] },
            "autoLevels": { "type": "boolean" },
            "equalize": { "type": "boolean" },
            "sharpen": { "type": "number", "minimum": 0, "maximum": 2 },
            "relief": { "type": "number", "minimum": 0, "maximum": 1 },
            "reliefAngle": { "type": "number", "minimum": 0, "maximum": 360, "description": "Where the relief's light comes from, degrees (0: the right, 90: the top)." },
            "edges": { "type": "number", "minimum": 0, "maximum": 1 },
            "dstretch": { "type": "boolean", "description": "Decorrelation stretch." },
            "falseColor": { "enum": ["none", "inferno", "viridis", "turbo"] },
            "compare": { "type": "boolean", "description": "The original shown left of the line at `split` (0 to 1)." },
            "split": { "type": "number", "minimum": 0, "maximum": 1 }
          },
          "additionalProperties": true
        },
        "audio": {
          "description": "An audio file's 3D view and playback (when the scene shows a Sound): the settings that are not the defaults.",
          "type": "object",
          "properties": {
            "frequencyScale": { "enum": ["log", "linear"] },
            "range": { "type": "number", "minimum": 30, "maximum": 120, "description": "The levels shown, dB below the loudest." },
            "heightScale": { "type": "number", "exclusiveMinimum": 0 },
            "showTerrain": { "type": "boolean" },
            "showWaveform": { "type": "boolean" },
            "playback": {
              "type": "object",
              "properties": {
                "volume": { "type": "number", "minimum": 0, "maximum": 1 },
                "rate": { "type": "number", "exclusiveMinimum": 0 },
                "preservePitch": { "type": "boolean" },
                "loop": { "type": "boolean" },
                "region": { "type": "object", "properties": { "start": { "type": "number", "minimum": 0 }, "end": { "type": "number", "minimum": 0 } }, "description": "The part played (seconds)." },
                "channelMode": { "enum": ["stereo", "mono", "left", "right"] },
                "filter": { "type": "object", "properties": { "type": { "enum": ["off", "lowpass", "highpass", "bandpass", "notch"] }, "frequency": { "type": "number", "exclusiveMinimum": 0 }, "q": { "type": "number", "exclusiveMinimum": 0 } } },
                "compressor": { "type": "boolean" },
                "reverb": { "enum": ["off", "room", "hall", "church"] },
                "reverbMix": { "type": "number", "minimum": 0, "maximum": 1 }
              },
              "additionalProperties": true
            }
          },
          "additionalProperties": true
        },
        "photos": {
          "description": "Historical photos laid over the model from the camera they were taken from.",
          "type": "array",
          "items": { "$ref": "#/$defs/photo" }
        },
        "thumbnails": {
          "description": "Renders of the model shown in the thumbnail gallery, in this order (any number). Without it the viewer shows its generic placeholder images. Relative URLs (\"./...\") resolve like the manifest's model URLs.",
          "type": "array",
          "items": {
            "anyOf": [
              { "type": "string", "minLength": 1 },
              {
                "type": "object",
                "required": ["src"],
                "properties": {
                  "src": { "type": "string", "minLength": 1 },
                  "label": { "$ref": "#/$defs/languageMap" }
                },
                "additionalProperties": true
              }
            ]
          }
        },
        "modelTransform": {
          "type": "object",
          "properties": {
            "position": { "$ref": "#/$defs/vector3" },
            "rotation": {
              "type": "object",
              "properties": {
                "x": { "type": "number" },
                "y": { "type": "number" },
                "z": { "type": "number" },
                "order": { "type": "string" }
              },
              "additionalProperties": true
            },
            "scale": { "$ref": "#/$defs/vector3" },
            "upAxis": {
              "type": "string",
              "enum": ["Y+", "Y-", "Z+", "Z-", "X+", "X-"],
              "description": "The axis of the model file that points up; the viewer turns it to +Y before applying position, rotation and scale. Y+ (default) for three.js / glTF models, Z+ for Z-up exports, Y- for a model upside down."
            },
            "wireframe": { "type": "boolean" },
            "shadingMode": {
              "type": "string",
              "enum": ["original", "standard", "phong", "lambert", "toon", "flat", "clay", "matcap", "normals", "custom"]
            },
            "customShader": {
              "type": "object",
              "properties": {
                "vertexShader": { "type": "string" },
                "fragmentShader": { "type": "string" }
              },
              "additionalProperties": true
            }
          },
          "additionalProperties": true
        },
        "clipping": {
          "type": "object",
          "properties": {
            "mode": {
              "type": "object",
              "properties": {
                "x": { "type": "boolean" },
                "y": { "type": "boolean" },
                "z": { "type": "boolean" }
              },
              "additionalProperties": true
            },
            "negated": {
              "type": "object",
              "properties": {
                "x": { "type": "boolean" },
                "y": { "type": "boolean" },
                "z": { "type": "boolean" }
              },
              "additionalProperties": true
            },
            "constants": { "$ref": "#/$defs/vector3" },
            "outlineVisible": { "type": "boolean" }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    },
    "modified": { "type": "string" }
  },
  "additionalProperties": true,
  "$defs": {
    "languageMap": {
      "description": "A IIIF language map ({\"pl\": [\"...\"]}) or a plain string.",
      "anyOf": [
        { "type": "string" },
        { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }
      ]
    },
    "certaintyScale": {
      "description": "Level of Certainty (LoC) scale. Levels are told apart by colour, code and symbol. A level's value is its lower bound: an assessment belongs to the highest level not above it.",
      "type": "object",
      "required": ["levels"],
      "properties": {
        "label": { "$ref": "#/$defs/languageMap" },
        "min": { "type": "number" },
        "max": { "type": "number" },
        "unassessedColor": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
        "visible": { "type": "boolean", "description": "Open the manifest in the LoC view." },
        "opacity": { "type": "number", "minimum": 0, "maximum": 1, "description": "Opacity of the colour overlays (default 0.4)." },
        "levels": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["value", "code", "color"],
            "properties": {
              "value": { "type": "number" },
              "code": { "type": "string", "minLength": 1, "description": "Short code, e.g. a letter (A-E)." },
              "symbol": { "type": "string", "description": "Shown with the code, e.g. ✓ or ?." },
              "color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
              "label": { "$ref": "#/$defs/languageMap" },
              "description": { "$ref": "#/$defs/languageMap" }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "timeline": {
      "description": "4D timeline: the model's stages in time. Any year can be shown; the stages around it are faded into each other. Stages come from the model (glTF scene extras `timeline`, or node extras `year`) unless listed here.",
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean", "description": "false: the model's own timeline is not used (default true)." },
        "showPanel": { "type": "boolean", "description": "Show the timeline panel (default true). Without it the model stays at `year`." },
        "year": { "type": "number", "description": "Year shown when the manifest opens (default startYear)." },
        "startYear": { "type": "number" },
        "endYear": { "type": "number" },
        "label": { "$ref": "#/$defs/languageMap" },
        "description": { "$ref": "#/$defs/languageMap" },
        "transition": { "enum": ["interpolate", "step"], "description": "interpolate: a year between two stages blends them (default); step: the last stage reached is shown, faded in over transitionDuration." },
        "transitionDuration": { "type": "number", "minimum": 0, "description": "Seconds a jump to another year (or a step fade) takes (default 0.8)." },
        "playback": {
          "type": "object",
          "properties": {
            "autoplay": { "type": "boolean" },
            "loop": { "type": "boolean" },
            "yearsPerSecond": { "type": "number", "exclusiveMinimum": 0 },
            "speed": { "type": "number", "exclusiveMinimum": 0, "description": "Multiple of yearsPerSecond chosen in the panel (default 0.5)." },
            "pauseAtEvents": { "type": "number", "minimum": 0, "description": "Seconds held on each documented stage while playing (default 1.5)." }
          },
          "additionalProperties": true
        },
        "stages": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["year"],
            "properties": {
              "year": { "type": "number" },
              "yearLabel": { "$ref": "#/$defs/languageMap" },
              "approximate": { "type": "boolean", "description": "The date is approximate (shown as c. 1730)." },
              "type": { "enum": ["documented", "modelled"], "description": "documented: an event from the sources; modelled: a state reconstructed between them." },
              "label": { "$ref": "#/$defs/languageMap" },
              "description": { "$ref": "#/$defs/languageMap" },
              "source": { "$ref": "#/$defs/languageMap" },
              "nodes": { "type": "array", "items": { "type": "string" }, "description": "Model nodes that show this stage. Left out: those of the model's stage of the same year." }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "variants": {
      "description": "Reconstruction variants: alternative hypotheses of the same object, each a set of model nodes. One is shown at a time; nodes of no variant are always shown. Variants come from the model (glTF scene extras `variants`, or node extras `variant`) unless listed here.",
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean", "description": "false: the model's own variants are not used (default true)." },
        "showPanel": { "type": "boolean", "description": "Show the variants panel (default true)." },
        "label": { "$ref": "#/$defs/languageMap" },
        "description": { "$ref": "#/$defs/languageMap" },
        "active": { "type": "string", "description": "Id of the variant shown (default the first)." },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": { "type": "string" },
              "label": { "$ref": "#/$defs/languageMap" },
              "description": { "$ref": "#/$defs/languageMap" },
              "source": { "$ref": "#/$defs/languageMap" },
              "certainty": { "type": "number", "description": "Level of Certainty value on the manifest's scale (AIM3DViewer.certainty), shown as the level's badge." },
              "nodes": { "type": "array", "items": { "type": "string" }, "description": "Model nodes of this variant. Left out: those of the model's variant with the same id." }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "compareSide": {
      "type": "object",
      "anyOf": [{ "required": ["variant"] }, { "required": ["year"] }, { "required": ["shading"] }, { "required": ["lighting"] }],
      "properties": {
        "variant": { "type": "string", "description": "Id of a variant." },
        "year": { "type": "number", "description": "A year of the timeline: the last stage reached is shown." },
        "shading": { "enum": ["original", "standard", "phong", "lambert", "toon", "flat", "clay", "matcap", "normals", "custom"], "description": "A shading mode (kind \"look\")." },
        "lighting": { "enum": ["current", "noEnvironment", "neutral", "sunny", "studio", "goldenHour", "raking"], "description": "The lighting (kind \"look\"): as set, without the environment map, an environment preset, or the raking light." }
      },
      "additionalProperties": true
    },
    "compare": {
      "description": "Comparison view, open when the manifest loads: two variants or two years of the timeline, or (kind \"look\") the model shaded and lit two ways, split by a divider (swipe) or side by side (split).",
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean", "description": "false: no comparison on open (default true)." },
        "kind": { "enum": ["content", "look"], "description": "content: variants or years (default); look: shading and lighting." },
        "mode": { "enum": ["swipe", "split"], "description": "swipe: one view split by a divider (default); split: two halves side by side." },
        "position": { "type": "number", "minimum": 0, "maximum": 1, "description": "Divider position across the canvas in swipe mode (default 0.5)." },
        "left": { "$ref": "#/$defs/compareSide" },
        "right": { "$ref": "#/$defs/compareSide" }
      },
      "additionalProperties": true
    },
    "sound": {
      "type": "object",
      "required": ["src"],
      "properties": {
        "id": { "type": "string" },
        "type": { "enum": ["ambient", "point", "spot"], "description": "ambient: everywhere at the same level; point: from `position`, fainter with the distance; spot: from `position` towards `lookAt`, full inside its cone (default: point with a position, else ambient)." },
        "src": { "type": "string", "minLength": 1, "description": "The sound file (WAV, MP3, FLAC, Ogg, M4A...). Relative URLs (\"./...\") resolve like the manifest's model URLs; another site must allow it (CORS)." },
        "label": { "type": "string" },
        "position": { "$ref": "#/$defs/vector3", "description": "Where it is, in scene coordinates (point, spot)." },
        "lookAt": { "$ref": "#/$defs/vector3", "description": "Where a spot source aims." },
        "angle": { "type": "number", "exclusiveMinimum": 0, "maximum": 360, "description": "A spot source's cone, degrees (default 90): full volume inside half of it, 15% outside it." },
        "distance": { "type": "number", "exclusiveMinimum": 0, "description": "Full volume up to this distance (scene units); halves with each doubling beyond it. Default: half the model's radius." },
        "volume": { "type": "number", "minimum": 0, "maximum": 1, "description": "Default 1." },
        "loop": { "type": "boolean", "description": "Default true." },
        "years": { "type": "array", "minItems": 2, "maxItems": 2, "items": { "type": ["number", "null"] }, "description": "[from, to]: heard only while the 4D timeline shows a year between them (null: open), faded in and out." },
        "on": { "type": "boolean", "description": "Default true; false: listed, not heard." },
        "acoustics": { "type": "boolean", "description": "Heard in the room's acoustics (sounds.acoustics); default: point and spot sources yes, ambient ones no." }
      },
      "additionalProperties": true
    },
    "photo": {
      "type": "object",
      "anyOf": [{ "required": ["src"] }, { "required": ["service"] }],
      "properties": {
        "id": { "type": "string" },
        "src": { "type": "string", "description": "Image URL, or a IIIF Image API info.json." },
        "service": { "description": "A IIIF Image API service (its URL or an object with id): the image is asked for at up to 2000 px.", "anyOf": [{ "type": "string" }, { "type": "object" }] },
        "label": { "$ref": "#/$defs/languageMap" },
        "description": { "$ref": "#/$defs/languageMap" },
        "source": { "$ref": "#/$defs/languageMap" },
        "year": { "type": "number", "description": "Year the photo was taken: the 4D timeline goes there when it opens." },
        "opacity": { "type": "number", "minimum": 0, "maximum": 1, "description": "Opacity of the photo over the model (default 0.6)." },
        "view": {
          "type": "object",
          "required": ["position", "target"],
          "properties": {
            "position": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number" } },
            "target": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number" } },
            "fov": { "type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 180, "description": "Vertical field of view in degrees." },
            "roll": { "type": "number", "description": "Tilt of the photo in degrees, clockwise." }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    },
    "certaintyAssessment": {
      "description": "Level of Certainty of the object (or group) an annotation targets.",
      "type": "object",
      "anyOf": [{ "required": ["value"] }, { "required": ["code"] }],
      "properties": {
        "value": { "type": "number" },
        "code": { "type": "string" },
        "scope": { "enum": ["object", "group"] },
        "targetId": { "type": "string", "description": "The object painted: the annotated object, or its parent for scope \"group\"." }
      },
      "additionalProperties": true
    },
    "vector3": {
      "anyOf": [
        {
          "type": "array",
          "minItems": 3,
          "items": { "type": "number" }
        },
        {
          "type": "object",
          "required": ["x", "y", "z"],
          "properties": {
            "x": { "type": "number" },
            "y": { "type": "number" },
            "z": { "type": "number" }
          },
          "additionalProperties": true
        }
      ]
    },
    "panelState": {
      "type": "object",
      "properties": {
        "position": { "$ref": "#/$defs/vector2orObject" },
        "size": {
          "type": "object",
          "properties": {
            "width": { "type": ["number", "null"], "minimum": 0 },
            "height": { "type": ["number", "null"], "minimum": 0 }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    },
    "vector2orObject": {
      "anyOf": [
        {
          "type": "array",
          "minItems": 2,
          "items": { "type": "number" }
        },
        {
          "type": "object",
          "required": ["x", "y"],
          "properties": {
            "x": { "type": "number" },
            "y": { "type": "number" }
          },
          "additionalProperties": true
        }
      ]
    }
  }
}