@photivra/engine 2.5.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +129 -1
  2. package/CITATION.cff +1 -1
  3. package/README.md +6 -6
  4. package/SECURITY.md +1 -1
  5. package/THIRD_PARTY.md +1 -0
  6. package/dist/capture/native-environment-lean.d.ts +1 -1
  7. package/dist/capture/native-environment-lean.js +17 -3
  8. package/dist/capture/native-environment-lean.js.map +1 -1
  9. package/dist/capture/native-environment-raw.d.ts +0 -4
  10. package/dist/capture/native-environment-raw.js +6 -2
  11. package/dist/capture/native-environment-raw.js.map +1 -1
  12. package/dist/color/illuminants.d.ts +15 -0
  13. package/dist/color/illuminants.js +81 -24
  14. package/dist/color/illuminants.js.map +1 -1
  15. package/dist/color/srgb-transfer.d.ts +6 -0
  16. package/dist/color/srgb-transfer.js +9 -0
  17. package/dist/color/srgb-transfer.js.map +1 -1
  18. package/dist/color/white-balance.d.ts +6 -0
  19. package/dist/color/white-balance.js +15 -2
  20. package/dist/color/white-balance.js.map +1 -1
  21. package/dist/core/internal-radiance-evaluator.d.ts +6 -0
  22. package/dist/core/internal-radiance-evaluator.js +33 -0
  23. package/dist/core/internal-radiance-evaluator.js.map +1 -0
  24. package/dist/core/portable-math.d.ts +33 -0
  25. package/dist/core/portable-math.js +342 -0
  26. package/dist/core/portable-math.js.map +1 -1
  27. package/dist/core/version.d.ts +1 -1
  28. package/dist/core/version.js +1 -1
  29. package/dist/core/version.js.map +1 -1
  30. package/dist/facade/chart-radiance-batch.js +3 -2
  31. package/dist/facade/chart-radiance-batch.js.map +1 -1
  32. package/dist/facade/chart-scenes.d.ts +11 -0
  33. package/dist/facade/chart-scenes.js +21 -7
  34. package/dist/facade/chart-scenes.js.map +1 -1
  35. package/dist/facade/diffraction-provider.d.ts +10 -0
  36. package/dist/facade/diffraction-provider.js +38 -17
  37. package/dist/facade/diffraction-provider.js.map +1 -1
  38. package/dist/facade/display-view.d.ts +213 -0
  39. package/dist/facade/display-view.js +1543 -0
  40. package/dist/facade/display-view.js.map +1 -0
  41. package/dist/facade/scene-radiance.d.ts +45 -5
  42. package/dist/facade/scene-radiance.js +97 -28
  43. package/dist/facade/scene-radiance.js.map +1 -1
  44. package/dist/facade/simulate-capture.d.ts +233 -5
  45. package/dist/facade/simulate-capture.js +120 -37
  46. package/dist/facade/simulate-capture.js.map +1 -1
  47. package/dist/facade/simulate-display-view.d.ts +45 -0
  48. package/dist/facade/simulate-display-view.js +214 -0
  49. package/dist/facade/simulate-display-view.js.map +1 -0
  50. package/dist/facade/subject-framing.d.ts +16 -0
  51. package/dist/facade/subject-framing.js +8 -2
  52. package/dist/facade/subject-framing.js.map +1 -1
  53. package/dist/index.d.ts +3 -2
  54. package/dist/index.js +3 -2
  55. package/dist/index.js.map +1 -1
  56. package/dist/optics/diffraction-psf-profile.d.ts +9 -2
  57. package/dist/optics/diffraction-psf-profile.js +33 -4
  58. package/dist/optics/diffraction-psf-profile.js.map +1 -1
  59. package/dist/optics/irradiance-convolution.js +1 -1
  60. package/dist/optics/irradiance-convolution.js.map +1 -1
  61. package/dist/optics/scene-to-sensor-irradiance.d.ts +7 -0
  62. package/dist/optics/scene-to-sensor-irradiance.js +10 -5
  63. package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
  64. package/dist/output/print-plan.d.ts +8 -1
  65. package/dist/output/print-plan.js +8 -1
  66. package/dist/output/print-plan.js.map +1 -1
  67. package/dist/schema/scene-radiance.d.ts +16 -0
  68. package/dist/schema/scene-radiance.js +25 -4
  69. package/dist/schema/scene-radiance.js.map +1 -1
  70. package/dist/sensor/raw-readout.d.ts +12 -0
  71. package/dist/sensor/raw-readout.js +131 -9
  72. package/dist/sensor/raw-readout.js.map +1 -1
  73. package/dist/sensor/stochastic-seed.d.ts +13 -0
  74. package/dist/sensor/stochastic-seed.js +42 -8
  75. package/dist/sensor/stochastic-seed.js.map +1 -1
  76. package/docs/AGENT_GUIDE.md +1 -0
  77. package/docs/API_REFERENCE.md +19 -1
  78. package/docs/QUICK_START.md +203 -4
  79. package/docs/USAGE.md +15 -0
  80. package/docs/api/core-version.md +1 -1
  81. package/docs/api/exports.json +52 -2
  82. package/docs/api/facade-scene-radiance.md +34 -1
  83. package/docs/api/facade-simulate-capture.md +66 -2
  84. package/docs/api/facade-simulate-display-view.md +57 -0
  85. package/docs/api/facade-subject-framing.md +16 -0
  86. package/docs/api/output-print-plan.md +8 -1
  87. package/package.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-capture.js","sourceRoot":"","sources":["../../src/facade/simulate-capture.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAA8D,MAAM,qCAAqC,CAAC;AACtI,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,2CAA2C,EAAE,MAAM,uCAAuC,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,2CAA2C,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACnI,OAAO,EAAE,yBAAyB,EAAE,mCAAmC,EAAE,kCAAkC,EACzG,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAmC,MAAM,6BAA6B,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;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,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;gBAClX,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,4BAA4B,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3J,WAAW,EAAE,CAAC,sKAAsK;gBAClL,uOAAuO,CAAC,EAAE;QAC9O,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * `simulateCapture()` is the easy starting point. It turns a small input into a complete native\n * environment RAW request: scene radiance → optics → spectral EQE (external quantum efficiency) →\n * charge → readout and ADC. That request then runs through the existing native RAW development task\n * and, optionally, the existing JPEG encoder.\n *\n * It adds no physics of its own. Every number comes from existing public contracts: generic tier\n * presets, exposure metering and mode resolution, colorimetry, native environment RAW, native RAW\n * development and print JPEG.\n *\n * Everything the facade decides for the caller is listed in `result.assumptions`: defaults, derived\n * values and fixed modelling choices. Nothing is hidden. The complete underlying request is returned\n * in `result.request`; get the per-site inputs with `request.siteInput(index)`.\n *\n * The 2.0 options are opt-in and only combine existing public contracts. If none is given, the\n * request, RAW, samples and JPEG are byte-identical to the 1.0 facade:\n * - output formats: `png` (`serializePngImage`; sRGB, or Display P3 / Rec. 2020 through the colorimetry\n * matrices and transfer functions) and `dng`\n * (`serializeNativeRawDng` of the packed native RAW; no linear master is declared);\n * - demosaic: `createBuiltInBayerDemosaicProfiles` (bilinear) and mirror borders;\n * - optics: the environment `lensFieldMapping` (projection, radial / Brown–Conrady distortion), radial\n * illumination vignetting as field throughput and a caller sampled lens PSF;\n * - motion: constant camera angular velocity and the electronic rolling-shutter exposure schedule.\n * The 2.1 options are opt-in in the same way: `lens.diffraction`, `output.demosaic: \"ahd\"` and\n * `sensor.antiAliasing` (a birefringent point-splitting low-pass filter in the sensor optical stack).\n * The 2.4 `output.metadata` adds the caller's text to JPEG, PNG and DNG files (see `src/output/text-metadata.ts`);\n * without it every encoded file is byte-identical to 2.3.\n * @see docs/QUICK_START.md\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { requireInputObject } from \"../core/record-validation.js\";\nimport { ENGINE_API_VERSION } from \"../core/version.js\";\nimport type { EvidenceProvenance } from \"../core/evidence-provenance.js\";\nimport { GENERIC_TIER_ASSETS, type GenericEquipmentTier, type GenericEquipmentTierPreset } from \"../equipment/generic-tier-assets.js\";\nimport { parseCallerCameraPreset } from \"./camera-preset.js\";\nimport { createHostYield } from \"./host-yield.js\";\nimport { resolveGenericEquipmentExposureCapabilities } from \"../equipment/exposure-capabilities.js\";\nimport { resolveGenericIsoSignalChain } from \"../sensor/iso-signal-chain.js\";\nimport { meterRelativeExposure } from \"../exposure/metering.js\";\nimport { createExposureMeterTargetFromMeteringResult, setExposureCompensationOnMeterTarget } from \"../exposure/metering-target.js\";\nimport { resolveManualExposureMode, resolveAperturePriorityExposureMode, resolveShutterPriorityExposureMode,\n resolveProgramAutoExposureMode } from \"../exposure/exposure-mode-resolver.js\";\nimport { parseExposureProgramLineProfile, type ExposureProgramLineProfile } from \"../exposure/program-line.js\";\nimport { resolveCaptureGeometry } from \"../output/capture-geometry.js\";\nimport { estimateCie1931ColorMatchingFunctions, type PreparedColorimetricSpectrum } from \"../color/color-matching-functions.js\";\nimport { createColorTemperatureWhiteBalanceIntent, resolveColorTemperatureWhiteBalance, resolveCustomWhiteBalance,\n resolveManualWhiteBalance, estimateAutoWhiteBalance, type ResolvedWhiteBalanceState } from \"../color/white-balance.js\";\nimport { createCaptureWhiteBalanceIntent, type CaptureWhiteBalanceIntent } from \"../capture/simulated-capture.js\";\nimport { SENSOR_RAW_PRODUCER_NOISE_MODEL } from \"../capture/sensor-raw-producer.js\";\nimport { calculateNativeRawPlan, nativeRawMaximumProviderEvaluations, NATIVE_RAW_LIMITS, type NativeRawInput, type NativeRawOutput, type NativeRawPlan } from \"../capture/native-raw.js\";\nimport { createNativeEnvironmentRawTask, createNativeEnvironmentRawRegionTask, type NativeEnvironmentRawInput,\n type NativeEnvironmentRawTask, type NativeEnvironmentRawTile } from \"../capture/native-environment-raw.js\";\nimport { createNativeRawDevelopmentTask, type NativeRawDevelopmentInput, type RawHighlightDiagnostics } from \"../capture/native-raw-development.js\";\nimport type { RawFrameReconstructionPhaseProfile } from \"../capture/raw-frame-reconstruction.js\";\nimport type { ExportSensorColorProfile } from \"../capture/photographic-export.js\";\nimport { parseSdrRenderingProfile, type SdrRenderingProfile, type SdrToneCurve, type SdrToneCurveParameters, type SdrRenderingResult } from \"../output/sdr-rendering.js\";\nimport type { RawHighlightMode } from \"../color/sensor-color-development.js\";\nimport { createPrintJpegTask, PRINT_JPEG_LIMITS } from \"../output/print-jpeg.js\";\nimport type { SimulateEnvironmentSensorRawFrameInput } from \"../capture/environment-raw-producer.js\";\nimport { checkNativeRawIntegrity, prepareNativeRawDevelopment } from \"../capture/native-raw-development.js\";\nimport { createRawPixelDeveloper, normalizedRawSite, rawSiteSaturated, type RawDevelopmentSource } from \"../capture/raw-development-kernel.js\";\nimport { createAhdDemosaicTask } from \"../processing/demosaic.js\";\nimport { PROCESSING_MAX_PIXELS } from \"../processing/processing-task.js\";\nimport { renderSdrRunInto, type SdrPixelCounts } from \"../output/native-capture-sdr.js\";\nimport { prepareSdrPixelTone } from \"../output/sdr-rendering.js\";\nimport { BUILT_IN_BAYER_DEMOSAIC_MODEL_VERSION as BUILT_IN_DEMOSAIC_VERSION, createBuiltInBayerDemosaicProfiles } from \"../sensor/raw-reconstruction.js\";\nimport { transformOrientedRasterPointToNative } from \"../output/capture-geometry.js\";\nimport { resolveCaptureColorModel } from \"../color/capture-color.js\";\nimport { evaluateBt709Oetf, evaluateSrgbEncoding, resolveRgbColorSpace } from \"../color/rgb-color-spaces.js\";\nimport { serializePngImage, PNG_ENCODER_LIMITS, type PngColourEncoding } from \"../output/png-encoder.js\";\nimport { addJpegTextMetadata, addPngTextMetadata, parseOutputTextMetadata, type OutputTextMetadata } from \"../output/text-metadata.js\";\nimport { parseLensProjectionModel, type LensProjectionModel } from \"../camera/lens-projection.js\";\nimport { prepareEnvironmentLensFieldMapping, type EnvironmentLensFieldMapping } from \"../optics/sensor-environment-query.js\";\nimport type { RadialDistortionProfile } from \"../optics/radial-distortion.js\";\nimport type { BrownConradyDistortionProfile } from \"../optics/brown-conrady-distortion.js\";\nimport type { IlluminationVignettingProfile } from \"../optics/illumination-vignetting.js\";\nimport type { CalculateEnvironmentSensorPhotoSignalInput } from \"../sensor/environment-photo-signal.js\";\nimport { createRollingShutterCaptureExposureSchedule, resolveElectronicRollingShutterExposureSchedule,\n type ElectronicRollingShutterExposureSchedule } from \"../sensor/readout-exposure-linkage.js\";\nimport { calculateCaptureExposureWindows } from \"../sensor/exposure-window.js\";\nimport { calculateSensorSpectralQuadrature } from \"../sensor/spectral-quadrature.js\";\nimport { createDiffractionLimitedPsfProfile, type DiffractionLimitedPsfProfile } from \"../optics/diffraction-psf-profile.js\";\nimport { createDiffractedPlanarProvider } from \"./diffraction-provider.js\";\nimport { resolveGenericPrimeLens, type GenericPrimeLens } from \"../equipment/generic-prime-lenses.js\";\nimport { calculateEnvironmentSensorPhotoSignal } from \"../sensor/environment-photo-signal.js\";\nimport { calculateSiteEffectiveSaturationCode } from \"../capture/raw-white-level.js\";\nimport { prepareSensorColorDevelopment } from \"../color/sensor-color-development.js\";\nimport type { SceneRadianceEvaluationRequest } from \"../schema/scene-radiance.js\";\nimport { resolveAntiAliasingSpatialKernel, type AntiAliasingPointSplitComponent, type SensorOpticalStackProfile } from \"../sensor/optical-stack.js\";\nimport { multiplyMatrices, type ColorMatrix3x3, type ColorVector3 } from \"../color/colorimetry-math.js\";\nimport { prepareRgbGamutMapping, type PreparedRgbGamutMapping } from \"../color/gamut-mapping.js\";\nimport { serializeNativeRawDng, type NativeRawDng } from \"../capture/native-raw-dng.js\";\nimport { parseSensorReadoutConversionProfile, resolveSensorReadoutRegime } from \"../sensor/raw-readout.js\";\nimport { resolveChartScene, chartMaterialInputs, CHART_SCENE_PRESETS, type ChartScene, type ResolvedChartScene } from \"./chart-scenes.js\";\nimport { resolveCaptureIlluminant, calculateIlluminantIrradianceScale, buildPlanarSceneRadianceProvider, requireCallerScene, FACADE_SPECTRAL_RANGE_NANOMETERS,\n resolveChartSizeOption, type ChartSizeOption,\n PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W, type CaptureIlluminant, type CallerRadianceScene, type CallerReflectanceScene,\n type PlanarSceneRadianceProvider, type ResolvedCaptureIlluminant } from \"./scene-radiance.js\";\n\n/** Version of how the facade builds requests. It changes whenever the same input would build a different request. */\nexport const SIMULATE_CAPTURE_FACADE_VERSION = \"1.0.0\" as const;\n\nexport type SimulateCaptureExposureMode = \"manual\" | \"aperture-priority\" | \"shutter-priority\" | \"program\";\nexport type SimulateCaptureOutputFormat = \"srgb-8\" | \"srgb-16\" | \"jpeg\" | \"png\" | \"dng\";\nexport type SimulateCaptureWhiteBalance =\n | \"scene-illuminant\"\n | \"auto\"\n | \"none\"\n | { kelvin: number; tint?: number }\n | { channelGains: { red: number; green: number; blue: number } };\n/**\n * PNG colour encoding. `srgb` is the developed sRGB output. The others take the developed linear\n * colour (camera → XYZ → linear sRGB/D65, unclipped) and convert it through CIE XYZ into the target\n * primaries:\n * - `display-p3`: Display P3 primaries (W3C CSS Color 4 `display-p3`; also SMPTE EG 432-1) with the\n * sRGB transfer function;\n * - `rec2020`: ITU-R BT.2020 primaries and OETF.\n * PQ and HLG (BT.2100) are not part of 2.0; see THIRD_PARTY.md.\n */\nexport type SimulateCaptureColorEncoding = \"srgb\" | \"display-p3\" | \"rec2020\";\n/**\n * Demosaic. `bilinear`: the built-in Bayer kernels (`createBuiltInBayerDemosaicProfiles`). `ahd` (2.1): adaptive\n * homogeneity-directed demosaicing (`createAhdDemosaicTask`, after Hirakawa & Parks 2005), a non-linear\n * edge-directed method that reduces zipper and false colour on sharp edges.\n */\nexport type SimulateCaptureDemosaic = \"bilinear\" | \"ahd\";\n/**\n * `margin` renders extra native sites around the output, as far as the kernel reaches. `mirror` renders\n * exactly the output and reads mirrored (reflect-101) copies of the missing border sites. Mirroring is\n * checked to keep the CFA (colour filter array) pattern consistent.\n */\nexport type SimulateCaptureBorderHandling = \"margin\" | \"mirror\";\nexport type SimulateCaptureLensDistortion =\n | { kind: \"radial\"; profile: RadialDistortionProfile }\n | { kind: \"brown-conrady\"; profile: BrownConradyDistortionProfile };\n/** Diffraction model (2.1): the shorthand or a record with an explicit kernel radius in sites. */\nexport type SimulateCaptureLensDiffraction = \"circular-aperture\" | { aperture: \"circular-aperture\"; kernelRadiusSamples?: number };\n/**\n * Optical anti-aliasing (low-pass) filter (2.1), modelled as birefringent point splitting: each image point is\n * split into equally bright copies (the engine's `normalized-point-splitting-kernel` optical-stack response).\n * - `four-spot`: two crossed birefringent plates; copies at (±d/2, ±d/2), weight 1/4 each, MTF |cos(π·f_x·d)·cos(π·f_y·d)|.\n * - `two-spot`: one plate splitting along `axis`; copies at ±d/2, weight 1/2 each, MTF |cos(π·f·d)|.\n * - `point-splitting`: the engine contract itself, offsets in micrometres (+x right, +y down) and positive weights\n * summing to 1 (at most 16 components, each within 4 sites).\n * d = `separationSites` × pixel pitch, 0 < separationSites ≤ 4, default 1 (first MTF zero at the sensor's Nyquist\n * frequency 1/(2·pitch)).\n */\nexport type SimulateCaptureSensorAntiAliasing =\n | { kind: \"four-spot\"; separationSites?: number }\n | { kind: \"two-spot\"; axis: \"horizontal\" | \"vertical\"; separationSites?: number }\n | { kind: \"point-splitting\"; components: readonly AntiAliasingPointSplitComponent[] };\n/** Pixel aperture (2.3): centre sampling, or the square photosite integrated with an N × N midpoint rule. */\nexport type SimulateCapturePixelAperture = \"point\" | \"box\" | { kind: \"box\"; samplesPerAxis?: number };\n/** Default midpoint samples per axis of `sensor.pixelAperture: \"box\"`. */\nexport const SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES = 4;\nexport interface SimulateCaptureMotion {\n /** Constant camera angular velocity, rad/s, in the engine's pitch/yaw/roll convention. Missing axes are 0. */\n angularVelocityRadPerSec?: { pitch?: number; yaw?: number; roll?: number };\n /** Default \"global\". `rolling` derives the exposure schedule from the body's rolling readout declaration. */\n shutter?: \"global\" | \"rolling\";\n /** Rolling shutter only: time from the first to the last line over the simulated frame, in s. Default: the body's declared readout skew. */\n rollingShutterSkewSeconds?: number;\n}\n\nexport interface SimulateCaptureOptions {\n /** Generic tier preset id or a full preset record (for example a modified copy of a catalog entry). Default \"professional\". */\n camera?: GenericEquipmentTier | GenericEquipmentTierPreset;\n lens?: {\n /** Must lie in the lens capability (the generic primes are 50 mm). Default: the lens's shortest focal length. */\n focalLengthMm?: number;\n /**\n * Opt-in (2.3): a lens of the generic prime family by its full-frame-equivalent focal length\n * (`GENERIC_PRIME_EQUIVALENT_FOCAL_LENGTHS_MM`). Its physical focal length is the equivalent ÷ the diagonal crop\n * factor of the simulated frame (output width × height × pixel pitch); it replaces the tier lens's focal length and\n * f-number range (the tier lens's transmission is kept). An f-number outside the prime's range, or a subject or\n * focus distance below its minimum focus distance, is rejected. Not combinable with `focalLengthMm`.\n */\n prime?: number;\n /** Aperture for manual and aperture-priority modes. Default 8. */\n fNumber?: number;\n /** Focus distance in metres. Default: the subject distance. */\n focusDistanceM?: number;\n /** Opt-in ideal circular-pupil ray sampling (defocus/depth of field). Default off (central ray only). */\n pupilSampling?: { radialSamples: number; angularSamples: number };\n /** Ideal lens projection (`LENS_PROJECTION_MODELS`). Default \"rectilinear\". Not combinable with pupilSampling. */\n projection?: LensProjectionModel;\n /** Caller-declared radial or Brown–Conrady distortion profile. Default none. Not combinable with pupilSampling. */\n distortion?: SimulateCaptureLensDistortion;\n /** Caller-declared radial relative-illumination (vignetting) profile, applied as environment field throughput. */\n vignetting?: IlluminationVignettingProfile;\n /**\n * Caller sampled lens PSF, passed unchanged to the environment contract. Its focal length, f-number and\n * focus must equal the resolved capture settings exactly. Not combinable with pupilSampling.\n */\n psf?: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n /**\n * Opt-in (2.1) diffraction blur of an ideal, aberration-free, in-focus lens with a circular pupil at the\n * capture's resolved f-number: the engine builds the Airy kernels (`createDiffractionLimitedPsfProfile`)\n * on the site pitch. `kernelRadiusSamples` (0–32) sets the kernel window; default: the third dark ring at\n * the longest spectral node, capped at 32 sites. Not combinable with `psf` or `pupilSampling`. Default off.\n */\n diffraction?: SimulateCaptureLensDiffraction;\n };\n exposure?: {\n /** Default \"manual\". */\n mode?: SimulateCaptureExposureMode;\n /** Default 100. */\n iso?: number;\n /** Shutter for manual and shutter-priority modes. Default 1/125 s. */\n shutterSeconds?: number;\n /** Exposure compensation applied to the meter target, in stops. Default 0. */\n compensationStops?: number;\n };\n /** Required: an engine chart (for example `{ preset: \"uniform\" }`, an 18 % grey card) or a caller reflectance/radiance function. */\n scene: ChartScene | CallerReflectanceScene | CallerRadianceScene;\n /** Distance from the camera to the scene plane in metres. Default 5. */\n subjectDistanceM?: number;\n /**\n * Opt-in (2.3) fixed-size chart: place the scene at this physical size on the plane at the subject distance,\n * centred on the optical axis, instead of sizing it to fill the frame. Outside it the plane is a neutral surround\n * (default 18 %). Chart presets are resolved in the chart's own frame (aspect heightM / widthM); caller functions\n * are called only on the chart and receive chart-local `chartU`, `chartV`. `result.scene.chart` reports the\n * framed width, the fraction of the frame the chart covers and the thin-lens magnification.\n */\n chartSize?: ChartSizeOption;\n /** Default: Planckian 6500 K (a blackbody stand-in for daylight; CIE D65 is not bundled). */\n illuminant?: CaptureIlluminant;\n /** Illuminance on the scene plane, lux. Default about 21 481 lux (see `SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX` and the assumptions). */\n illuminanceLux?: number;\n output?: {\n /** Output pixels; the native sensor raster adds a one-site demosaic border on each side. Defaults 64 × 64. */\n width?: number;\n height?: number;\n /** Default \"srgb-8\". */\n format?: SimulateCaptureOutputFormat;\n /** Default \"identity\". */\n toneCurve?: SdrToneCurve;\n /** Required by the luminance tone curves (see `SdrToneCurveParameters`). The facade does not make one up. */\n toneCurveParameters?: SdrToneCurveParameters;\n /** Default \"clip\". */\n highlightMode?: RawHighlightMode;\n /** Default \"scene-illuminant\". */\n whiteBalance?: SimulateCaptureWhiteBalance;\n /** JPEG constant quantization step 1-255 (not a manufacturer 'quality'). Default 2. */\n jpegQuantizationStep?: number;\n /** PNG only. Default \"srgb\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** PNG only: 8 or 16 bits per sample. Default 8. */\n bitDepth?: 8 | 16;\n /**\n * PNG SDR encodings only. Default \"clip\" (per-component clip to the target gamut). \"perceptual\" maps\n * through `prepareRgbGamutMapping`: constant CIELAB L* and hue, chroma above 90 % of the boundary compressed.\n */\n gamutMapping?: \"clip\" | \"perceptual\";\n /** Default: the 1.0 facade's bilinear RGGB kernels. */\n demosaic?: SimulateCaptureDemosaic;\n /** Default \"margin\". */\n borderHandling?: SimulateCaptureBorderHandling;\n /** DNG only: optional capture-event time (YYYY-MM-DDTHH:mm:ss.sssZ); without it no date tags are written. */\n dng?: { capturedAtUtc?: string };\n /**\n * Opt-in (2.4) text written into the file for formats \"jpeg\", \"png\" and \"dng\": the caller's description,\n * software, copyright and comment, unchanged (JPEG XMP + COM, PNG tEXt/iTXt, DNG TIFF tags + XMP; see the\n * quick start). Each field is 1–2048 UTF-8 bytes with no control characters except line feed. Default: none.\n */\n metadata?: OutputTextMetadata;\n /**\n * Opt-in large images: the most native sensor sites (the output plus the demosaic margin on each side) the\n * capture may allocate, an integer up to `NATIVE_RAW_LIMITS.ceilingPixels` (2^27). With it, `width` and\n * `height` may each reach 16 384 sites including the margin; without it they stay at most 4094. Time and\n * memory grow with the pixel count (see \"Large images\" in the quick start); browsers may fail at large sizes.\n */\n maximumPixels?: number;\n /**\n * Opt-in (2.3) region rendering: render only this rectangle, in output-pixel coordinates of the whole frame\n * `width` × `height` (x right, y down from its top-left). The pixels are byte-identical to the same pixels of\n * the whole render: framing, metering, exposure, noise seeds (absolute native site indices), rolling-shutter row\n * timing, diffraction and demosaic all use the whole frame. Use it to tile a large frame across workers or to\n * render a 100 % crop. `result.image` is the region; `result.region` reports it. Not combinable with\n * `whiteBalance: \"auto\"`, whose statistics would come from the region only.\n */\n region?: { x: number; y: number; width: number; height: number };\n };\n /** Camera motion and shutter type. Default: still camera, global electronic shutter. */\n motion?: SimulateCaptureMotion;\n sensor?: {\n /**\n * Pixel pitch in micrometres, 0.5–1000. Default 6. The simulated sensor is output width × pitch wide. 2.5: above 100 µm the\n * capture is a downsized view of a whole frame (for example 36 mm / 48 pixels = 750 µm), recorded in the assumption\n * `sensor.wholeFrameView`: brightness is unchanged and the noise is that of a binned view, not of the real sensor's pixels.\n */\n pixelPitchMicrometers?: number;\n /** Maximum spectral quadrature subinterval in nm. Default 20. */\n spectralStepNanometers?: number;\n /** Temporal midpoint samples across the exposure. Default 1. */\n temporalSampleCount?: number;\n /** Noise seed (uint32). Default 1. */\n noiseSeed?: number;\n /**\n * Opt-in (2.1) optical anti-aliasing filter (birefringent point splitting, `SimulateCaptureSensorAntiAliasing`).\n * Multiplies the scene queries by the number of split points. Default off (the tiers declare no filter).\n */\n antiAliasing?: SimulateCaptureSensorAntiAliasing;\n /**\n * Opt-in (2.3) pixel aperture. `\"point\"` (default): each site samples the irradiance at its centre.\n * `\"box\"`: each site integrates the irradiance over its whole square photosite (fill factor 1) with an\n * N × N midpoint rule, N = `samplesPerAxis` (1–16, default 4), so detail finer than a pixel averages out as\n * on a real sensor (pixel MTF |sinc(f·p)|) instead of aliasing. Multiplies the scene queries by N².\n */\n pixelAperture?: SimulateCapturePixelAperture;\n };\n /** Aborting cancels the running task; the promise rejects with a domain error and returns no partial image. */\n signal?: AbortSignal;\n /** Called after each committed RAW, development or JPEG tile. Cannot change output. */\n onProgress?: (progress: SimulateCaptureProgress) => void;\n}\n\n/**\n * Options reported in `diagnostics.options` (2.1), in this order, when they ran: the ones that change how much work\n * a capture does. `motion.rotation` is a non-zero angular velocity; `sensor.temporalSampleCount` a count above 1.\n */\nexport const SIMULATE_CAPTURE_COST_OPTIONS = Object.freeze([\"lens.pupilSampling\", \"lens.projection\", \"lens.distortion\", \"lens.vignetting\", \"lens.psf\",\n \"lens.diffraction\", \"sensor.antiAliasing\", \"sensor.pixelAperture.box\", \"sensor.temporalSampleCount\", \"motion.rotation\", \"motion.shutter.rolling\", \"output.borderHandling.mirror\", \"output.region\",\n \"output.whiteBalance.auto\", \"output.demosaic.ahd\", \"output.highlightMode.reconstruct\", \"output.colorEncoding.wide-gamut\", \"output.gamutMapping.perceptual\",\n \"output.format.jpeg\", \"output.format.png\", \"output.format.dng\"] as const);\nexport type SimulateCaptureCostOption = typeof SIMULATE_CAPTURE_COST_OPTIONS[number];\n\nexport interface SimulateCaptureProgress {\n stage: \"raw\" | \"white-balance\" | \"development\" | \"jpeg\";\n completedTileCount: number;\n totalTileCount: number;\n}\n\n/** One decision the facade made: a default, a derived value or a fixed modelling choice. */\nexport interface SimulateCaptureAssumption {\n /** Dotted option path or modelling topic, for example \"exposure.shutterSeconds\" or \"model.lens-psf\". */\n id: string;\n kind: \"default\" | \"derived\" | \"model\";\n value: unknown;\n explanation: string;\n}\n\nexport interface SimulateCaptureResult {\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: {\n width: number;\n height: number;\n format: SimulateCaptureOutputFormat;\n /** Interleaved RGB, row by row from the top-left. sRGB-encoded (W3C CSS Color 4 sRGB; also IEC 61966-2-1) unless `colorEncoding` says otherwise. */\n samples: Uint8Array | Uint16Array;\n /** Baseline JPEG bytes when format is \"jpeg\". */\n jpeg?: Uint8Array;\n /** PNG file bytes when format is \"png\". */\n png?: Uint8Array;\n /** Encoding of `samples` and `png` when format is \"png\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** Lossless uncompressed CFA DNG of the packed RAW when format is \"dng\" (`serializeNativeRawDng`); `samples` are then sRGB 8-bit. */\n dng?: Uint8Array;\n };\n /**\n * Packed native RAW (codes, black levels, saturation flags) as produced by the native environment RAW task. With\n * `output.region` (2.3): the region's native sites only, with `plan` describing that raster (its active area is the\n * region); `request.environmentRaw` and `request.siteInput` stay those of the whole frame.\n */\n raw: NativeRawOutput;\n plan: NativeRawPlan;\n /**\n * 2.3, present with `output.region`: the rendered rectangle in output pixels of the whole `frameWidth` × `frameHeight`\n * frame, and the native sites rendered for it (`nativeRect`, in the whole frame's native raster: the region, the\n * demosaic reach on each side clipped to the raster, and its origin rounded down to the 2 × 2 CFA repeat).\n */\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number; nativeRect: { x: number; y: number; width: number; height: number } };\n /** The complete underlying request. */\n request: {\n environmentRaw: NativeEnvironmentRawInput;\n /** Rebuilds the exact physical site input the provider supplied for a native row-major index. */\n siteInput(nativeIndex: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n development: Omit<NativeRawDevelopmentInput, \"raw\">;\n whiteBalanceState: ResolvedWhiteBalanceState | null;\n /**\n * Present with lens.diffraction (2.1): the engine-built Airy profile, the equivalent environment sampled PSF\n * selection, and how it was applied. With `object-space-convolution` the site inputs declare no PSF and the\n * provider answers with the PSF-convolved radiance; putting `psf` into each site input and using the plain\n * scene provider gives the same expected signal (to float rounding) through the per-tap environment quadrature.\n */\n diffraction?: { profile: DiffractionLimitedPsfProfile; psf: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n execution: \"object-space-convolution\" | \"environment-psf-quadrature\" };\n };\n exposure: {\n mode: SimulateCaptureExposureMode;\n settings: { fNumber: number; shutterSeconds: number; iso: number };\n /** Exposure value at ISO 100 of the settings, log2(N²/t). */\n ev100: number;\n meteredSceneLuminanceCdPerSquareMeter: number;\n /** Full output of the existing exposure-mode resolver. */\n resolution: unknown;\n };\n scene: {\n sceneId: string;\n preset: string;\n parameters: Readonly<Record<string, unknown>>;\n illuminant: { id: string; description: string; illuminanceLux: number };\n distanceM: number;\n /** Physical size of the framed scene plane, metres. */\n framedWidthM: number;\n framedHeightM: number;\n /**\n * 2.3, present with `chartSize`: the chart's physical size and surround, the fraction of the frame width and\n * height it covers (above 1 when it is larger than the frame and cropped), the thin-lens magnification\n * v/d (image distance over subject distance, the scale the facade's framing uses) and the chart's size on the\n * sensor in millimetres and output pixels.\n */\n chart?: { widthM: number; heightM: number; surroundReflectance: number; frameWidthFraction: number; frameHeightFraction: number;\n magnification: number; imageWidthMm: number; imageHeightMm: number; imageWidthPixels: number; imageHeightPixels: number };\n /**\n * SHA-256 of the canonical scene description, recorded as the capture source digest. Caller spectra (a\n * `spectrum` or `daylight` illuminant, chart reflectance spectra) are part of the description: tabulated\n * data exactly, function spectra sampled at 1 nm over 380-780 nm, plus the daylight basis datasetId.\n * The body of a caller scene's evaluate function is not hashed.\n */\n sourceSha256: string;\n };\n diagnostics: {\n providerEvaluationCount: number;\n highlight: RawHighlightDiagnostics;\n rendering: SdrRenderingResult[\"diagnostics\"];\n /** Present with output.gamutMapping \"perceptual\": pixels whose chroma or lightness the mapping changed. */\n gamutMapping?: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number };\n /**\n * Wall-clock milliseconds per stage. `raw`, `whiteBalance` (the second RAW pass of auto white balance), `development`\n * (includes DNG writing), `jpeg` and `total` are whole milliseconds (`Date.now()`). Since 2.1, where a stage ran:\n * `diffraction` (the object-space convolution of `lens.diffraction`; part of `raw` and `whiteBalance`), `demosaic`\n * (the AHD demosaic; part of `development`) and `encode` (PNG, JPEG or DNG serialization), with sub-millisecond\n * resolution where the host has `performance.now()`. Timings vary from run to run and never enter any digest or output byte.\n */\n timingsMs: { raw: number; whiteBalance: number; development: number; jpeg: number; total: number; diffraction?: number; demosaic?: number; encode?: number };\n /**\n * 2.1: the opt-in options that changed the work of this run, in a fixed order (see `SIMULATE_CAPTURE_COST_OPTIONS`).\n * Empty for a capture with every default. With `timingsMs` it lets an application measure each option's cost on\n * the user's device.\n */\n options: readonly SimulateCaptureCostOption[];\n };\n provenance: {\n scientificStatus: \"approximation\";\n cameraPresetId: string;\n cameraPresetVersion: string;\n evidence: readonly EvidenceProvenance[];\n /** Existing engine contracts the facade composed, in execution order. */\n composedContracts: readonly string[];\n limitations: readonly string[];\n };\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\nconst FACADE_EVIDENCE: readonly EvidenceProvenance[] = Object.freeze([Object.freeze({ sourceOrigin: \"photivra\" as const,\n sourceReference: \"photivra:simulate-capture-facade\", reuseStatus: \"photivra-owned\" as const })]);\nconst DEFAULTS = Object.freeze({ camera: \"professional\" as const, fNumber: 8, shutterSeconds: 1 / 125, iso: 100, compensationStops: 0,\n subjectDistanceM: 5, width: 64, height: 64, format: \"srgb-8\" as const, toneCurve: \"identity\" as const, highlightMode: \"clip\" as const,\n whiteBalance: \"scene-illuminant\" as const, jpegQuantizationStep: 2, pixelPitchMicrometers: 6, spectralStepNanometers: 20,\n temporalSampleCount: 1, noiseSeed: 1, illuminantKelvin: 6500 });\n/** Standard output sensitivity S = 10 / H (CIPA DC-004-2020 §3.2): the reference exposure in lx·s is 10 / S. */\nconst SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS = 10;\n/** Camera equation H = 0.65·L·t/N² (CIPA DC-004-2020 §5.5 (4); 0.65 = τ·π/4 with τ = 0.828, Explanation 4). */\nconst CAMERA_EQUATION_CONSTANT = 0.65;\n/** Neutral reference reflectance: DC-004 ties the SOS reference level to an 18 % grey (Explanation 1 and 2.2). */\nconst GREY_CARD_REFLECTANCE = 0.18;\n/** Scene luminance (cd/m²) whose focal-plane exposure 0.65·L·t/N² equals the SOS reference exposure 10/S. */\nfunction sosReferenceLuminance(fNumber: number, shutterSeconds: number, iso: number): number {\n return SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS * fNumber ** 2 / (CAMERA_EQUATION_CONSTANT * shutterSeconds * iso);\n}\n/**\n * Default illuminance, lux: an 18 % Lambertian grey card (L = 0.18·E/π) then gets exactly the CIPA DC-004 standard\n * output sensitivity reference exposure H = 10/S at f/8, 1/125 s, ISO 100:\n * E = π·10·N²/(0.65·t·S·0.18) = π·80 000/11.7 ≈ 21 480.98 lux.\n */\nexport const SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX = Math.PI * sosReferenceLuminance(DEFAULTS.fNumber, DEFAULTS.shutterSeconds, DEFAULTS.iso) /\n GREY_CARD_REFLECTANCE;\n/**\n * Sensitive-aperture area (µm²) at which the tier's ISO signal chain applies unchanged: the default 6 µm square\n * aperture with fill factor 1. At other areas the facade scales the electron-domain readout values by\n * area / this reference, so the same focal-plane exposure H gives the same output code (see `isoAreaScaledReadout`).\n */\n/** 2.5: the largest accepted pixel pitch, µm (44 mm ÷ 48 pixels ≈ 917 µm, a whole full-frame or larger sensor at a small output). */\nconst SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS = 1000;\n/** Pitches above this, µm, are larger than any camera photosite: the capture is a downsized whole-frame view (assumption sensor.wholeFrameView). */\nconst SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS = 100;\nconst ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS = DEFAULTS.pixelPitchMicrometers * DEFAULTS.pixelPitchMicrometers;\n/** Demosaic border, native sites per side. */\nconst MARGIN = 1;\n/**\n * AHD border, native sites per side: an AHD output pixel depends on sites up to 5 away (directional green ±2,\n * colour differences ±1 of it, the homogeneity's 4-neighbours and its 3 × 3 sum), so a 5-site rendered margin keeps\n * every output pixel off the plane's mirrored edge.\n */\nconst AHD_MARGIN = 5;\n/** Sites whose values enter an AHD output pixel (interpolation reach), for the saturated-pixel count. */\nconst AHD_VALUE_REACH = 3;\n\n/** Anti-aliasing filter limits: split points, and the largest offset in sites (bounds the scene work and the convolution margin). */\nconst AA_MAXIMUM_COMPONENTS = 16;\nconst AA_MAXIMUM_OFFSET_SITES = 4;\n/** Default birefringent separation in sites: the two-spot MTF |cos(π·f·d)| then has its first zero at Nyquist, f = 1/(2·pitch). */\nconst AA_DEFAULT_SEPARATION_SITES = 1;\ninterface ParsedAntiAliasing { kind: SimulateCaptureSensorAntiAliasing[\"kind\"]; separationSites?: number; axis?: \"horizontal\" | \"vertical\";\n components: AntiAliasingPointSplitComponent[] }\n/** Parses `sensor.antiAliasing` into engine point-splitting components (offsets in µm, +x right, +y down). */\nfunction parseAntiAliasing(value: unknown, pitch: number): ParsedAntiAliasing {\n requireInputObject(value, \"sensor.antiAliasing\");\n const kind = (value as { kind?: unknown }).kind;\n const separation = (record: Record<string, unknown>): number => {\n if (record.separationSites === undefined) return AA_DEFAULT_SEPARATION_SITES;\n const d = positive(record.separationSites, \"sensor.antiAliasing.separationSites\");\n if (d > AA_MAXIMUM_OFFSET_SITES) fail(\"sensor.antiAliasing.separationSites must be greater than 0 and at most \" + AA_MAXIMUM_OFFSET_SITES + \".\");\n return d;\n };\n if (kind === \"four-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"separationSites\"]), d = separation(record), h = d * pitch / 2;\n return { kind, separationSites: d, components: [[-h, -h], [h, -h], [-h, h], [h, h]].map(([x, y]) => ({ offsetMicrometers: { x: x!, y: y! }, normalizedWeight: 0.25 })) };\n }\n if (kind === \"two-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"axis\", \"separationSites\"]), d = separation(record), h = d * pitch / 2;\n if (record.axis !== \"horizontal\" && record.axis !== \"vertical\") fail(\"sensor.antiAliasing.axis must be horizontal or vertical.\");\n const axis = record.axis as \"horizontal\" | \"vertical\";\n return { kind, axis, separationSites: d, components: [-h, h].map((o) => ({ offsetMicrometers: axis === \"horizontal\" ? { x: o, y: 0 } : { x: 0, y: o }, normalizedWeight: 0.5 })) };\n }\n if (kind === \"point-splitting\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"components\"]);\n if (!Array.isArray(record.components) || record.components.length === 0 || record.components.length > AA_MAXIMUM_COMPONENTS) {\n fail(\"sensor.antiAliasing.components must be an array of 1 to \" + AA_MAXIMUM_COMPONENTS + \" components.\");\n }\n // The engine's optical-stack parser checks shape, finiteness, positive weights and the unit sum (1e-12).\n const kernel = resolveAntiAliasingSpatialKernel({ schemaVersion: \"0.1.0\", profileId: \"facade-aa-check\", evidence: FACADE_EVIDENCE,\n effectiveAntiAliasingSpatialResponse: { kind: \"normalized-point-splitting-kernel\", evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-physical\",\n scope: \"field-wavelength-polarization-invariant-approximation\", components: record.components as AntiAliasingPointSplitComponent[] } });\n for (const c of kernel.components) if (Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)) > AA_MAXIMUM_OFFSET_SITES * pitch) {\n fail(\"sensor.antiAliasing.components offsets must lie within \" + AA_MAXIMUM_OFFSET_SITES + \" sites (\" + AA_MAXIMUM_OFFSET_SITES * pitch + \" µm) of the site centre.\");\n }\n return { kind, components: kernel.components.map((c) => ({ offsetMicrometers: { ...c.offsetMicrometers }, normalizedWeight: c.normalizedWeight })) };\n }\n return fail(\"sensor.antiAliasing.kind must be four-spot, two-spot or point-splitting.\");\n}\n\n/** Midpoint nodes of an N × N rule over a square photosite, as offsets from its centre in sites (+x right, +y down). */\nfunction apertureNodeOffsets(n: number): { x: number; y: number }[] {\n const out: { x: number; y: number }[] = [];\n for (let j = 0; j < n; j++) for (let i = 0; i < n; i++) out.push({ x: (i + 0.5) / n - 0.5, y: (j + 0.5) / n - 0.5 });\n return out;\n}\n/** Third dark ring of the Airy pattern in units of λ·N_w (j₁,₃/π, j₁,₃ = 10.1734681351): the default diffraction kernel reach. */\nconst AIRY_THIRD_ZERO_PER_LAMBDA_N = 10.173468135062722 / Math.PI;\n/** Default temporal midpoints when the camera rotates (2.0 motion option). */\nconst ROTATING_TEMPORAL_SAMPLE_COUNT = 8;\nconst IDS = Object.freeze({ frame: \"facade-frame\", mode: \"native-still\", cfa: \"photivra-generic-bayer\", binding: \"facade-native-cfa\",\n sceneState: \"facade-scene-state\", scene: \"facade-scene\", provider: \"facade-provider\", lights: \"facade-lights\", materials: \"facade-materials\",\n capture: \"facade-capture\", spectral: \"facade-colorimetric-eqe\", sampling: \"facade-sampling\", stack: \"facade-no-aa\", stackAa: \"facade-aa\",\n stationarity: \"facade-stationarity\", operatingState: \"facade-operating-state\", dark: \"facade-dark\", completeness: \"facade-completeness\",\n chargeSampling: \"facade-charge-sampling\", capacity: \"facade-capacity\" });\nconst CHANNELS = [\"red\", \"green\", \"blue\"] as const;\ntype Channel = typeof CHANNELS[number];\n/**\n * Synthetic colorimetric sensor: channel EQE(λ) = a·cmf(λ)·(555 nm/λ), with cmf = x̄, ȳ, z̄. The λ factor turns\n * the energy-weighted CMF (colour-matching function) into a photon-counting response. So channel counts are\n * proportional to CIE XYZ (the Luther–Ives condition holds, up to quadrature error), and the camera→XYZ\n * matrix is diagonal.\n */\nconst EQE_SCALE: Readonly<Record<Channel, number>> = Object.freeze({ red: 0.5, green: 0.5, blue: 0.25 });\nconst CMF_KEY: Readonly<Record<Channel, \"x\" | \"y\" | \"z\">> = Object.freeze({ red: \"x\", green: \"y\", blue: \"z\" });\nconst CAMERA_TO_XYZ: readonly (readonly number[])[] = Object.freeze([[EQE_SCALE.green / EQE_SCALE.red, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.green / EQE_SCALE.blue]].map((r) => Object.freeze(r)));\nconst XYZ_TO_CAMERA = [[EQE_SCALE.red / EQE_SCALE.green, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.blue / EQE_SCALE.green]] as const;\n/** Synthetic dark current per site at the operating temperature, e⁻/s. */\nconst DARK_CURRENT_ELECTRONS_PER_SECOND = 1;\nconst OPERATING_TEMPERATURE_C = 20;\n\nfunction fail(message: string): never { throw new InvalidConfigurationError(message); }\n/** Where `output.metadata` goes in each file format (reported in the `output.metadata` assumption). */\nconst TEXT_METADATA_LAYOUT = Object.freeze({\n jpeg: \"XMP packet in APP1 (dc:description, xmp:CreatorTool, dc:rights, exif:UserComment), plus a COM segment holding the comment\",\n png: \"One tEXt (printable Latin-1) or iTXt (UTF-8) chunk per field, keywords Description, Software, Copyright, Comment, before the first IDAT\",\n dng: \"ImageDescription (statement, then the description) and Copyright when printable ASCII; an XMP packet in tag 700 with every field\"\n});\ntype ReadoutProfile = GenericEquipmentTierPreset[\"body\"][\"readout\"][number][\"profile\"];\n/**\n * The readout profile with every regime's charge-domain transfer scaled by `areaScale`: system conversion gain\n * (e⁻ per code) and pre-ADC saturation (e⁻ equivalent) are multiplied by it, so codes per unit focal-plane exposure\n * stay those of the reference aperture. Read noise stays in electrons per pixel; codes, black level, ADC and digital\n * gain are unchanged. The result is re-checked by the readout parser.\n */\nfunction isoAreaScaledReadout(profile: ReadoutProfile, areaScale: number): ReadoutProfile {\n return parseSensorReadoutConversionProfile({ ...profile, regimes: profile.regimes.map((regime) => ({ ...regime,\n systemConversionGainElectronsPerCode: { ...regime.systemConversionGainElectronsPerCode, value: regime.systemConversionGainElectronsPerCode.value * areaScale },\n preAdcSaturationElectronEquivalent: { ...regime.preAdcSaturationElectronEquivalent, value: regime.preAdcSaturationElectronEquivalent.value * areaScale } })) });\n}\n/** Diagnostic clock for the 2.1 stage timings: `performance.now()` where the host has it. Never affects output. */\nfunction clockMs(): number { return globalThis.performance?.now() ?? Date.now(); }\nfunction positive(value: unknown, name: string): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) fail(name + \" must be a positive finite number.\");\n return value as number;\n}\nfunction integerIn(value: unknown, name: string, minimum: number, maximum: number): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < minimum || value > maximum) fail(name + \" must be an integer from \" + minimum + \" to \" + maximum + \".\");\n return value as number;\n}\nfunction allowKeys(value: unknown, name: string, keys: readonly string[]): Record<string, unknown> {\n if (value === undefined) return {};\n requireInputObject(value, name);\n for (const key of Object.keys(value as object)) if (!keys.includes(key)) fail(\"Unknown \" + name + \" field: \" + key + \".\");\n return value as Record<string, unknown>;\n}\nfunction sampled(values: readonly { nm: number; value: number }[]): { wavelengthUnit: \"nm\"; wavelengthBasis: \"vacuum\"; interpolation: \"piecewise-linear\";\n outsideRangeBehavior: \"fail-closed\"; evidence: readonly EvidenceProvenance[]; samples: { wavelengthNanometers: number; value: number }[] } {\n return { wavelengthUnit: \"nm\", wavelengthBasis: \"vacuum\", interpolation: \"piecewise-linear\", outsideRangeBehavior: \"fail-closed\", evidence: FACADE_EVIDENCE,\n samples: values.map((s) => ({ wavelengthNanometers: s.nm, value: s.value })) };\n}\nasync function sha256Hex(text: string): Promise<string> {\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) fail(\"simulateCapture needs crypto.subtle (a secure browser context or Node 22+) to digest the scene description.\");\n const bytes = new Uint8Array(await subtle.digest(\"SHA-256\", new TextEncoder().encode(text)));\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * The form in which a caller spectrum enters the scene digest. Tabulated data is hashed exactly as its\n * (wavelength, value) pairs. A function spectrum has no data to hash, so it is sampled at the facade's\n * 1 nm integer nodes over 380-780 nm (the grid the facade also uses to normalize illuminance).\n */\nfunction spectrumDigestForm(raw: unknown, prepared: PreparedColorimetricSpectrum): unknown {\n const record = raw as { kind?: unknown; samples?: readonly { wavelengthNanometers: number; value: number }[] };\n if (record.kind === \"tabulated\" && Array.isArray(record.samples)) {\n return { kind: \"tabulated\", samples: record.samples.map((sample) => [sample.wavelengthNanometers, sample.value]) };\n }\n const values: number[] = [];\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) values.push(prepared.evaluate(nm));\n return { kind: \"function-sampled-1nm\", rangeNanometers: [FACADE_SPECTRAL_RANGE_NANOMETERS.minimum, FACADE_SPECTRAL_RANGE_NANOMETERS.maximum], values };\n}\nfunction luminanceOf(radiance: (nm: number) => number): number {\n let sum = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm += 5) {\n const w = nm === FACADE_SPECTRAL_RANGE_NANOMETERS.minimum || nm === FACADE_SPECTRAL_RANGE_NANOMETERS.maximum ? 2.5 : 5;\n sum += w * radiance(nm) * estimateCie1931ColorMatchingFunctions(nm).y;\n }\n return PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W * sum;\n}\nfunction illuminantXyz(illuminant: ResolvedCaptureIlluminant): [number, number, number] {\n let x = 0, y = 0, z = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) {\n const s = illuminant.shape.evaluate(nm), c = estimateCie1931ColorMatchingFunctions(nm);\n x += s * c.x; y += s * c.y; z += s * c.z;\n }\n return [x / y, 1, z / y];\n}\n/** Bilinear RGGB demosaic as explicit linear neighbourhood kernels (weights sum to one per output channel). */\nfunction bilinearPhaseProfiles(): RawFrameReconstructionPhaseProfile[] {\n const cross = [[1, 0], [-1, 0], [0, 1], [0, -1]], diagonal = [[1, 1], [1, -1], [-1, 1], [-1, -1]], horizontal = [[1, 0], [-1, 0]], vertical = [[0, 1], [0, -1]];\n type Contribution = { offsetX: number; offsetY: number; sourceChannelId: Channel; weight: number };\n const average = (offsets: number[][], channel: Channel): Contribution[] => offsets.map(([x, y]) => ({ offsetX: x!, offsetY: y!, sourceChannelId: channel, weight: 1 / offsets.length }));\n const self = (channel: Channel): Contribution[] => [{ offsetX: 0, offsetY: 0, sourceChannelId: channel, weight: 1 }];\n const kernels: Record<string, Record<Channel, ReturnType<typeof self>>> = {\n \"0,0\": { red: self(\"red\"), green: average(cross, \"green\"), blue: average(diagonal, \"blue\") },\n \"1,0\": { red: average(horizontal, \"red\"), green: self(\"green\"), blue: average(vertical, \"blue\") },\n \"0,1\": { red: average(vertical, \"red\"), green: self(\"green\"), blue: average(horizontal, \"blue\") },\n \"1,1\": { red: average(diagonal, \"red\"), green: average(cross, \"green\"), blue: self(\"blue\") }\n };\n return [[0, 0], [1, 0], [0, 1], [1, 1]].map(([px, py], index) => ({ phaseX: px!, phaseY: py!, profile: { schemaVersion: \"0.1.0\" as const,\n profileId: \"facade-bilinear-phase-\" + index, profileVersion: \"1\", captureModeId: IDS.mode, colorSamplingProfileId: IDS.cfa,\n scientificStatus: \"approximation\" as const, method: \"explicit-linear-native-neighborhood\" as const,\n normalization: \"weights-sum-to-one-per-output-channel\" as const, negativeBlackSubtractedValuesAllowed: true,\n kernels: CHANNELS.map((c) => ({ outputChannelId: c, contributions: kernels[px + \",\" + py]![c] })), evidence: FACADE_EVIDENCE,\n limitations: [\"Bilinear interpolation of the RGGB mosaic; no edge-directed demosaic, false-colour suppression or calibration.\"] } })) as unknown as RawFrameReconstructionPhaseProfile[];\n}\nfunction defaultProgramLine(): ExposureProgramLineProfile {\n // Generic educational program line written for the engine, relative to the f/8, 1/125 s reference. For less light\n // it first opens the aperture toward f/4, then lengthens the shutter. For more light it first closes toward\n // f/16, then shortens the shutter.\n return parseExposureProgramLineProfile({ schemaVersion: \"0.1.0\", profileId: \"facade-generic-program-line\", profileVersion: \"1.0.0\",\n scientificStatus: \"approximation\", policyKind: \"generic-program-line\", interpolation: \"log2-aperture-shutter\", evidence: FACADE_EVIDENCE,\n limitations: [\"Generic educational program line authored for the capture facade; not any manufacturer's program.\"],\n nodes: [\n { nodeId: \"minus-6\", opticalExposureStopsFromReference: -6, aperture: 16, shutterSeconds: 1 / 2000 },\n { nodeId: \"minus-2\", opticalExposureStopsFromReference: -2, aperture: 16, shutterSeconds: 1 / 125 },\n { nodeId: \"zero\", opticalExposureStopsFromReference: 0, aperture: 8, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-2\", opticalExposureStopsFromReference: 2, aperture: 4, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-9\", opticalExposureStopsFromReference: 9, aperture: 4, shutterSeconds: 128 / 125 }\n ] });\n}\n\n/** PNG colour signalling: the sRGB chunk for sRGB, ITU-T H.273 code points through cICP otherwise. */\nfunction pngColourEncoding(encoding: SimulateCaptureColorEncoding): PngColourEncoding {\n if (encoding === \"srgb\") return { kind: \"srgb\", renderingIntent: \"perceptual\" };\n if (encoding === \"display-p3\") return { kind: \"cicp\", primaries: \"display-p3\", transfer: \"srgb\", fullRange: true };\n return { kind: \"cicp\", primaries: \"bt2020\", transfer: \"bt709\", fullRange: true };\n}\n/**\n * Develops the packed RAW to unclipped linear sRGB/D65, using the exact operator inside\n * `createNativeRawDevelopmentTask`. Validation, demosaic kernels, border handling, per-site white-level\n * clipping, white balance, highlight mode and the camera→XYZ→linear-sRGB matrices are all the same. It\n * stops before tone mapping, gamut clipping and quantization. It reads the RAW without taking ownership.\n */\nasync function developLinearSrgb(input: NativeRawDevelopmentInput, afterRow: (completed: number, total: number) => Promise<void>,\n ahd?: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const v = prepareNativeRawDevelopment(input), plan = v.plan, raw = input.raw, layout = plan.frame.colorSamplingProfile.layout;\n if (layout.kind !== \"periodic-mosaic\") fail(\"Development requires a periodic CFA.\");\n const native = plan.exposure.geometry.nativeRaster, g = plan.exposure.resolvedGeometry, active = g.activeCapture.nativeRect;\n checkNativeRawIntegrity(raw, native.pixelWidth, layout.repeatWidthSites, layout.repeatHeightSites, 0, native.pixelHeight);\n const developer = createRawPixelDeveloper({ nativeWidth: native.pixelWidth, repeatWidth: layout.repeatWidthSites, repeatHeight: layout.repeatHeightSites,\n codes: raw.codes, blackLevels: raw.blackLevels, saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes }, v.phases, v.development, v.mirror);\n const width = v.raster.pixelWidth, height = v.raster.pixelHeight, rgb = new Float64Array(width * height * 3), row = new Float64Array(width * 3);\n const at = (x: number, y: number): { x: number; y: number } => {\n const q = transformOrientedRasterPointToNative({ point: { x: v.crop.x + x + 0.5, y: v.crop.y + y + 0.5 }, nativeRaster: g.activeCapture.raster, orientation: plan.exposure.geometry.orientation });\n return { x: Math.floor(q.x) + active.x, y: Math.floor(q.y) + active.y };\n };\n if (ahd) return developAhd(v, raw, layout.repeatWidthSites, layout.repeatHeightSites, width, height, at, afterRow, ahd);\n for (let y = 0; y < height; y++) {\n const first = at(0, y), second = width > 1 ? at(1, y) : first;\n developer.developRun(first.x, first.y, second.x - first.x, second.y - first.y, width, row);\n rgb.set(row, y * width * 3);\n await afterRow(y + 1, height);\n }\n const c = developer.counts;\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: c.saturatedPixelCount, whiteBalanceClippedSampleCount: c.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: c.reconstructedPixelCount } };\n}\n/**\n * AHD development (2.1): the same site normalization as the native development kernel (flagged or white-level sites\n * are 1, others (code − black)/(white − black)) on the whole native raster, demosaiced by `createAhdDemosaicTask`\n * (mirrored plane edges), then the native development's own colour operator (`developInto`: WB, highlight mode,\n * camera → XYZ → linear sRGB) per output pixel. The AHD homogeneity metric sees white-balanced colour: its\n * camera → XYZ matrix is the profile's matrix times the WB gains (the output values are not transformed by it).\n * The mosaic is stored in float32, as the AHD task requires.\n */\nasync function developAhd(v: ReturnType<typeof prepareNativeRawDevelopment>, raw: NativeRawOutput, repeatWidth: number, repeatHeight: number, width: number, height: number,\n at: (x: number, y: number) => { x: number; y: number }, afterRow: (completed: number, total: number) => Promise<void>,\n host: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const native = v.plan.exposure.geometry.nativeRaster, W = native.pixelWidth, H = native.pixelHeight;\n const source: RawDevelopmentSource = { nativeWidth: W, repeatWidth, repeatHeight, codes: raw.codes, blackLevels: raw.blackLevels,\n saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes };\n const samples = new Float32Array(W * H), saturated = new Uint8Array(W * H);\n for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {\n samples[y * W + x] = normalizedRawSite(source, x, y);\n if (rawSiteSaturated(source, x, y)) saturated[y * W + x] = 1;\n }\n const intent = v.plan.exposure.whiteBalanceIntent, gains = intent ? [intent.channelGains.red, intent.channelGains.green, intent.channelGains.blue] : [1, 1, 1];\n const m = v.color.normalizedCameraChannelsToXyz;\n const cameraToXyz = [0, 1, 2].map((r) => [0, 1, 2].map((c) => m[r]![c]! * gains[c]!)) as unknown as ColorMatrix3x3;\n // A caller-raised pixel limit already bounds the raster, so its working memory is not capped again at the 1 GiB default.\n const task = createAhdDemosaicTask({ plane: { width: W, height: H, captureModeId: v.plan.frame.modeId, colorSamplingProfile: v.plan.frame.colorSamplingProfile, samples },\n channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" }, cameraToXyz, ...(v.plan.maximumPixels === undefined ? {} : { maximumWorkingBytes: Number.MAX_SAFE_INTEGER }) }, { yieldControl: async () => { await host.yieldControl(); host.checkAbort(); } });\n const demosaicStarted = clockMs();\n await task.run();\n host.onDemosaicMs?.(clockMs() - demosaicStarted);\n const demosaiced = task.takeOutput().data, rgb = new Float64Array(width * height * 3);\n const counts = { saturatedPixelCount: 0, whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 };\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const p = at(x, y), i = p.y * W + p.x;\n let clipped = false;\n for (let dy = -AHD_VALUE_REACH; dy <= AHD_VALUE_REACH && !clipped; dy++) for (let dx = -AHD_VALUE_REACH; dx <= AHD_VALUE_REACH; dx++) {\n const sx = p.x + dx, sy = p.y + dy;\n if (sx >= 0 && sy >= 0 && sx < W && sy < H && saturated[sy * W + sx] !== 0) { clipped = true; break; }\n }\n if (clipped) counts.saturatedPixelCount++;\n v.development.developInto(demosaiced[3 * i]!, demosaiced[3 * i + 1]!, demosaiced[3 * i + 2]!, rgb, (y * width + x) * 3, counts);\n }\n await afterRow(y + 1, height);\n }\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: counts.saturatedPixelCount, whiteBalanceClippedSampleCount: counts.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: counts.reconstructedPixelCount } };\n}\n/** Linear sRGB/D65 → CIE XYZ (inverse of the development's XYZ → sRGB matrix) → linear target RGB/D65. */\nfunction linearSrgbToTarget(target: \"srgb\" | \"display-p3\" | \"rec2020\"): readonly (readonly number[])[] {\n return multiplyMatrices(resolveRgbColorSpace(target).value.xyzToRgb, resolveCaptureColorModel().cameraRgbToXyz as unknown as ColorMatrix3x3);\n}\n/** Knee of the `perceptual` gamut mapping: chroma below 90 % of the gamut-boundary chroma (at constant L*, h) is untouched. */\nconst PERCEPTUAL_GAMUT_KNEE_FRACTION = 0.9;\n/**\n * SDR encoding from linear sRGB/D65:\n * 1. Convert to the target primaries with a matrix.\n * 2. Either clip each component to [0, 1], or, with `mapping`, compress chroma while keeping CIELAB hue\n * and lightness (`prepareRgbGamutMapping`).\n * 3. Apply the target transfer function and round to the nearest code (ties round up).\n */\nfunction encodeSdrFromLinear(rgb: Float64Array, encoding: \"srgb\" | \"display-p3\" | \"rec2020\", bitDepth: 8 | 16, mapping?: PreparedRgbGamutMapping):\n { samples: Uint8Array | Uint16Array; diagnostics: SdrRenderingResult[\"diagnostics\"]; adjustedPixelCount: number; lightnessClippedPixelCount: number } {\n const m = linearSrgbToTarget(encoding), toXyz = resolveCaptureColorModel().cameraRgbToXyz, maximum = 2 ** bitDepth - 1;\n const transfer = encoding === \"rec2020\" ? evaluateBt709Oetf : evaluateSrgbEncoding;\n const samples = bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n let low = 0, high = 0, adjusted = 0, lightnessClipped = 0;\n for (let i = 0; i < rgb.length; i += 3) {\n const r = rgb[i]!, g = rgb[i + 1]!, b = rgb[i + 2]!;\n if (mapping) {\n const xyz = [0, 1, 2].map((k) => toXyz[k]![0]! * r + toXyz[k]![1]! * g + toXyz[k]![2]! * b) as unknown as ColorVector3;\n const mapped = mapping.map(xyz);\n if (mapped.adjusted) adjusted++;\n if (mapped.lightnessClipped) lightnessClipped++;\n for (let k = 0; k < 3; k++) samples[i + k] = Math.floor(transfer(mapped.linearRgb[k]!) * maximum + 0.5);\n continue;\n }\n for (let k = 0; k < 3; k++) {\n const row = m[k]!;\n let value = row[0]! * r + row[1]! * g + row[2]! * b;\n if (value < 0) { value = 0; low++; } else if (value > 1) { value = 1; high++; }\n samples[i + k] = Math.floor(transfer(value) * maximum + 0.5);\n }\n }\n return { samples, adjustedPixelCount: adjusted, lightnessClippedPixelCount: lightnessClipped, diagnostics: { renderingNegativeSampleCount: low,\n renderingAboveReferenceSampleCount: high, toneChangedSampleCount: 0, gamutClippedLowSampleCount: low, gamutClippedHighSampleCount: high, captureSaturation: \"consumed-in-raw-development\" } };\n}\n\n/**\n * Simulates one still capture of a planar scene and returns the developed image, the packed RAW, the full\n * underlying request/plan, provenance and every assumption made. See docs/QUICK_START.md.\n */\nexport async function simulateCapture(options: SimulateCaptureOptions): Promise<SimulateCaptureResult> {\n return await runCapture(options, false) as SimulateCaptureResult;\n}\n\n/**\n * The ideal reference of a capture request (2.3): the same scene, framing, chart size, output size, region and pixel\n * grid as `simulateCapture(options)` would use, rendered with no camera effects (no lens blur, diffraction, defocus,\n * distortion, vignetting, anti-aliasing filter, mosaic or demosaic, noise, dark signal or motion), at the capture's\n * own exposure and developed with its white balance, colour matrices, tone curve and encoding (the\n * `reference.exposure` assumption). Deterministic and cheap: no RAW is simulated. Formats srgb-8, srgb-16 and png.\n * The result is labelled `kind: \"ideal-reference\"`; it is not a capture.\n * @see docs/QUICK_START.md, \"Ideal reference\".\n */\nexport async function simulateIdealReference(options: SimulateCaptureOptions): Promise<IdealReferenceResult> {\n return await runCapture(options, true) as IdealReferenceResult;\n}\n\n/** Result of {@link simulateIdealReference}: an ideal reference image, not a capture (no RAW, plan or request). */\nexport interface IdealReferenceResult {\n kind: \"ideal-reference\";\n /** Human-readable label for a user interface. */\n label: string;\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: { width: number; height: number; format: SimulateCaptureOutputFormat; samples: Uint8Array | Uint16Array; png?: Uint8Array; colorEncoding?: SimulateCaptureColorEncoding };\n /** The resolved exposure of the capture this reference matches. */\n exposure: { mode: SimulateCaptureExposureMode; settings: { fNumber: number; shutterSeconds: number; iso: number }; ev100: number };\n scene: SimulateCaptureResult[\"scene\"];\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number };\n diagnostics: { sampleCount: number; timingsMs: { reference: number; total: number } };\n provenance: { scientificStatus: \"approximation\"; cameraPresetId: string; cameraPresetVersion: string; evidence: readonly EvidenceProvenance[];\n composedContracts: readonly string[]; limitations: readonly string[] };\n /** The capture request's assumptions, then `reference.kind`, `reference.excludes`, `reference.exposure` and `reference.sampling`. */\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\nasync function runCapture(options: SimulateCaptureOptions, idealReference: boolean): Promise<SimulateCaptureResult | IdealReferenceResult> {\n const started = Date.now();\n requireInputObject(options, \"simulateCapture options\");\n const top = allowKeys(options, \"simulateCapture options\", [\"camera\", \"lens\", \"exposure\", \"scene\", \"subjectDistanceM\", \"chartSize\", \"illuminant\",\n \"illuminanceLux\", \"output\", \"sensor\", \"motion\", \"signal\", \"onProgress\"]);\n const signal = top.signal as AbortSignal | undefined, onProgress = top.onProgress as SimulateCaptureOptions[\"onProgress\"];\n if (signal !== undefined && (typeof signal !== \"object\" || signal === null || typeof (signal as AbortSignal).aborted !== \"boolean\")) fail(\"signal must be an AbortSignal.\");\n if (onProgress !== undefined && typeof onProgress !== \"function\") fail(\"onProgress must be a function.\");\n const assumptions: SimulateCaptureAssumption[] = [];\n const assume = (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string): void => { assumptions.push({ id, kind, value, explanation }); };\n function pick<T>(record: Record<string, unknown>, key: string, path: string, fallback: T, explanation: string): T {\n if (record[key] !== undefined) return record[key] as T;\n assume(path, \"default\", fallback, explanation);\n return fallback;\n }\n const checkAbort = (): void => { if (signal?.aborted) fail(\"simulateCapture aborted.\"); };\n checkAbort();\n\n // Camera\n const cameraOption = pick<GenericEquipmentTier | GenericEquipmentTierPreset>(top, \"camera\", \"camera\", DEFAULTS.camera,\n \"Generic Photivra tier preset 2.0.0 (synthetic educational values, not a real camera).\");\n let preset: GenericEquipmentTierPreset;\n if (typeof cameraOption === \"string\") preset = GENERIC_TIER_ASSETS.find((p) => p.tier === cameraOption) ?? fail(\"Unknown camera tier.\");\n else preset = parseCallerCameraPreset(cameraOption);\n const body = preset.body, lens = preset.lens;\n\n // Lens\n const lensOptions = allowKeys(top.lens, \"lens\", [\"focalLengthMm\", \"fNumber\", \"focusDistanceM\", \"pupilSampling\", \"projection\", \"distortion\", \"vignetting\", \"psf\", \"diffraction\", \"prime\"]);\n // Generic prime (2.3): resolved on the simulated frame's size, which the output and sensor sections validate again below.\n let prime: GenericPrimeLens | undefined;\n if (lensOptions.prime !== undefined) {\n if (lensOptions.focalLengthMm !== undefined) fail(\"lens.prime and lens.focalLengthMm cannot both be given: the prime sets the focal length.\");\n const o = (typeof top.output === \"object\" && top.output !== null ? top.output : {}) as Record<string, unknown>, sn = (typeof top.sensor === \"object\" && top.sensor !== null ? top.sensor : {}) as Record<string, unknown>;\n const frameW = positive(o.width ?? DEFAULTS.width, \"output.width\"), frameH = positive(o.height ?? DEFAULTS.height, \"output.height\"), framePitch = positive(sn.pixelPitchMicrometers ?? DEFAULTS.pixelPitchMicrometers, \"sensor.pixelPitchMicrometers\");\n if (typeof lensOptions.prime !== \"number\") fail(\"lens.prime must be a generic prime's full-frame-equivalent focal length in mm.\");\n prime = resolveGenericPrimeLens({ equivalentFocalLengthMm: lensOptions.prime as number, activeImagingArea: { widthMm: frameW * framePitch / 1000, heightMm: frameH * framePitch / 1000 } });\n assume(\"lens.prime\", \"model\", { lensId: prime.lensId, equivalentFocalLengthMm: prime.equivalentFocalLengthMm, focalLengthMm: prime.focalLengthMm, cropFactor35Mm: prime.cropFactor35Mm,\n widestFNumber: prime.widestFNumber, narrowestFNumber: prime.narrowestFNumber, minimumFocusDistanceM: prime.minimumFocusDistanceM },\n \"Generic prime (not a real product): focal length = equivalent ÷ the simulated frame's diagonal crop factor, f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber +\n \", minimum focus max(0.10 m, f·(1 + 1/0.15)) (thin-lens approximation). It replaces the tier lens's focal length and f-number range; the tier lens's transmission is kept.\");\n }\n const lensExposure = prime ? { ...lens.exposure, profileId: \"photivra-\" + prime.lensId + \":exposure\",\n focalLengthMmRange: { ...lens.exposure.focalLengthMmRange, value: { minimum: prime.focalLengthMm, maximum: prime.focalLengthMm } },\n aperture: { ...lens.exposure.aperture, widestAvailableFNumber: { kind: \"constant\" as const, fNumber: { value: prime.widestFNumber, evidence: FACADE_EVIDENCE } },\n narrowestAvailableFNumber: { value: prime.narrowestFNumber, evidence: FACADE_EVIDENCE } } } as typeof lens.exposure : lens.exposure;\n const focalDefault = lensExposure.focalLengthMmRange.value.minimum;\n const focalLengthMm = prime ? prime.focalLengthMm :\n positive(pick(lensOptions, \"focalLengthMm\", \"lens.focalLengthMm\", focalDefault, \"The preset lens's focal length (the generic primes are 50 mm).\"), \"lens.focalLengthMm\");\n const capabilities = resolveGenericEquipmentExposureCapabilities({ bodyProfile: body.exposure, lensProfile: lensExposure, selectedFocalLengthMm: focalLengthMm });\n const subjectDistanceM = positive(pick(top, \"subjectDistanceM\", \"subjectDistanceM\", DEFAULTS.subjectDistanceM, \"Scene plane 5 m in front of the camera (the generic tiers' reference focus distance).\"), \"subjectDistanceM\");\n if (subjectDistanceM * 1000 <= focalLengthMm * 2) fail(\"subjectDistanceM must exceed twice the focal length.\");\n const focusDistanceM = positive(pick(lensOptions, \"focusDistanceM\", \"lens.focusDistanceM\", subjectDistanceM, \"Focused on the scene plane.\"), \"lens.focusDistanceM\");\n if (focusDistanceM * 1000 <= focalLengthMm) fail(\"lens.focusDistanceM must exceed the focal length.\");\n if (prime && (subjectDistanceM < prime.minimumFocusDistanceM || focusDistanceM < prime.minimumFocusDistanceM))\n fail(\"The \" + prime.lensId + \" focuses no closer than \" + prime.minimumFocusDistanceM + \" m (max(0.10 m, f·(1 + 1/0.15))); subjectDistanceM and lens.focusDistanceM must be at least that.\");\n let pupil: { radialSamples: number; angularSamples: number } | undefined;\n if (lensOptions.pupilSampling === undefined) assume(\"lens.pupilSampling\", \"default\", null,\n \"No pupil sampling: each scene query follows the central (chief) ray, so defocus and depth of field are not rendered. Enable lens.pupilSampling for an ideal circular pupil.\");\n else {\n const p = allowKeys(lensOptions.pupilSampling, \"lens.pupilSampling\", [\"radialSamples\", \"angularSamples\"]);\n // The environment pupil contract admits 4..64 azimuthal midpoints and at most 256 rays.\n pupil = { radialSamples: integerIn(p.radialSamples, \"lens.pupilSampling.radialSamples\", 1, 16), angularSamples: integerIn(p.angularSamples, \"lens.pupilSampling.angularSamples\", 4, 64) };\n if (pupil.radialSamples * pupil.angularSamples > 256) fail(\"lens.pupilSampling needs at most 256 rays (radialSamples × angularSamples).\");\n }\n // 2.0 optics hooks: only what the environment site contract accepts.\n const projection: LensProjectionModel | undefined = lensOptions.projection === undefined ? undefined : parseLensProjectionModel(lensOptions.projection);\n let distortion: SimulateCaptureLensDistortion | undefined;\n if (lensOptions.distortion !== undefined) {\n const d = allowKeys(lensOptions.distortion, \"lens.distortion\", [\"kind\", \"profile\"]);\n if (d.kind !== \"radial\" && d.kind !== \"brown-conrady\") fail(\"lens.distortion.kind must be radial or brown-conrady.\");\n distortion = d as unknown as SimulateCaptureLensDistortion;\n }\n const lensFieldMapping: EnvironmentLensFieldMapping | undefined = projection === undefined && distortion === undefined ? undefined :\n { projectionModel: projection ?? \"rectilinear\", distortion: distortion ?? { kind: \"none\" }, radiometricAreaCorrection: \"inverse-distortion-jacobian\" };\n if (lensFieldMapping) {\n if (pupil) fail(\"lens.projection and lens.distortion cannot be combined with lens.pupilSampling: ideal pupil rays use the rectilinear, distortion-free projection.\");\n try { prepareEnvironmentLensFieldMapping(lensFieldMapping); } catch (error) { fail(\"Invalid lens projection or distortion: \" + (error as Error).message); }\n }\n let vignetting: IlluminationVignettingProfile | undefined;\n if (lensOptions.vignetting !== undefined) { requireInputObject(lensOptions.vignetting, \"lens.vignetting\"); vignetting = lensOptions.vignetting as IlluminationVignettingProfile; }\n let lensPsf: NonNullable<NonNullable<SimulateCaptureOptions[\"lens\"]>[\"psf\"]> | undefined;\n if (lensOptions.psf !== undefined) {\n const p = allowKeys(lensOptions.psf, \"lens.psf\", [\"kind\", \"configuration\"]);\n if (p.kind !== \"sampled-local\") fail(\"lens.psf.kind must be sampled-local.\");\n requireInputObject(p.configuration, \"lens.psf.configuration\");\n if (pupil) fail(\"lens.psf cannot be combined with lens.pupilSampling: geometric defocus would be counted twice.\");\n lensPsf = p as unknown as typeof lensPsf;\n }\n // Diffraction (2.1): validated here, built once the f-number is resolved.\n let diffractionRadiusOption: number | null | undefined;\n if (lensOptions.diffraction !== undefined) {\n const d = lensOptions.diffraction;\n if (d === \"circular-aperture\") diffractionRadiusOption = null;\n else {\n const record = allowKeys(d, \"lens.diffraction\", [\"aperture\", \"kernelRadiusSamples\"]);\n if (record.aperture !== \"circular-aperture\") fail(\"lens.diffraction must be \\\"circular-aperture\\\" or { aperture: \\\"circular-aperture\\\", kernelRadiusSamples }.\");\n diffractionRadiusOption = record.kernelRadiusSamples === undefined ? null : integerIn(record.kernelRadiusSamples, \"lens.diffraction.kernelRadiusSamples\", 0, 32);\n }\n if (lensPsf) fail(\"lens.diffraction cannot be combined with lens.psf: diffraction would be counted twice.\");\n if (pupil) fail(\"lens.diffraction cannot be combined with lens.pupilSampling: the environment contract does not mix a sampled PSF with pupil rays.\");\n }\n\n // Motion (2.0): constant camera rotation and the shutter type.\n const motionOptions = allowKeys(top.motion, \"motion\", [\"angularVelocityRadPerSec\", \"shutter\", \"rollingShutterSkewSeconds\"]);\n const angular = { pitch: 0, yaw: 0, roll: 0 };\n if (motionOptions.angularVelocityRadPerSec !== undefined) {\n const a = allowKeys(motionOptions.angularVelocityRadPerSec, \"motion.angularVelocityRadPerSec\", [\"pitch\", \"yaw\", \"roll\"]);\n for (const axis of [\"pitch\", \"yaw\", \"roll\"] as const) if (a[axis] !== undefined) {\n const value = a[axis];\n if (typeof value !== \"number\" || !Number.isFinite(value) || Math.abs(value) > 100) fail(\"motion.angularVelocityRadPerSec.\" + axis + \" must be a finite number within ±100 rad/s.\");\n angular[axis] = value as number;\n }\n }\n const rotating = angular.pitch !== 0 || angular.yaw !== 0 || angular.roll !== 0;\n const shutterKind = motionOptions.shutter === undefined ? \"global\" : motionOptions.shutter;\n if (shutterKind !== \"global\" && shutterKind !== \"rolling\") fail(\"motion.shutter must be global or rolling.\");\n if (motionOptions.rollingShutterSkewSeconds !== undefined && shutterKind !== \"rolling\") fail(\"motion.rollingShutterSkewSeconds needs motion.shutter \\\"rolling\\\".\");\n const rollingSkewOption = motionOptions.rollingShutterSkewSeconds === undefined ? undefined : positive(motionOptions.rollingShutterSkewSeconds, \"motion.rollingShutterSkewSeconds\");\n // Diffraction runs as an object-space convolution when every PSF tap's source is another site centre seen\n // through one linear map (still camera, rectilinear, no distortion or field throughput); otherwise per tap.\n const diffractionObjectSpace = diffractionRadiusOption !== undefined && !rotating && !lensFieldMapping && !vignetting;\n\n // Output and sensor\n const outputOptions = allowKeys(top.output, \"output\", [\"width\", \"height\", \"format\", \"toneCurve\", \"toneCurveParameters\", \"highlightMode\", \"whiteBalance\", \"jpegQuantizationStep\",\n \"colorEncoding\", \"bitDepth\", \"gamutMapping\", \"demosaic\", \"borderHandling\", \"dng\", \"maximumPixels\", \"region\", \"metadata\"]);\n // Opt-in large images: a caller-raised native pixel limit. Without it the 4094-pixel sides are unchanged.\n const raisedPixels = outputOptions.maximumPixels === undefined ? undefined : integerIn(outputOptions.maximumPixels, \"output.maximumPixels\", 1, NATIVE_RAW_LIMITS.ceilingPixels);\n const maximumSide = raisedPixels === undefined ? 4094 : NATIVE_RAW_LIMITS.maximumDimension;\n const width = integerIn(pick(outputOptions, \"width\", \"output.width\", DEFAULTS.width, \"64 × 64 output pixels.\"), \"output.width\", 1, maximumSide);\n const height = integerIn(pick(outputOptions, \"height\", \"output.height\", DEFAULTS.height, \"64 × 64 output pixels.\"), \"output.height\", 1, maximumSide);\n const format = pick<SimulateCaptureOutputFormat>(outputOptions, \"format\", \"output.format\", DEFAULTS.format, \"8-bit sRGB samples.\");\n if (![\"srgb-8\", \"srgb-16\", \"jpeg\", \"png\", \"dng\"].includes(format)) fail(\"output.format must be srgb-8, srgb-16, jpeg, png or dng.\");\n let dngCapturedAtUtc: string | undefined;\n if (format === \"dng\") {\n const d = allowKeys(outputOptions.dng, \"output.dng\", [\"capturedAtUtc\"]);\n dngCapturedAtUtc = d.capturedAtUtc as string | undefined;\n if (dngCapturedAtUtc === undefined) assume(\"output.dng.capturedAtUtc\", \"default\", null, \"No capture time: the DNG carries no DateTimeOriginal (the engine never invents a wall clock).\");\n } else if (outputOptions.dng !== undefined) fail(\"output.dng applies only to output.format \\\"dng\\\".\");\n const textMetadata = parseOutputTextMetadata(outputOptions.metadata, \"output.metadata\");\n if (textMetadata && format !== \"jpeg\" && format !== \"png\" && format !== \"dng\") fail(\"output.metadata applies only to output.format \\\"jpeg\\\", \\\"png\\\" or \\\"dng\\\".\");\n const assumeTextMetadata = (layout: string): void => {\n if (textMetadata) assume(\"output.metadata\", \"model\", { fields: Object.keys(textMetadata), layout },\n \"The caller's text, written unchanged; the engine adds no text of its own (in the DNG the description follows the existing simulated-RAW statement). Without output.metadata the file is byte-identical to 2.3.\");\n };\n let colorEncoding: SimulateCaptureColorEncoding | undefined, pngBitDepth: 8 | 16 | undefined;\n if (format === \"png\") {\n colorEncoding = pick<SimulateCaptureColorEncoding>(outputOptions, \"colorEncoding\", \"output.colorEncoding\", \"srgb\",\n \"sRGB (W3C CSS Color 4 srgb) samples signalled with the PNG sRGB chunk (perceptual intent) and its prescribed gAMA/cHRM values.\");\n if (![\"srgb\", \"display-p3\", \"rec2020\"].includes(colorEncoding)) fail(\"output.colorEncoding must be srgb, display-p3 or rec2020.\");\n pngBitDepth = pick<8 | 16>(outputOptions, \"bitDepth\", \"output.bitDepth\", 8, \"8 bits per sample.\");\n if (pngBitDepth !== 8 && pngBitDepth !== 16) fail(\"output.bitDepth must be 8 or 16.\");\n } else if (outputOptions.colorEncoding !== undefined || outputOptions.bitDepth !== undefined) fail(\"output.colorEncoding and output.bitDepth apply only to output.format \\\"png\\\".\");\n let perceptual = false;\n if (format === \"png\") {\n const gamutMapping = pick<\"clip\" | \"perceptual\">(outputOptions, \"gamutMapping\", \"output.gamutMapping\", \"clip\", \"Out-of-gamut components are clipped to [0, 1] in the target space.\");\n if (gamutMapping !== \"clip\" && gamutMapping !== \"perceptual\") fail(\"output.gamutMapping must be clip or perceptual.\");\n perceptual = gamutMapping === \"perceptual\";\n } else if (outputOptions.gamutMapping !== undefined) fail(\"output.gamutMapping applies only to output.format \\\"png\\\".\");\n const wideGamut = colorEncoding !== undefined && colorEncoding !== \"srgb\";\n // The linear development path serves wide-gamut encodings and perceptual gamut mapping.\n const linearPath = wideGamut || perceptual;\n const toneCurve = pick<SdrToneCurve>(outputOptions, \"toneCurve\", \"output.toneCurve\", DEFAULTS.toneCurve, \"Identity tone curve: scene-linear values are clipped at display white, then sRGB-encoded.\");\n if (linearPath && toneCurve !== \"identity\") fail(\"output.toneCurve other than identity is available only for sRGB output; wide-gamut encodings are converted from the linear developed colour.\");\n const highlightMode = pick<RawHighlightMode>(outputOptions, \"highlightMode\", \"output.highlightMode\", DEFAULTS.highlightMode, \"Saturated RAW highlights are clipped to neutral.\");\n const whiteBalanceOption = pick<SimulateCaptureWhiteBalance>(outputOptions, \"whiteBalance\", \"output.whiteBalance\", DEFAULTS.whiteBalance,\n \"White balance measured from a perfect white diffuser under the scene illuminant (a custom/grey-card white balance).\");\n const jpegStep = format === \"jpeg\" ? integerIn(pick(outputOptions, \"jpegQuantizationStep\", \"output.jpegQuantizationStep\", DEFAULTS.jpegQuantizationStep,\n \"Constant JPEG quantization step 2 (not a manufacturer quality scale).\"), \"output.jpegQuantizationStep\", 1, 255) : undefined;\n if (format !== \"jpeg\" && outputOptions.jpegQuantizationStep !== undefined) fail(\"output.jpegQuantizationStep applies only to output.format \\\"jpeg\\\".\");\n const sensorOptions = allowKeys(top.sensor, \"sensor\", [\"pixelPitchMicrometers\", \"spectralStepNanometers\", \"temporalSampleCount\", \"noiseSeed\", \"antiAliasing\", \"pixelAperture\"]);\n const pitch = positive(pick(sensorOptions, \"pixelPitchMicrometers\", \"sensor.pixelPitchMicrometers\", DEFAULTS.pixelPitchMicrometers,\n \"6 µm pixels (about a 24 MP full-frame sensor). The simulated sensor is width × pitch wide, so small images are a central crop of a large sensor, not a downscaled full frame.\"), \"sensor.pixelPitchMicrometers\");\n if (pitch < 0.5 || pitch > SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS) fail(\"sensor.pixelPitchMicrometers must be 0.5-\" + SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS + \".\");\n const spectralStep = positive(pick(sensorOptions, \"spectralStepNanometers\", \"sensor.spectralStepNanometers\", DEFAULTS.spectralStepNanometers,\n \"Spectral midpoint quadrature over 380-780 nm with subintervals of at most 20 nm.\"), \"sensor.spectralStepNanometers\");\n if (spectralStep < 1 || spectralStep > 100) fail(\"sensor.spectralStepNanometers must be 1-100.\");\n const temporalSampleCount = integerIn(rotating ? pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", ROTATING_TEMPORAL_SAMPLE_COUNT,\n \"Eight temporal midpoints across each site's exposure window sample the camera rotation (motion blur); raise it for long exposures or fast rotation.\") :\n pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", DEFAULTS.temporalSampleCount,\n \"One temporal sample: the static scene and still camera make more samples unnecessary.\"), \"sensor.temporalSampleCount\", 1, 256);\n const noiseSeed = integerIn(pick(sensorOptions, \"noiseSeed\", \"sensor.noiseSeed\", DEFAULTS.noiseSeed, \"Fixed noise seed 1 (deterministic output).\"), \"sensor.noiseSeed\", 0, 0xffffffff);\n const antiAliasing = sensorOptions.antiAliasing === undefined ? undefined : parseAntiAliasing(sensorOptions.antiAliasing, pitch);\n // Pixel aperture (2.3): N × N midpoint nodes over the square photosite; 1 = the default centre sample.\n let boxSamples = 1;\n if (sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\") {\n const a = sensorOptions.pixelAperture;\n if (a === \"box\") boxSamples = SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES;\n else {\n const record = allowKeys(a, \"sensor.pixelAperture\", [\"kind\", \"samplesPerAxis\"]);\n if (record.kind !== \"box\") fail(\"sensor.pixelAperture must be \\\"point\\\", \\\"box\\\" or { kind: \\\"box\\\", samplesPerAxis }.\");\n boxSamples = record.samplesPerAxis === undefined ? SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES : integerIn(record.samplesPerAxis, \"sensor.pixelAperture.samplesPerAxis\", 1, 16);\n }\n }\n const boxAperture = sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\";\n\n const colorSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.cfa, evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-color-sampling-site-index\" as const,\n layout: { kind: \"periodic-mosaic\" as const, repeatWidthSites: 2, repeatHeightSites: 2, siteChannelIds: [\"red\", \"green\", \"green\", \"blue\"], anchor: \"native-sensor-top-left-site\" as const } };\n // Demosaic (2.0): built-in Bayer kernels and border handling. Omitted, the 1.0 bilinear kernels and a\n // one-site rendered border are used unchanged.\n const demosaicOption = outputOptions.demosaic as SimulateCaptureDemosaic | undefined, borderOption = outputOptions.borderHandling as SimulateCaptureBorderHandling | undefined;\n if (demosaicOption !== undefined && demosaicOption !== \"bilinear\" && demosaicOption !== \"ahd\") fail(\"output.demosaic must be bilinear or ahd.\");\n const ahd = demosaicOption === \"ahd\";\n if (borderOption !== undefined && borderOption !== \"margin\" && borderOption !== \"mirror\") fail(\"output.borderHandling must be margin or mirror.\");\n const builtInDemosaic = demosaicOption === undefined ? undefined : createBuiltInBayerDemosaicProfiles({ kernel: \"bilinear\",\n captureModeId: IDS.mode, colorSamplingProfile, channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" } }).value;\n const mirrorBorder = borderOption === \"mirror\";\n const margin = mirrorBorder ? 0 : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n if (mirrorBorder && (width < 2 || height < 2)) fail(\"output.borderHandling \\\"mirror\\\" needs an output of at least 2 × 2 pixels.\");\n if (ahd && mirrorBorder && (width < 3 || height < 3)) fail(\"output.demosaic \\\"ahd\\\" with mirror borders needs an output of at least 3 × 3 pixels.\");\n\n // Geometry: the demosaic border (if any) on each side; output crop is the active area.\n const nativeWidth = width + 2 * margin, nativeHeight = height + 2 * margin;\n // Region (2.3): a rectangle of the whole frame. Its native sites are the region plus the demosaic reach on each side\n // (clipped to the raster, where mirror borders apply exactly as in the whole render), with the origin rounded down to\n // the 2 × 2 CFA repeat so the region raster keeps the frame's CFA phase.\n let region: { x: number; y: number; width: number; height: number } | undefined, regionNative: typeof region;\n if (outputOptions.region !== undefined) {\n const r = allowKeys(outputOptions.region, \"output.region\", [\"x\", \"y\", \"width\", \"height\"]);\n const x = integerIn(r.x, \"output.region.x\", 0, width - 1), y = integerIn(r.y, \"output.region.y\", 0, height - 1);\n region = { x, y, width: integerIn(r.width, \"output.region.width\", 1, width - x), height: integerIn(r.height, \"output.region.height\", 1, height - y) };\n const reach = margin > 0 ? margin : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n let x0 = Math.max(0, region.x + margin - reach), y0 = Math.max(0, region.y + margin - reach);\n x0 -= x0 % 2; y0 -= y0 % 2;\n regionNative = { x: x0, y: y0, width: Math.min(nativeWidth, region.x + region.width + margin + reach) - x0, height: Math.min(nativeHeight, region.y + region.height + margin + reach) - y0 };\n }\n const outputWidth = region ? region.width : width, outputHeight = region ? region.height : height;\n if (region && regionNative) assume(\"output.region\", \"model\", { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } },\n \"Only this rectangle of the \" + width + \" × \" + height + \" frame is rendered. Framing, metering, exposure, diffraction kernels and every site's physics, noise seeds and exposure window (rolling-shutter row timing) are those of the whole frame (absolute native indices), \" +\n \"and the native rectangle includes the demosaic reach on each side (\" + (margin > 0 ? margin : \"mirror-border\") + \"), so the pixels are byte-identical to the same pixels of the whole render. \" +\n \"With lens.diffraction the object-space convolution runs over whole-width bands of 32 native rows that the region touches.\");\n if (raisedPixels !== undefined) {\n if (nativeWidth > NATIVE_RAW_LIMITS.maximumDimension || nativeHeight > NATIVE_RAW_LIMITS.maximumDimension || nativeWidth * nativeHeight > raisedPixels) {\n fail(\"output.maximumPixels (\" + raisedPixels + \") must cover the native sensor raster of \" + nativeWidth + \" × \" + nativeHeight +\n \" sites (the output plus the demosaic margin), at most \" + NATIVE_RAW_LIMITS.maximumDimension + \" per side.\");\n }\n if (ahd && (regionNative ? regionNative.width * regionNative.height : nativeWidth * nativeHeight) > PROCESSING_MAX_PIXELS) fail(\"output.demosaic \\\"ahd\\\" admits at most \" + PROCESSING_MAX_PIXELS + \" native sites.\");\n }\n const imagingArea = { widthMm: nativeWidth * pitch / 1000, heightMm: nativeHeight * pitch / 1000 };\n const geometry = { imagingArea, nativeRaster: { pixelWidth: nativeWidth, pixelHeight: nativeHeight }, orientation: \"landscape\" as const,\n activeCaptureRect: { x: margin, y: margin, width, height }, outputRaster: { pixelWidth: width, pixelHeight: height } };\n const resolvedGeometry = resolveCaptureGeometry(geometry).value;\n const imageDistanceMm = focalLengthMm * focusDistanceM * 1000 / (focusDistanceM * 1000 - focalLengthMm);\n const metresPerFrameUnit = (width * pitch / 2000) * subjectDistanceM / imageDistanceMm;\n const aspect = height / width;\n // Fixed-size chart (2.3): validated here, before any scene work.\n const chartSize = top.chartSize === undefined ? undefined : resolveChartSizeOption(top.chartSize, aspect);\n assume(\"scene.framing\", \"derived\", { framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect },\n chartSize ? \"The scene plane is perpendicular to the optical axis; the frame covers this much of it (thin lens, focused distance), and the chart has the physical size in scene.chartSize.\" :\n \"The scene plane is perpendicular to the optical axis and the chart is sized to fill the active frame exactly.\");\n let chartReport: NonNullable<SimulateCaptureResult[\"scene\"][\"chart\"]> | undefined;\n if (chartSize) {\n for (const key of chartSize.defaulted) assume(\"chartSize.\" + key, \"default\", chartSize[key], key === \"heightM\" ?\n \"The chart has the frame's shape: height = width × output height / output width.\" : \"An 18 % neutral grey plane surrounds the chart.\");\n const magnification = imageDistanceMm / (subjectDistanceM * 1000), framedWidthM = 2 * metresPerFrameUnit, framedHeightM = framedWidthM * aspect;\n chartReport = { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance,\n frameWidthFraction: chartSize.widthM / framedWidthM, frameHeightFraction: chartSize.heightM / framedHeightM, magnification,\n imageWidthMm: chartSize.widthM * 1000 * magnification, imageHeightMm: chartSize.heightM * 1000 * magnification,\n imageWidthPixels: chartSize.widthM * 1e6 * magnification / pitch, imageHeightPixels: chartSize.heightM * 1e6 * magnification / pitch };\n assume(\"scene.chartSize\", \"model\", chartReport,\n \"Fixed-size chart: the chart is widthM × heightM metres on the scene plane, centred on the optical axis, and the rest of the plane is a neutral Lambertian surround under the same light. \" +\n \"Its image size follows the facade's thin-lens framing: magnification m = v/d with the image distance v = f·s/(s − f) at the focus distance s and the subject distance d, so the frame spans \" +\n \"sensor width / m on the plane. frameWidthFraction and frameHeightFraction above 1 mean the chart is larger than the frame and cropped.\");\n }\n if (demosaicOption === undefined && borderOption === undefined) {\n assume(\"output.demosaic\", \"model\", \"bilinear-rggb\", \"Bilinear RGGB demosaic through explicit linear kernels; the native raster has a one-site border on each side so every output pixel has full support.\");\n } else {\n if (demosaicOption === undefined) assume(\"output.demosaic\", \"default\", \"bilinear-rggb\", \"The 1.0 facade's bilinear RGGB kernels (explicit linear neighbourhood weights).\");\n else if (ahd) assume(\"output.demosaic\", \"model\", { method: \"ahd-hirakawa-parks-2005\", dependenceReachSites: AHD_MARGIN },\n \"Adaptive homogeneity-directed demosaicing (createAhdDemosaicTask, after Hirakawa & Parks, IEEE TIP 14(3), 2005): directional green, red/blue from colour differences, and per pixel the more homogeneous of the horizontal and vertical candidates in CIELAB (white-balanced camera colour); the paper's iterative median step is not applied. Non-linear; the mosaic is normalized and white-level clipped as in the native development and stored in float32, and the native development's colour operator follows. request.development keeps the built-in bilinear kernels, which validate the development but are not used for these pixels.\");\n else assume(\"output.demosaic\", \"model\", { kernel: builtInDemosaic!.kernel, modelVersion: BUILT_IN_DEMOSAIC_VERSION, kernelReachSites: builtInDemosaic!.kernelReachSites },\n \"Built-in bilinear Bayer kernels (createBuiltInBayerDemosaicProfiles): nearest same-channel averages.\");\n if (borderOption === undefined) assume(\"output.borderHandling\", \"default\", \"margin\", \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n else assume(\"output.borderHandling\", \"model\", borderOption, mirrorBorder ?\n \"No rendered border: the native raster equals the output and reconstruction reads reflect-101 mirror images of the missing sites (CFA consistency validated), so edge pixels use mirrored rather than rendered neighbours.\" :\n \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n }\n\n // Radiance queries per native site: spectral subintervals × temporal midpoints × pupil rays × PSF taps.\n const psfTaps = lensPsf ? Math.max(1, ...((lensPsf.configuration.psf.profile.nodes ?? []) as readonly { kernel?: { widthSamples?: unknown; heightSamples?: unknown } }[])\n .map((node) => Number(node.kernel?.widthSamples) * Number(node.kernel?.heightSamples)).filter((taps) => Number.isSafeInteger(taps) && taps > 0)) : 1;\n const queriesPerSite = temporalSampleCount * (Math.ceil((FACADE_SPECTRAL_RANGE_NANOMETERS.maximum - FACADE_SPECTRAL_RANGE_NANOMETERS.minimum) / spectralStep) + 1) *\n (pupil ? pupil.radialSamples * pupil.angularSamples : 1) * psfTaps * (antiAliasing ? antiAliasing.components.length : 1) * boxSamples * boxSamples;\n\n // Scene and illuminant\n // The scene is the one required input: the facade never guesses what is being photographed.\n if (top.scene === undefined) fail(\"simulateCapture needs a scene, for example { preset: \\\"uniform\\\" } (an 18 % grey card) or { preset: \\\"slanted-edge\\\" }.\");\n const sceneOption = top.scene;\n requireInputObject(sceneOption, \"scene\");\n const illuminantOption = pick<CaptureIlluminant>(top, \"illuminant\", \"illuminant\", { kind: \"planckian\", temperatureKelvin: DEFAULTS.illuminantKelvin },\n \"Planckian (blackbody) 6500 K as a stand-in for daylight. CIE D65 is not bundled; pass its S0/S1/S2 basis as a daylight illuminant to use it.\");\n const illuminant = resolveCaptureIlluminant(illuminantOption);\n const illuminanceLux = positive(pick(top, \"illuminanceLux\", \"illuminanceLux\", SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX,\n \"π·10·N²/(0.65·t·S·0.18) lux at f/8, 1/125 s, ISO 100 (CIPA DC-004 standard output sensitivity H = 10/S and camera equation H = 0.65·L·t/N²): an 18 % grey card then gets the reference exposure for the default settings. It does not follow the caller's exposure settings.\"), \"illuminanceLux\");\n const irradianceScale = calculateIlluminantIrradianceScale(illuminant.shape, illuminanceLux);\n let chart: ResolvedChartScene | undefined, callerScene: CallerReflectanceScene | CallerRadianceScene | undefined;\n const sceneRecord = sceneOption as Record<string, unknown>;\n if (\"kind\" in sceneRecord) {\n callerScene = requireCallerScene(sceneOption);\n } else {\n chart = resolveChartScene({ scene: sceneOption as ChartScene, aspect: chartSize ? chartSize.heightM / chartSize.widthM : aspect });\n // Composite charts (2.3) report nested defaults by dotted path, for example \"elements.2.parameters.cycles\".\n const parameterAt = (key: string): unknown => key in chart!.parameters ? chart!.parameters[key] :\n key.split(\".\").reduce<unknown>((value, part) => (value as Record<string, unknown> | undefined)?.[part], chart!.parameters);\n for (const key of chart.defaultedParameters) assume(\"scene.\" + key, \"default\", parameterAt(key), \"Chart default for \" + chart.preset + \".\");\n }\n const scenePreset = chart ? chart.preset : callerScene!.kind;\n // Caller spectra enter the digest as data (see spectrumDigestForm). Without caller spectra the description is unchanged,\n // so default captures keep their digests.\n const illuminantRecord = typeof illuminantOption === \"object\" ? illuminantOption as { kind?: unknown; basis?: { datasetId?: unknown } } : undefined;\n const illuminantSpectrum = illuminantRecord?.kind === \"spectrum\" ? { spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } :\n illuminantRecord?.kind === \"daylight\" ? { basisDatasetId: illuminantRecord.basis?.datasetId, spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } : undefined;\n const materialInputs = chart ? chartMaterialInputs(chart) : [];\n const sceneSpectra = chart ? chart.materials.flatMap((m, index) => m.kind !== \"spectrum\" ? [] : [{ material: index, spectrum: spectrumDigestForm(materialInputs[index], m.spectrum) }]) : [];\n const sceneDescription = { facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, scene: chart ? { preset: chart.preset, parameters: chart.parameters } :\n { kind: callerScene!.kind, sceneId: callerScene!.sceneId }, illuminant: illuminant.id, illuminanceLux, subjectDistanceM, framedWidthM: 2 * metresPerFrameUnit, aspect,\n ...(chartSize ? { chartSize: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}),\n ...(illuminantSpectrum === undefined ? {} : { illuminantSpectrum }), ...(sceneSpectra.length === 0 ? {} : { sceneSpectra }) };\n if (callerScene) assume(\"scene.digest\", \"model\", \"caller-function-not-hashed\", \"The source digest covers the caller's sceneId and the framing, not the body of the caller's evaluate function.\");\n const sourceSha256 = await sha256Hex(JSON.stringify(sceneDescription, (_key, value: unknown) => (typeof value === \"object\" && value !== null && \"evaluate\" in value ? \"caller-spectrum\" : value)));\n checkAbort();\n const provider: PlanarSceneRadianceProvider = buildPlanarSceneRadianceProvider({ scene: chart ?? callerScene!, sceneId: IDS.scene, providerProfileId: IDS.provider,\n illuminant, irradianceScale, geometry: { distanceM: subjectDistanceM, metresPerFrameUnit,\n ...(chartSize ? { chart: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}) }, evidence: FACADE_EVIDENCE,\n limitations: [\"Planar Lambertian scene under uniform illumination; no shadows, inter-reflection, gloss or fluorescence.\"] });\n assume(\"model.scene-radiometry\", \"model\", \"lambertian-plane\", \"Radiance = reflectance × irradiance / π on one plane; illuminance from K_m = 683 lm/W and the engine's analytic CIE 1931 ȳ fit.\");\n\n // Metering (CIPA DC-004 standard output sensitivity and camera equation) and exposure-mode resolution\n const exposureOptions = allowKeys(top.exposure, \"exposure\", [\"mode\", \"iso\", \"shutterSeconds\", \"compensationStops\"]);\n const mode = pick<SimulateCaptureExposureMode>(exposureOptions, \"mode\", \"exposure.mode\", \"manual\", \"Manual exposure.\");\n if (![\"manual\", \"aperture-priority\", \"shutter-priority\", \"program\"].includes(mode)) fail(\"Unknown exposure mode.\");\n const iso = positive(pick(exposureOptions, \"iso\", \"exposure.iso\", DEFAULTS.iso, \"ISO 100, the tiers' base ISO.\"), \"exposure.iso\");\n const compensation = exposureOptions.compensationStops === undefined ? DEFAULTS.compensationStops : exposureOptions.compensationStops;\n if (typeof compensation !== \"number\" || !Number.isFinite(compensation) || Math.abs(compensation) > 10) fail(\"exposure.compensationStops must be within ±10.\");\n if (exposureOptions.compensationStops === undefined) assume(\"exposure.compensationStops\", \"default\", 0, \"No exposure compensation.\");\n const reference = { aperture: DEFAULTS.fNumber, shutterSeconds: DEFAULTS.shutterSeconds, iso: DEFAULTS.iso };\n const referenceLuminance = sosReferenceLuminance(reference.aperture, reference.shutterSeconds, reference.iso);\n assume(\"exposure.referenceExposure\", \"model\", { ...reference, meteredLuminanceCdPerSquareMeter: referenceLuminance },\n \"Exposure anchor: f/8, 1/125 s, ISO 100 gives the CIPA DC-004 standard output sensitivity reference exposure H = 10/S = 0.1 lx·s for an average scene luminance of 10·N²/(0.65·t·S) ≈ 1230.77 cd/m² (camera equation H = 0.65·L·t/N²).\");\n const meterProfile = body.metering[0]!.profile, zones = 16, zoneSamples = [];\n let luminanceSum = 0;\n for (let j = 0; j < zones; j++) for (let i = 0; i < zones; i++) {\n const u = -1 + (i + 0.5) * 2 / zones, v = aspect - (j + 0.5) * 2 * aspect / zones;\n const luminance = luminanceOf((nm) => provider.radianceAt(u, v, nm));\n luminanceSum += luminance;\n zoneSamples.push({ sampleId: \"zone-\" + i + \"-\" + j, positionOrientedCaptureUv: { u: (i + 0.5) / zones, v: (j + 0.5) / zones },\n relativeLinearSignal: meterProfile.target.targetRelativeSignal * luminance / referenceLuminance, areaWeight: 1 });\n }\n const meteredLuminance = luminanceSum / (zones * zones);\n assume(\"exposure.metering\", \"model\", { policy: meterProfile.policy.kind, zones: zones * zones },\n \"The body's \" + meterProfile.policy.kind + \" meter reads scene luminance on a 16 × 16 zone grid, before the lens (no lens transmission, vignetting or flare).\");\n const meterResult = meterRelativeExposure({ profile: meterProfile, sampleSet: { measurementId: \"facade-meter\", sceneStateId: IDS.sceneState,\n inputDomain: \"relative-pre-exposure-linear-signal\", captureRegion: \"oriented-active-capture\", captureGeometry: resolvedGeometry,\n processingState: { exposureSettingsApplied: false, whiteBalanceApplied: false, toneMappingApplied: false, displayGammaApplied: false, sharpeningApplied: false },\n samples: zoneSamples } });\n let target = createExposureMeterTargetFromMeteringResult({ targetId: \"facade-target\", meterResult: meterResult.value });\n if (compensation !== 0) target = setExposureCompensationOnMeterTarget({ targetId: \"facade-target-ec\", baseTarget: target, exposureCompensationStops: compensation });\n let resolution: { status: string; resolvedSettings?: { aperture?: number; shutterSeconds?: number; iso?: number } };\n let fNumber: number, shutterSeconds: number;\n if (mode === \"manual\" || mode === \"aperture-priority\") {\n fNumber = positive(pick(lensOptions, \"fNumber\", \"lens.fNumber\", DEFAULTS.fNumber, \"f/8.\"), \"lens.fNumber\");\n if (prime && (fNumber < prime.widestFNumber || fNumber > prime.narrowestFNumber))\n fail(\"lens.fNumber \" + fNumber + \" is outside the \" + prime.lensId + \" range f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber + \".\");\n } else {\n if (lensOptions.fNumber !== undefined) fail(\"lens.fNumber is resolved automatically in \" + mode + \" mode; omit it.\");\n fNumber = NaN;\n }\n if (mode === \"manual\" || mode === \"shutter-priority\") {\n shutterSeconds = positive(pick(exposureOptions, \"shutterSeconds\", \"exposure.shutterSeconds\", DEFAULTS.shutterSeconds, \"1/125 s.\"), \"exposure.shutterSeconds\");\n } else {\n if (exposureOptions.shutterSeconds !== undefined) fail(\"exposure.shutterSeconds is resolved automatically in \" + mode + \" mode; omit it.\");\n shutterSeconds = NaN;\n }\n if (mode === \"manual\") {\n resolution = resolveManualExposureMode({ target, capabilities, referenceExposure: reference, manualAperture: fNumber, manualShutterSeconds: shutterSeconds,\n isoControl: { kind: \"manual\", iso } });\n } else if (mode === \"aperture-priority\") {\n resolution = resolveAperturePriorityExposureMode({ target, capabilities, referenceExposure: reference, manualAperture: fNumber, manualIso: iso,\n shutterQuantizationPolicy: \"nearest-log2-shorter-on-tie\" });\n } else if (mode === \"shutter-priority\") {\n resolution = resolveShutterPriorityExposureMode({ target, capabilities, referenceExposure: reference, manualShutterSeconds: shutterSeconds,\n isoControl: { kind: \"manual\", iso, apertureQuantizationPolicy: \"nearest-log2-narrower-on-tie\" } });\n } else {\n assume(\"exposure.programLine\", \"model\", \"facade-generic-program-line\", \"Engine-authored generic program line (f/16 1/2000 s … f/8 1/125 s … f/4 1.024 s); not a manufacturer program.\");\n resolution = resolveProgramAutoExposureMode({ target, capabilities, referenceExposure: reference, programLine: defaultProgramLine(), isoControl: { kind: \"manual\", iso } });\n }\n if (resolution.status !== \"resolved\" || !resolution.resolvedSettings) fail(\"Exposure could not be resolved (\" + resolution.status + \"); the scene may have no signal.\");\n fNumber = resolution.resolvedSettings.aperture ?? fNumber;\n shutterSeconds = resolution.resolvedSettings.shutterSeconds ?? shutterSeconds;\n const resolvedIso = resolution.resolvedSettings.iso ?? iso;\n\n // Sensor readout for the ISO setting. Standard output sensitivity S = 10/H (CIPA DC-004 §3.2) is defined at the\n // output, independent of pixel size, while the collected charge is proportional to the sensitive-aperture area\n // (EMVA 1288 Release 4.0, Eq. 3). The tier's signal chain is anchored to the 6 µm aperture; at another area the\n // charge-domain readout scales with the area so the same H gives the same code. At 6 µm nothing is changed.\n const areaScale = pitch * pitch / ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS;\n const regimeByChannel = {} as Record<Channel, { readoutProfile: ReadoutProfile; regimeId: string }>;\n for (const channel of CHANNELS) {\n const asset = body.readout.find((a) => a.profile.channelId === channel) ?? fail(\"Camera readout lacks channel \" + channel + \".\");\n const chain = resolveGenericIsoSignalChain({ profile: body.signalChain, isoCapability: body.iso, requestedIsoSetting: { kind: \"standard\", exposureIndex: resolvedIso },\n captureModeId: IDS.mode, readoutProfile: asset.profile });\n regimeByChannel[channel] = { readoutProfile: areaScale === 1 ? asset.profile : isoAreaScaledReadout(asset.profile, areaScale), regimeId: chain.readout.regime.regimeId };\n }\n const capacityRegimes = (areaScale === 1 ? body.readout[0]!.profile : isoAreaScaledReadout(body.readout[0]!.profile, areaScale)).regimes;\n const baseRegime = capacityRegimes[0]! as unknown as { preAdcSaturationElectronEquivalent: { value: number } };\n const capacityElectrons = Math.max(...capacityRegimes.map((r) => (r as unknown as { preAdcSaturationElectronEquivalent: { value: number } }).preAdcSaturationElectronEquivalent.value),\n baseRegime.preAdcSaturationElectronEquivalent.value);\n assume(\"sensor.capacityElectrons\", \"derived\", capacityElectrons, \"Physical charge capacity set to the body's largest declared pre-ADC saturation (its base-ISO saturation signal), so storage never clips before the declared readout white.\");\n if (areaScale !== 1) {\n assume(\"sensor.isoAreaNormalization\", \"model\", { referenceApertureAreaSquareMicrometers: ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS,\n apertureAreaSquareMicrometers: pitch * pitch, areaScale },\n \"Approximation. The tier's ISO signal chain is declared for a 6 µm square aperture. Standard output sensitivity S = 10/H (CIPA DC-004-2020 §3.2) is defined at the output, \" +\n \"independent of pixel size, and the collected charge is proportional to the aperture area (EMVA 1288 Release 4.0, Eq. 3), so the system conversion gain (e⁻ per code) and the \" +\n \"pre-ADC saturation of every ISO regime are multiplied by area / 36 µm² = \" + areaScale + \". The same exposure gives the same output code at any pitch; per-pixel shot-noise SNR \" +\n \"falls with smaller pixels. Read noise and dark current stay per pixel in electrons. The charge capacity follows the scaled base-ISO saturation, so it is proportional to \" +\n \"the aperture area: a design consequence of holding the tier's ISO rating and highlight headroom fixed, not a measured full-well model (published sensor data grow less than \" +\n \"proportionally with area across technologies).\");\n }\n // Whole-frame views (2.5): a pitch above 100 µm is larger than any camera photosite, so the capture is a downsized view of a frame width × pitch wide.\n if (pitch > SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS) {\n assume(\"sensor.wholeFrameView\", \"model\", { pixelPitchMicrometers: pitch, frameWidthMm: width * pitch / 1000, frameHeightMm: height * pitch / 1000 },\n \"A pixel pitch above 100 µm is larger than any camera photosite, so each output pixel stands for a \" + pitch + \" µm square of a \" + width * pitch / 1000 + \" × \" + height * pitch / 1000 +\n \" mm frame: a downsized view of the whole frame, with the framing, crop factor, generic prime and minimum focus of that frame. Its signal is the charge of the whole square \" +\n \"(sensor.isoAreaNormalization), so its shot noise is that of all the real photosites in the square summed or averaged (Poisson counts add), and the image brightness is the \" +\n \"same as at any other pitch. Read noise and dark current are applied once per output pixel, not once per real photosite, so in deep shadows the noise is lower than a real \" +\n \"sensor's binned output. This is the noise of a binned, downsized view, not the real sensor's per-pixel noise. A point pixel aperture samples one point of each square; \" +\n \"use sensor.pixelAperture box (or sensor.antiAliasing) to average scene detail finer than the pitch.\");\n }\n assume(\"sensor.darkCurrent\", \"model\", { electronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND, temperatureC: OPERATING_TEMPERATURE_C },\n \"Synthetic uniform dark current of 1 e⁻/s per site at 20 °C (the tier presets declare none); dark shot noise follows from it.\");\n assume(\"sensor.spectralResponse\", \"model\", { kind: \"colorimetric-cmf-eqe\", peakScale: EQE_SCALE },\n \"Idealized colorimetric sensor: channel EQE = a·{x̄, ȳ, z̄}(λ)·555/λ (the engine's analytic CIE 1931 fit), so RAW channels are proportional to CIE XYZ (Luther–Ives) and the camera matrix is diagonal. Not a real camera's response; CMF air wavelengths are used as vacuum wavelengths (difference about 0.03 %).\");\n if (boxAperture) {\n assume(\"sensor.pixelAperture\", \"model\", { kind: \"box\", samplesPerAxis: boxSamples, fillFactor: 1 },\n \"Each site integrates the irradiance uniformly over its square photosite (fill factor 1; the environment's uniform geometric-aperture response) with a \" + boxSamples + \" × \" + boxSamples +\n \" midpoint rule (spatialSampleCountX/Y). The ideal box aperture of width p has the pixel MTF |sinc(f·p)| = |sin(πfp)/(πfp)|; the midpoint rule gives |sin(πfp)/(N·sin(πfp/N))| \" +\n \"instead, within 3 % of it below the Nyquist frequency 1/(2p) for N ≥ 4, with the same zeros at multiples of 1/p except at multiples of N/p, where scene detail still aliases. \" +\n \"No microlens, carrier diffusion or crosstalk. The scene queries are multiplied by \" + boxSamples * boxSamples + \".\");\n }\n if (!antiAliasing) assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens or anti-aliasing filter.\");\n else {\n assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens.\");\n assume(\"sensor.antiAliasing\", \"model\", { kind: antiAliasing.kind, ...(antiAliasing.axis ? { axis: antiAliasing.axis } : {}),\n ...(antiAliasing.separationSites === undefined ? {} : { separationSites: antiAliasing.separationSites, separationMicrometers: antiAliasing.separationSites * pitch }),\n components: antiAliasing.components },\n \"Optical low-pass (anti-aliasing) filter as a normalized point-splitting kernel in the sensor optical stack (resolveAntiAliasingSpatialKernel): every site integrates the light that would \" +\n \"otherwise land at its centre minus each offset, weighted. \" + (antiAliasing.kind === \"point-splitting\" ? \"Caller-declared components. \" :\n \"This is the ideal birefringent \" + (antiAliasing.kind === \"four-spot\" ? \"two-plate (crossed) splitter: four equal spots at (±d/2, ±d/2), MTF |cos(π·f_x·d)·cos(π·f_y·d)|\" :\n \"single-plate splitter: two equal spots at ±d/2 along the \" + antiAliasing.axis + \" axis, MTF |cos(π·f·d)|\") + \", d = \" + antiAliasing.separationSites + \" site(s); first zero at f = 1/(2d). \") +\n \"Approximations: the split is the same at every wavelength, field point and polarization (birefringence dispersion and the thickness-dependent displacement are not modelled), the spots are exact points with equal weights for unpolarized light, \" +\n \"and the filter's transmission, reflections and focus shift are not modelled. Not a measured filter; the tier presets declare none. The scene queries are multiplied by \" + antiAliasing.components.length + \".\");\n }\n // Shutter (2.0): the electronic rolling-shutter schedule derived from the body's rolling readout declaration.\n let rollingSchedule: ElectronicRollingShutterExposureSchedule | undefined;\n if (shutterKind === \"rolling\") {\n const declared = (body as { rollingReadoutTiming?: { profile: unknown } }).rollingReadoutTiming?.profile as Parameters<typeof resolveElectronicRollingShutterExposureSchedule>[0][\"readout\"] | undefined;\n if (!declared || declared.readoutMode !== \"rolling\") fail(\"motion.shutter \\\"rolling\\\" needs a camera body with a rolling readout timing declaration.\");\n const readout = rollingSkewOption === undefined ? declared : { ...declared, spatialSamplingSkewSeconds: { value: rollingSkewOption, unit: \"s\" as const, evidence: FACADE_EVIDENCE } };\n rollingSchedule = resolveElectronicRollingShutterExposureSchedule({ readout, linkageEvidence: FACADE_EVIDENCE,\n nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\", evidence: FACADE_EVIDENCE } });\n assume(\"sensor.shutter\", \"model\", { kind: \"electronic-rolling\", modelId: rollingSchedule.modelId, modelVersion: rollingSchedule.modelVersion,\n lineScanSkewSeconds: rollingSchedule.lineScanSkewSeconds, scanDirection: readout.scanDirectionNative.value },\n \"Electronic rolling shutter (line reset/read linkage): a site at normalized scan position s integrates over [s·τ, s·τ + T]. \" +\n (rollingSkewOption === undefined ? \"τ is the body's declared full-frame data-readout skew, applied unchanged across the simulated frame (it is not scaled to the cropped sensor), so a small frame shows the skew of a full-sensor readout.\" :\n \"τ is the caller-declared skew across the simulated frame.\"));\n } else assume(\"sensor.shutter\", \"model\", \"global-electronic\", \"Global electronic shutter: every site integrates the same exposure window.\");\n if (rotating) assume(\"motion.angularVelocityRadPerSec\", \"model\", { ...angular },\n \"Constant camera angular velocity applied to every scene ray at each temporal midpoint of each site's exposure window (engine rotation convention, docs/SENSOR_ENVIRONMENT_QUERY.md); motion blur is the midpoint quadrature over sensor.temporalSampleCount samples.\");\n if (lensPsf) assume(\"lens.psf\", \"model\", { kind: \"sampled-local\" }, \"Caller-supplied sampled lens PSF redistributes irradiance through the environment PSF quadrature; its evidence and limits are the caller's.\");\n // With lens.diffraction the PSF is recorded as lens.diffraction once its kernels are built.\n else if (diffractionRadiusOption === undefined) assume(\"lens.psf\", \"model\", \"not-applied\", \"No lens PSF or diffraction blur is applied (point optics); the generic tiers' optical data are declared only at f/4.\");\n assume(\"lens.transmission\", \"model\", lens.matchedReference.transmission,\n \"The tier lens's spectrally flat transmission is used at every f-number and focus in the lens capability; the tier declares it only at its f/4, 5 m reference state.\");\n if (!vignetting && !lensFieldMapping) assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, distortion, lateral colour or stray light.\");\n else {\n if (vignetting) assume(\"lens.vignetting\", \"model\", { kind: \"radial-illumination-vignetting\", profile: vignetting },\n \"Caller-declared radial relative illumination 1 + r2·ρ² + r4·ρ⁴ + r6·ρ⁶, applied once as environment field throughput at the physical sensor point before any PSF.\");\n else assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, lateral colour or stray light.\");\n if (distortion) assume(\"lens.distortion\", \"model\", distortion,\n \"Caller-declared \" + distortion.kind + \" distortion: each sensor point is inverse-distorted before the scene-ray query and irradiance is multiplied exactly once by the area factor 1/det(J).\");\n }\n if (projection === undefined) assume(\"lens.projection\", \"default\", \"rectilinear\", \"Ideal rectilinear (pinhole) projection.\");\n else assume(\"lens.projection\", \"model\", projection, \"Ideal \" + projection + \" projection through the environment lens field mapping. At finite focus its scale is the thin-lens image distance (an approximation); the chart is still sized with the rectilinear thin-lens scale, so its edges move with the projection.\");\n\n // White balance\n let whiteBalanceState: ResolvedWhiteBalanceState | null = null, needsAuto = false;\n if (whiteBalanceOption === \"none\") whiteBalanceState = null;\n else if (whiteBalanceOption === \"auto\") {\n if (region) fail(\"output.region cannot be combined with output.whiteBalance \\\"auto\\\": grey-world statistics of a region differ from the whole frame's.\");\n needsAuto = true;\n }\n else if (whiteBalanceOption === \"scene-illuminant\") {\n const xyz = illuminantXyz(illuminant), camera = XYZ_TO_CAMERA.map((row) => row[0] * xyz[0] + row[1] * xyz[1] + row[2] * xyz[2]);\n whiteBalanceState = resolveCustomWhiteBalance({ stateId: \"facade-wb-scene-illuminant\", sampleSet: { imageStateId: \"facade-white-diffuser\",\n inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples: [{ sampleId: \"white\", red: camera[0]!, green: camera[1]!, blue: camera[2]!, weight: 1, clipped: false }] } });\n } else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"kelvin\" in whiteBalanceOption) {\n const wb = allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"kelvin\", \"tint\"]);\n const intent = createColorTemperatureWhiteBalanceIntent({ intentId: \"facade-wb-cct\", colorTemperatureKelvin: positive(wb.kelvin, \"output.whiteBalance.kelvin\"),\n tint: wb.tint === undefined ? 0 : wb.tint as number });\n whiteBalanceState = resolveColorTemperatureWhiteBalance({ stateId: \"facade-wb-cct\", intent, whiteLocus: \"planckian\", tintInterpretation: \"duv-cie-1960-uv\",\n camera: { profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, xyzToCameraRgb: XYZ_TO_CAMERA.map((r) => [...r]) as unknown as Parameters<typeof resolveColorTemperatureWhiteBalance>[0][\"camera\"][\"xyzToCameraRgb\"] } });\n } else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"channelGains\" in whiteBalanceOption) {\n allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"channelGains\"]);\n requireInputObject(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\");\n allowKeys(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\", [\"red\", \"green\", \"blue\"]);\n whiteBalanceState = resolveManualWhiteBalance({ stateId: \"facade-wb-manual\", channelGains: whiteBalanceOption.channelGains });\n } else fail(\"Unknown output.whiteBalance.\");\n const intentOf = (state: ResolvedWhiteBalanceState | null): CaptureWhiteBalanceIntent | null => (state ? createCaptureWhiteBalanceIntent({ state }) : null);\n\n const rendering: SdrRenderingProfile = { schemaVersion: \"0.1.0\", profileId: \"facade-sdr\", profileVersion: \"1\", renderingExposureEv: 0, toneCurve,\n ...(outputOptions.toneCurveParameters === undefined ? {} : { toneCurveParameters: outputOptions.toneCurveParameters as SdrToneCurveParameters }),\n gamutHandling: \"clip-components\", outputDynamicRange: \"sdr\", transferFunction: \"srgb\", bitDepth: format === \"srgb-16\" || (format === \"png\" && !wideGamut && pngBitDepth === 16) ? 16 : 8, rounding: \"nearest-ties-up\", dither: \"none\" };\n if (!linearPath) assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components\" },\n \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no exposure push, out-of-gamut components clipped.\");\n else assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components-in-target-gamut\", sdrRendererUsed: false },\n \"The sRGB SDR renderer is not used: the linear development (RAW white level = relative 1.0, no exposure push) is converted to the target encoding; request.development.rendering is validated but only its exposure and tone curve (identity) apply.\");\n // Rendering choices are validated before any radiance work, so a bad tone curve fails fast.\n parseSdrRenderingProfile(rendering);\n if (highlightMode !== \"clip\" && highlightMode !== \"reconstruct\") fail(\"output.highlightMode must be clip or reconstruct.\");\n\n // Frame profiles\n const evidence = FACADE_EVIDENCE;\n const nativeRaster = { pixelWidth: nativeWidth, pixelHeight: nativeHeight };\n const captureModeProfile = { schemaVersion: \"0.1.0\" as const, modes: [{ modeId: IDS.mode, evidence, acquisition: { kind: \"single-frame\" as const },\n perFrameSampling: { kind: \"native-effective-raster\" as const }, reconstructionStages: [], processedImageRaster: { value: nativeRaster, evidence },\n dependencies: [\"color-sampling-model\"] }] } as unknown as NativeRawInput[\"captureModeProfile\"];\n const bindingProfile = { schemaVersion: \"0.1.0\" as const, bindingId: IDS.binding, colorSamplingProfileId: IDS.cfa, nativeRaster, evidence,\n relationship: { kind: \"regular-native-effective-sample-blocks\" as const, sitesPerNativeSampleX: 1, sitesPerNativeSampleY: 1, anchor: \"shared-native-top-left\" as const } };\n const exposureWindow = rollingSchedule ? createRollingShutterCaptureExposureSchedule(rollingSchedule) as unknown as {\n shutterMechanism: \"electronic\"; nominalExposureDurationSeconds: { value: number; unit: \"s\"; evidence: readonly EvidenceProvenance[] };\n opening: { kind: \"simultaneous\" }; closing: { kind: \"simultaneous\" } } :\n { shutterMechanism: \"electronic\" as const, nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\" as const, evidence },\n opening: { kind: \"simultaneous\" as const }, closing: { kind: \"simultaneous\" as const } };\n const buildRawInput = (intent: CaptureWhiteBalanceIntent | null): NativeRawInput => buildRawInputFor(intent, geometry, captureModeProfile, bindingProfile, nativeWidth * nativeHeight);\n const buildRawInputFor = (intent: CaptureWhiteBalanceIntent | null, rasterGeometry: typeof geometry, modeProfile: NativeRawInput[\"captureModeProfile\"],\n binding: NativeRawInput[\"bindingProfile\"], sites: number): NativeRawInput => ({\n exposure: { captureId: IDS.capture, sceneStateId: IDS.sceneState, sceneTimeSeconds: 0, geometry: rasterGeometry,\n exposure: { focalLengthMm, aperture: fNumber, shutterSeconds, iso: resolvedIso }, focus: { kind: \"finite\", distanceM: focusDistanceM },\n noise: { seedUint32: noiseSeed, realizationId: \"facade-noise\", model: { ...SENSOR_RAW_PRODUCER_NOISE_MODEL } },\n source: { kind: \"scene-radiance-source\", artifactId: \"facade-scene-\" + scenePreset, sha256: sourceSha256, dynamicRangeHistory: \"no-loss-declared\" },\n whiteBalanceIntent: intent, adoptedWhiteXyz: null,\n models: [{ profile: { id: \"photivra-simulate-capture\", version: SIMULATE_CAPTURE_FACADE_VERSION }, scientificStatus: \"approximation\", publicEvidenceIds: [\"photivra:simulate-capture-facade\"] }] },\n frameId: IDS.frame, modeId: IDS.mode, captureModeProfile: modeProfile, colorSamplingProfile, bindingProfile: binding, exposureWindow,\n maximumOutputBytes: sites * 7, tileWidth, ...(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }) });\n const sceneBinding = { sceneStateId: IDS.sceneState, providerSceneId: IDS.scene, evidence };\n\n // Shared per-site environment pieces (identical objects for every site keep the native task's shared-state fast path).\n const range = { ...FACADE_SPECTRAL_RANGE_NANOMETERS };\n // EQE breakpoints coincide with the quadrature subintervals, so the quadrature is not split further.\n const eqeSpacing = (range.maximum - range.minimum) / Math.ceil((range.maximum - range.minimum) / spectralStep);\n const eqeSamples = (channel: Channel): { nm: number; value: number }[] => {\n const out: { nm: number; value: number }[] = [];\n for (let nm = range.minimum; nm <= range.maximum + 1e-9; nm += eqeSpacing) out.push({ nm, value: EQE_SCALE[channel] * estimateCie1931ColorMatchingFunctions(nm)[CMF_KEY[channel]] * 555 / nm });\n return out;\n };\n const operatingConditions = { temperatureC: 25, incidenceAngleDegreesFromNormal: 0, polarization: \"unpolarized\" as const };\n // One single-channel response profile per CFA channel keeps each site's response data small.\n const spectralResponseProfiles = Object.fromEntries(CHANNELS.map((only) => [only, { schemaVersion: \"0.1.0\" as const, profileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, evidence,\n channels: [only].map((channelId) => ({ channelId, kind: \"effective-external-quantum-efficiency\" as const, responseScope: \"sensor-package-incident-effective-channel-response\" as const,\n scientificStatus: \"approximation\" as const, uncertainty: { kind: \"not-quantified\" as const, limitation: \"Idealized colorimetric response; not a measured sensor.\" },\n evidence, referenceConditions: operatingConditions, conditionDependence: \"not-modeled\" as const, externalQuantumEfficiency: sampled(eqeSamples(channelId)) })) }])) as Record<Channel, unknown>;\n const apertureArea = pitch * pitch;\n const samplingApertureProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.sampling, colorSamplingProfileId: IDS.cfa, colorSamplingBindingId: IDS.binding, evidence,\n siteCenterLattice: { kind: \"regular-rectangular-site-center-lattice\" as const, coordinateSystem: \"native-sensor-physical\" as const, pitchXMicrometers: pitch, pitchYMicrometers: pitch,\n firstSiteCenterFromImagingAreaTopLeftMicrometers: { x: pitch / 2, y: pitch / 2 }, evidence },\n geometricSensitiveAperture: { kind: \"uniform-axis-aligned-rectangle\" as const, widthMicrometers: pitch, heightMicrometers: pitch, centerOffsetFromSiteCenterMicrometers: { x: 0, y: 0 }, evidence } };\n const stackId = antiAliasing ? IDS.stackAa : IDS.stack;\n const opticalStackProfile: SensorOpticalStackProfile = antiAliasing ? { schemaVersion: \"0.1.0\", profileId: stackId, evidence, effectiveAntiAliasingSpatialResponse: {\n kind: \"normalized-point-splitting-kernel\", evidence, coordinateSystem: \"native-sensor-physical\", scope: \"field-wavelength-polarization-invariant-approximation\",\n components: antiAliasing.components } } : { schemaVersion: \"0.1.0\" as const, profileId: IDS.stack, evidence, effectiveAntiAliasingSpatialResponse: { kind: \"absent\" as const, evidence } };\n const perChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, {\n applicationProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-application-\" + channelId, spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId,\n samplingApertureProfileId: IDS.sampling, opticalStackProfileId: stackId, evidence, incidentAreaBasis: { kind: \"geometric-sensitive-aperture\" as const, areaSquareMicrometers: apertureArea },\n spatialResponseModel: { kind: \"uniform-over-geometric-sensitive-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Uniform response over the square aperture.\" },\n referenceConditionPolicy: { kind: \"exact-match-required\" as const } },\n operatingRangeProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-linearity-\" + channelId, responseApplicationProfileId: \"facade-application-\" + channelId,\n spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Declared linear photo response for the idealized sensor.\" }, evidence,\n inputRange: { kind: \"wavelength-integrated-geometric-aperture-radiant-power\" as const, unit: \"W\" as const, minimumInclusive: 0, maximumInclusive: 1 },\n wavelengthApplicability: { wavelengthBasis: \"vacuum\" as const, minimumNanometers: range.minimum, maximumNanometers: range.maximum, containment: \"requested-range-must-be-contained\" as const },\n linearityCriterion: { maximumAbsoluteRelativeDeviation: 0.01 },\n spatialLinearityModel: { kind: \"linear-superposition-over-geometric-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared linear superposition.\" },\n spectralInputModel: { kind: \"per-spectral-bin\" as const, maximumBinWidthNanometers: Math.max(spectralStep, 20), scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared per-bin linearity.\" },\n referenceConditions: operatingConditions, referenceConditionPolicy: { kind: \"exact-match-required\" as const } } }])) as Record<Channel, { applicationProfile: unknown; operatingRangeProfile: unknown }>;\n const sourcePlane = { value: \"sensor-package-incident\" as const, evidence };\n const localExposure = { bindingProfile, exposureWindowInput: { ...exposureWindow, nativeRaster } };\n const sceneBindings = {\n illuminationProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.lights, sceneId: IDS.scene, evidence, sources: [{ sourceId: \"illuminant\", family: \"environment\" as const,\n enabled: true, geometry: { kind: \"environment\" as const }, magnitude: { kind: \"relative-linear-scale\" as const, scale: 1, scientificStatus: \"approximation\" as const,\n limitation: \"Absolute level is carried by the provider radiance (\" + illuminanceLux + \" lux).\" },\n spectrum: { kind: \"unresolved\" as const, limitation: \"Spectral radiance is supplied numerically by the provider (\" + illuminant.id + \").\" },\n temporalBehavior: { kind: \"time-invariant\" as const }, evidence }] },\n materialResponseProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.materials, sceneId: IDS.scene, evidence, materials: [{ materialResponseId: \"facade-surface\", evidence,\n representation: { kind: \"spectral-wavelength-preserving-data\" as const, dataArtifact: { id: \"facade-scene-\" + scenePreset, checksumSha256: sourceSha256 },\n wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range, scatteringModel: \"provider-defined-wavelength-preserving\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic Lambertian reflectance.\" }, wavelengthChangingBehaviorModeled: false, emissionModeled: false } }],\n fluorescenceModeled: false, volumetricMaterialTransportModeled: false, polarizationModeled: false },\n providerProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.provider, sceneId: IDS.scene, illuminationProfileId: IDS.lights, materialResponseProfileId: IDS.materials,\n outputQuantity: \"outgoing-spectral-radiance\" as const, outputUnit: \"W/m^2/sr/nm\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic planar scene.\" },\n fidelity: { spectral: \"wavelength-resolved\" as const, material: \"spectral-data\" as const, visibility: \"resolved\" as const, directTransport: \"approximation\" as const, indirectTransport: \"not-modeled\" as const },\n wavelengthChangingTransportModeled: false, volumetricTransportModeled: false, polarizationModeled: false, evidence, limitations: [\"Engine-authored planar chart or caller scene function.\",\n ...(diffractionObjectSpace ? [\"Radiance is the scene radiance convolved with the lens diffraction PSF mapped onto the scene plane (object-space convolution, request.diffraction).\"] : [])] } };\n const lensId = lensExposure.profileId;\n const opticsProfile = { schemaVersion: \"0.1.0\" as const, profileId: lensId + \":facade-transmission\", profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, lensProfileId: lensId,\n scientificStatus: \"approximation\" as const, applicability: { focalLengthMm: { minimum: capabilities.selectedFocalLengthMm, maximum: capabilities.selectedFocalLengthMm },\n nominalFNumber: { minimum: capabilities.aperture.widestAvailableFNumber, maximum: capabilities.aperture.narrowestAvailableFNumber }, focus: { kind: \"any\" as const } },\n transmission: { kind: \"spectral-transmission\" as const, scientificStatus: \"approximation\" as const, wavelengthBasis: \"vacuum\" as const,\n samples: { value: [{ wavelengthNanometers: range.minimum, linearTransmissionFactor: lens.matchedReference.transmission },\n { wavelengthNanometers: range.maximum, linearTransmissionFactor: lens.matchedReference.transmission }], evidence: preset.evidence },\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Synthetic spectrally flat transmission from the tier preset.\" } },\n distortionAreaMappingOwnership: \"not-applied-by-bridge\" as const, psfRedistributionOwnership: \"downstream-normalized-energy-redistribution\" as const,\n sensorOpticalStackIncluded: false, strayLightIncluded: false, polarizationModeled: false, wavelengthChangingBehaviorModeled: false, volumetricScatteringModeled: false,\n evidence: preset.evidence, limitations: [...lens.limitations, \"Flat transmission applied across the lens capability by the capture facade.\"] };\n const optics = { profile: opticsProfile, focalLengthMm, nominalFNumber: fNumber,\n focus: { kind: \"ideal-symmetric-thin-lens\" as const, objectDistanceM: focusDistanceM, pupilMagnificationAssumption: \"unity\" as const } };\n const motion = { angularVelocityRadPerSec: angular, timeReference: \"first-opening-boundary-phase\" as const, environmentDirectionConvention: \"outgoing-radiance-toward-camera\" as const };\n const fieldThroughput = vignetting ? { kind: \"radial-illumination-vignetting\" as const, profile: vignetting, evidence,\n limitation: \"Caller-declared radial relative illumination applied by the capture facade; not a measured lens.\" } :\n { kind: \"unity\" as const, evidence, limitation: \"No vignetting or field throughput loss applied by the facade.\" };\n const spectralSamplingByChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, { channelId, wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range,\n maximumSubintervalWidthNanometers: spectralStep }])) as Record<Channel, unknown>;\n // Diffraction (2.1): Airy kernels at the resolved f-number on the site pitch, one per spectral node of the sensor quadrature.\n let diffraction: DiffractionLimitedPsfProfile | undefined, diffractionPsf: typeof lensPsf | undefined;\n if (diffractionRadiusOption !== undefined) {\n const wavelengths = [...new Set(CHANNELS.flatMap((channelId) => calculateSensorSpectralQuadrature({ ...(spectralSamplingByChannel[channelId] as { channelId: string;\n wavelengthBasis: \"vacuum\"; wavelengthRangeNanometers: { minimum: number; maximum: number }; maximumSubintervalWidthNanometers: number }), colorSamplingProfile,\n spectralResponseProfile: spectralResponseProfiles[channelId] as never }).value.nodes.map((node) => node.wavelengthNanometers)))].sort((a, b) => a - b);\n const lambdaN = wavelengths[wavelengths.length - 1]! / 1000 * fNumber * imageDistanceMm / focalLengthMm;\n // The environment resolves the PSF at each pre-filter source point, up to the largest split offset outside the imaging area.\n const aaReachMm = antiAliasing ? Math.max(...antiAliasing.components.map((c) => Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)))) / 1000 : 0;\n // The default reach is capped at the 32-site convolution limit; a capped window ends inside the third dark ring, and the\n // larger tail energy outside it is listed per wavelength like any other (2.2.1 states the cap in the explanation).\n const thirdRingSites = Math.max(1, Math.ceil(AIRY_THIRD_ZERO_PER_LAMBDA_N * lambdaN / pitch));\n const kernelRadiusSamples = diffractionRadiusOption ?? Math.min(32, thirdRingSites);\n diffraction = createDiffractionLimitedPsfProfile({ aperture: \"circular\", focalLengthMm, apertureFNumber: fNumber, focus: { kind: \"finite\", distanceM: focusDistanceM },\n wavelengthsNm: wavelengths, samplePitchMicrometers: pitch, kernelRadiusSamples, fieldHalfExtentMm: aaReachMm === 0 ? { x: imagingArea.widthMm / 2, y: imagingArea.heightMm / 2 } :\n { x: imagingArea.widthMm / 2 + aaReachMm, y: imagingArea.heightMm / 2 + aaReachMm },\n profileId: \"facade-diffraction-airy\" }).value;\n diffractionPsf = { kind: \"sampled-local\", configuration: { psf: { profile: diffraction.profile, focalLengthMm, focus: { kind: \"finite\", distanceM: focusDistanceM },\n apertureFNumber: fNumber, signedDefocusImagePlaneMicrometers: 0 }, psfWavelengthBasis: { value: \"vacuum\", evidence },\n spatialModel: { kind: \"destination-local-shift-invariant-approximation\", evidence, limitation: \"Diffraction-limited Airy PSF, the same at every field point.\" } } };\n assume(\"lens.diffraction\", \"model\", { model: diffraction.model, aperture: \"circular-aperture\", fNumber, workingFNumber: diffraction.workingFNumber,\n kernelRadiusSamples, samplePitchMicrometers: pitch, maximumTruncatedEnergyFraction: diffraction.maximumTruncatedEnergyFraction,\n truncatedEnergyByWavelength: diffraction.wavelengths.map((w) => ({ wavelengthNm: w.wavelengthNm, truncatedEnergyFraction: w.truncatedEnergyFraction })),\n execution: diffractionObjectSpace ? \"object-space-convolution\" : \"environment-psf-quadrature\" },\n \"Scalar Fraunhofer diffraction of an ideal, aberration-free circular pupil (Airy pattern, createDiffractionLimitedPsfProfile) at the resolved f-number, in focus, with D = f/N and the thin-lens image distance (working f-number N·v/f). \" +\n \"One kernel per spectral node, binned into site-sized cells over a \" + (2 * kernelRadiusSamples + 1) + \" × \" + (2 * kernelRadiusSamples + 1) + \" window\" +\n (diffractionRadiusOption !== null ? \"\" : thirdRingSites > 32 ? \" (capped at 32 sites; the third dark ring at the longest node needs \" + thirdRingSites + \")\" :\n \" (reaching the third dark ring at the longest node)\") + \"; the Airy tail energy outside it (listed per wavelength) is put back by unit-sum renormalization. \" +\n (diffractionObjectSpace ? \"Applied as an object-space convolution: the scene radiance on the site lattice is convolved once per spectral node (calculateIrradianceConvolution) and the provider answers each site query with it, so the site inputs declare no PSF; this equals the per-tap environment PSF quadrature for this still, distortion-free planar scene (request.diffraction.psf). \" :\n \"Applied through the environment PSF quadrature (one scene query per kernel tap), because camera rotation, a lens field mapping or vignetting moves the taps off the site lattice. \") +\n \"No defocus, aberration or pupil clipping; \" + (boxAperture ? \"the pixel aperture is integrated as declared by sensor.pixelAperture.\" : \"the sensor pixel aperture is still point-sampled at the site centre.\"));\n }\n const psf = lensPsf ?? (diffractionObjectSpace ? { kind: \"not-applied\" as const, evidence,\n limitation: \"No environment PSF: lens diffraction is applied upstream by the scene provider as an object-space convolution (request.diffraction).\" } : undefined) ??\n diffractionPsf ?? { kind: \"not-applied\" as const, evidence, limitation: \"No lens PSF (point optics).\" };\n const pupilRecord = pupil ? { kind: \"ideal-uniform-circular-pupil\" as const, radialSampleCount: pupil.radialSamples, angularSampleCount: pupil.angularSamples, evidence,\n limitation: \"Ideal uniform circular pupil; finite ray sampling, no convergence claim.\" } : undefined;\n const chargeSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.chargeSampling, completenessProfileId: IDS.completeness, scientificStatus: \"approximation\" as const,\n photoShotNoiseModel: \"poisson\" as const, darkShotNoiseModel: \"poisson\" as const, additionalComponentPolicies: [], evidence, limitations: [\"Poisson photo and dark shot noise.\"] };\n const channelAt = (x: number, y: number): Channel => ([\"red\", \"green\", \"green\", \"blue\"] as const)[(y % 2) * 2 + (x % 2)]!;\n function siteInput(index: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number] {\n if (!Number.isSafeInteger(index) || index < 0 || index >= nativeWidth * nativeHeight) fail(\"Native site index out of range.\");\n const x = index % nativeWidth, y = Math.floor(index / nativeWidth), channel = channelAt(x, y), site = { x, y }, c = perChannel[channel], r = regimeByChannel[channel];\n const environment = { temporalIntegrationId: IDS.frame + \":native:\" + index,\n sensor: { spatialSampling: { imagingArea, samplingApertureProfile, opticalStackProfile, site, spatialSampleCountX: boxSamples, spatialSampleCountY: boxSamples },\n spectralSampling: spectralSamplingByChannel[channel], colorSamplingProfile, spectralResponseProfile: spectralResponseProfiles[channel],\n responseApplication: { applicationProfile: c.applicationProfile, sourcePlane, operatingConditions }, operatingRangeProfile: c.operatingRangeProfile, localExposure },\n sceneBindings, optics, motion, temporalSampleCount, fieldThroughput, psf, ...(pupilRecord ? { pupil: pupilRecord } : {}), ...(lensFieldMapping ? { lensFieldMapping } : {}) };\n // The charge completeness profile must cover the site's own exposure window (shifted by s·τ under a rolling shutter).\n const window = rollingSchedule ? calculateCaptureExposureWindows({ ...exposureWindow, nativeRaster, samplePointsNative: [{ x: x + 0.5, y: y + 0.5 }] }).value.samples[0]! :\n { startOffsetSecondsFromOpeningReference: 0, endOffsetSecondsFromOpeningReference: shutterSeconds };\n return { environment, operatingTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentProfile: { schemaVersion: \"0.1.0\", profileId: IDS.dark, colorSamplingProfileId: IDS.cfa, channelId: channel, scientificStatus: \"approximation\", evidence,\n uncertainty: { kind: \"not-quantified\", limitation: \"Synthetic dark current for the capture facade.\" }, chargeMeaning: \"pre-compensation-thermally-generated-electrons\",\n siteApplicability: { kind: \"exact-site\", site }, temperatureModel: { kind: \"fixed-reference-temperature\", referenceTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentElectronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND }, darkCurrentCompensationIncluded: false, spatialDarkCurrentNonuniformityModeled: false },\n charge: { completenessProfile: { schemaVersion: \"0.1.0\", profileId: IDS.completeness, colorSamplingProfileId: IDS.cfa, channelId: channel, site, bindingId: IDS.binding,\n timeReference: \"first-opening-boundary-phase\", startOffsetSecondsFromOpeningReference: window.startOffsetSecondsFromOpeningReference,\n endOffsetSecondsFromOpeningReference: window.endOffsetSecondsFromOpeningReference,\n darkCurrentProfileId: IDS.dark, includedAdditionalComponentIds: [], coverageMeaning: \"all-material-stored-electron-contributors-accounted-for\",\n scientificStatus: \"approximation\", evidence, limitation: \"Photo and dark charge only.\" } },\n readout: { samplingProfile: chargeSamplingProfile, capacityProfile: { schemaVersion: \"0.1.0\", profileId: IDS.capacity, colorSamplingProfileId: IDS.cfa, channelId: channel,\n capacityMeaning: \"physical-charge-storage-capacity-electrons\", capacityElectrons, scientificStatus: \"approximation\",\n uncertainty: { kind: \"not-quantified\", limitation: \"Derived from the tier's declared saturation signal.\" }, evidence, siteApplicability: { kind: \"exact-site\", site },\n operatingState: { stateId: IDS.operatingState, evidence }, temperatureApplicability: { kind: \"exact-reference-temperature\", temperatureC: OPERATING_TEMPERATURE_C } },\n operatingStateId: IDS.operatingState, readoutProfile: r.readoutProfile, regimeId: r.regimeId } } as unknown as SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n }\n const readTile = async (request: { captureId: string; frameId: string; x: number; y: number; width: number; height: number }): Promise<NativeEnvironmentRawTile> =>\n ({ ...request, sites: Array.from({ length: request.width }, (_, j) => siteInput(request.y * nativeWidth + request.x + j)) });\n const yieldControl = createHostYield().yieldControl;\n const perSite = queriesPerSite * (diffraction && psf === diffractionPsf ? (2 * diffraction.kernelRadiusSamples + 1) ** 2 : 1);\n let diffractionMs = 0, demosaicMs: number | undefined, encodeMs: number | undefined;\n const rawProvider = diffraction && diffractionObjectSpace ? createDiffractedPlanarProvider({ base: provider, psf: diffractionPsf!.configuration.psf,\n wavelengthsNm: diffraction.profile.axes.wavelengthNm, kernelRadius: diffraction.kernelRadiusSamples, nativeWidth, nativeHeight, outputWidth: width,\n sitePitchMicrometers: pitch, distanceM: subjectDistanceM, metresPerFrameUnit, onConvolution: (ms) => { diffractionMs += ms; },\n // The environment queries each site at each aperture node minus each split offset (sites, +x right, +y down).\n ...(antiAliasing || boxSamples > 1 ? { queryOffsetsSites: apertureNodeOffsets(boxSamples).flatMap((node) =>\n (antiAliasing ? antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 } }]).map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch }))) } : {}) }) : provider;\n if (antiAliasing && perSite > 100_000) fail(\"sensor.antiAliasing with these options needs \" + perSite + \" scene queries per site; the environment admits at most 100000.\");\n const evaluations = nativeWidth * nativeHeight * perSite;\n // The native task admits at most 100 000 radiance queries per tile.\n const tileWidth = Math.max(1, Math.min(256, Math.floor(100_000 / perSite)));\n const environmentRaw: NativeEnvironmentRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding,\n maximumProviderEvaluations: Math.min(nativeRawMaximumProviderEvaluations(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }),\n Math.max(nativeWidth * nativeHeight, evaluations)) };\n\n // Ideal reference (2.3): the scene without camera effects, at the capture's own exposure, white balance and encoding.\n if (idealReference) {\n const referenceStarted = clockMs();\n if (format !== \"srgb-8\" && format !== \"srgb-16\" && format !== \"png\") fail(\"simulateIdealReference supports output.format srgb-8, srgb-16 and png: a reference has no RAW (dng) and should not carry JPEG compression artefacts.\");\n if (needsAuto) fail(\"simulateIdealReference cannot reproduce output.whiteBalance \\\"auto\\\": the capture measures it from its noisy RAW. Use \\\"scene-illuminant\\\" or a fixed white balance.\");\n // 1. Electrons per unit spectral radiance at each spectral node, per channel: the facade's own environment chain at a\n // site next to the optical axis, with the ideal optics (no PSF, pupil, distortion, vignetting or motion). The signal\n // is linear in the radiance node values and, for this planar scene, the same at every site (paraxial π/(4N_w²)).\n const cx = Math.floor(nativeWidth / 2) & ~1, cy = Math.floor(nativeHeight / 2) & ~1;\n const channelSites: Record<Channel, number> = { red: cy * nativeWidth + cx, green: cy * nativeWidth + Math.min(cx + 1, nativeWidth - 1), blue: Math.min(cy + 1, nativeHeight - 1) * nativeWidth + Math.min(cx + 1, nativeWidth - 1) };\n const electronsPerRadiance = {} as Record<Channel, Map<number, number>>;\n for (const channel of CHANNELS) {\n if (channelAt(channelSites[channel] % nativeWidth, Math.floor(channelSites[channel] / nativeWidth)) !== channel) fail(\"simulateIdealReference needs at least a 2 × 2 native raster.\");\n const environment = { ...(siteInput(channelSites[channel]).environment as unknown as Record<string, unknown>) };\n environment.psf = { kind: \"not-applied\", evidence, limitation: \"Ideal reference: no lens PSF.\" };\n environment.fieldThroughput = { kind: \"unity\", evidence, limitation: \"Ideal reference: no vignetting.\" };\n environment.motion = { ...motion, angularVelocityRadPerSec: { pitch: 0, yaw: 0, roll: 0 } };\n environment.temporalSampleCount = 1;\n delete environment.pupil;\n delete environment.lensFieldMapping;\n const electrons = (radiance: (nm: number) => number): number => (calculateEnvironmentSensorPhotoSignal({ ...environment,\n evaluateRadiance: (request: Readonly<SceneRadianceEvaluationRequest>) => ({ ...provider.evaluateRadiance(request), spectralRadianceWattsPerSquareMeterSteradianNanometer: radiance(request.wavelengthNanometers) })\n } as unknown as Parameters<typeof calculateEnvironmentSensorPhotoSignal>[0]).value as unknown as { photo: { value: { photoSignal: { expectedGeneratedElectronCount: number } } } })\n .photo.value.photoSignal.expectedGeneratedElectronCount;\n const nodes = new Set<number>();\n electrons((nm) => { nodes.add(nm); return 1; });\n electronsPerRadiance[channel] = new Map([...nodes].sort((a, b) => a - b).map((node) => [node, electrons((nm) => (nm === node ? 1 : 0))]));\n }\n const wavelengths = [...new Set(CHANNELS.flatMap((c) => [...electronsPerRadiance[c].keys()]))].sort((a, b) => a - b);\n // 2. Electrons → normalized RAW signal: (code − black)/(white − black) = e·d/(G·(W − B)) for the linear readout\n // (conversion gain G e⁻/DN, digital gain d, black B, effective white W of the capture's readout regime).\n const relativePerElectron = {} as Record<Channel, number>;\n for (const channel of CHANNELS) {\n const { readoutProfile, regimeId } = regimeByChannel[channel];\n const regime = resolveSensorReadoutRegime({ profile: readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId }).regime;\n const gain = regime.systemConversionGainElectronsPerCode.value, digitalGain = regime.adc.digitalGain ?? 1, black = regime.adc.blackLevelCode;\n const white = calculateSiteEffectiveSaturationCode({ physicalChargeCapacityElectrons: capacityElectrons, preAdcSaturationElectronEquivalent: regime.preAdcSaturationElectronEquivalent.value,\n systemConversionGainElectronsPerCode: gain, blackLevelCode: black, digitalSaturationCode: regime.adc.digitalSaturationCode, adcMaximumCode: 2 ** regime.adc.bitDepth - 1, digitalGain },\n readoutProfile as Parameters<typeof calculateSiteEffectiveSaturationCode>[1], regimeId);\n relativePerElectron[channel] = digitalGain / (gain * (white - black));\n }\n // 3. Scene radiance per sample: chart materials once (and the fixed-size chart's surround), caller functions per sample.\n const signalOf = (radiance: (nm: number) => number): [number, number, number] => {\n const values = new Map(wavelengths.map((nm) => [nm, radiance(nm)]));\n return CHANNELS.map((c) => { let e = 0; for (const [nm, a] of electronsPerRadiance[c]) e += a * values.get(nm)!; return e * relativePerElectron[c]; }) as [number, number, number];\n };\n const materialSignals = provider.chartMaterialAt ? Array.from({ length: chart!.materials.length + (chartSize ? 1 : 0) }, (_, m) => signalOf((nm) => provider.materialRadiance!(m, nm))) : undefined;\n // 4. Pixels: the native sites of the output (or region) pixels, each centre-sampled or box-integrated like the capture.\n const x0 = (region ? region.x : 0) + margin, y0 = (region ? region.y : 0) + margin, n = boxSamples, unit = 2 / width;\n const referenceIntent = intentOf(whiteBalanceState), referenceGains = referenceIntent ? [referenceIntent.channelGains.red, referenceIntent.channelGains.green, referenceIntent.channelGains.blue] : null;\n const development = prepareSensorColorDevelopment(CAMERA_TO_XYZ as unknown as Parameters<typeof prepareSensorColorDevelopment>[0],\n referenceGains, highlightMode);\n const rgb = new Float64Array(outputWidth * outputHeight * 3), counts = { whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 }, sum = [0, 0, 0];\n for (let py = 0; py < outputHeight; py++) {\n for (let px = 0; px < outputWidth; px++) {\n sum[0] = 0; sum[1] = 0; sum[2] = 0;\n for (let l = 0; l < n; l++) for (let k = 0; k < n; k++) {\n const u = (x0 + px + (k + 0.5) / n - nativeWidth / 2) * unit, v = -(y0 + py + (l + 0.5) / n - nativeHeight / 2) * unit;\n const s = materialSignals ? materialSignals[provider.chartMaterialAt!(u, v)]! : signalOf((nm) => provider.radianceAt(u, v, nm));\n sum[0] += s[0]; sum[1] += s[1]; sum[2] += s[2];\n }\n // Normalized RAW values saturate at the white level, as in development.\n const c = sum.map((value) => Math.min(1, Math.max(0, value / (n * n))));\n development.developInto(c[0]!, c[1]!, c[2]!, rgb, (py * outputWidth + px) * 3, counts);\n }\n if ((py & 15) === 15) { await yieldControl(); checkAbort(); }\n }\n let samples: Uint8Array | Uint16Array;\n if (!linearPath) {\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n samples = rendering.bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n const sdrCounts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, samples, y * outputWidth * 3, scratch, sdrCounts);\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n samples = encodeSdrFromLinear(rgb, colorEncoding!, pngBitDepth!, mapping).samples;\n }\n const encodedPng = format === \"png\" ? serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }) : undefined;\n const png = encodedPng && textMetadata ? addPngTextMetadata(encodedPng, textMetadata) : encodedPng;\n if (png) assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n const referenceMs = clockMs() - referenceStarted;\n assume(\"reference.kind\", \"model\", \"ideal-reference\",\n \"An ideal reference, not a capture: the same scene, framing, chart size, output size, region and pixel grid as the capture request, with no camera effects.\");\n assume(\"reference.excludes\", \"model\", [\"lens PSF, diffraction, defocus and pupil sampling\", \"projection and distortion (ideal rectilinear mapping)\", \"vignetting\", \"anti-aliasing filter\",\n \"colour filter mosaic and demosaicing (every pixel has all three channels)\", \"photon, dark and read noise\", \"dark signal\", \"ADC rounding and non-linearity\", \"camera motion and rolling shutter\"],\n \"None of these is applied; each pixel's channels come from the scene radiance at the pixel alone.\");\n assume(\"reference.exposure\", \"model\", { convention: \"exposure-matched\", fNumber, shutterSeconds, iso: resolvedIso, illuminanceLux,\n normalizedSignalPerElectron: { ...relativePerElectron } },\n \"Exposure-matched: each channel is the expected (noise-free) signal the capture's own sensor would record at the resolved exposure (f-number, shutter, ISO, illuminance and lens transmission; the facade's environment chain at the optical axis), \" +\n \"normalized like the RAW development ((code − black)/(white − black) = e·d/(G·(W − B)) for a linear readout), clipped at white, then developed with the capture's white balance, camera → XYZ → sRGB matrices, highlight mode, tone curve and encoding. \" +\n \"So a uniform patch renders at the capture's mean level, and differences from the capture are the camera effects plus noise. Chosen over a fixed reflectance → sRGB mapping because that would differ from the capture by the exposure, which is not a camera artefact.\");\n assume(\"reference.sampling\", \"model\", boxAperture ? { kind: \"box\", samplesPerAxis: n } : { kind: \"point\" },\n boxAperture ? \"Each pixel averages the scene over its square photosite with the same \" + n + \" × \" + n + \" midpoint rule as sensor.pixelAperture \\\"box\\\".\" :\n \"Each pixel samples the scene at its centre, like the capture's default point aperture; use sensor.pixelAperture \\\"box\\\" for photosite-averaged pixels.\");\n return Object.freeze({ kind: \"ideal-reference\" as const, label: \"Ideal reference (no camera effects); not a capture.\", facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples, ...(png ? { png, colorEncoding: colorEncoding! } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds) },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height } } : {}),\n diagnostics: { sampleCount: outputWidth * outputHeight * n * n, timingsMs: { reference: referenceMs, total: Date.now() - started } },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion, evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"calculateEnvironmentSensorPhotoSignal\", \"resolveSensorReadoutRegime\", \"calculateSiteEffectiveSaturationCode\", \"prepareSensorColorDevelopment\",\n ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"]), ...(png ? [\"serializePngImage\"] : [])],\n limitations: [\"Ideal reference of the planar scene at the capture's exposure: not a capture and not a measurement; it shows what the camera effects change, not an absolute colour truth.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a))) });\n }\n\n async function runTask<T extends { run(): Promise<void>; cancel(): void; dispose(): void; readonly state: string }>(task: T): Promise<void> {\n const onAbort = (): void => task.cancel();\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n try { checkAbort(); await task.run(); checkAbort(); } catch (error) { task.dispose(); if (signal?.aborted) fail(\"simulateCapture aborted.\"); throw error; } finally { signal?.removeEventListener(\"abort\", onAbort); }\n }\n const rawStarted = Date.now();\n const plan = calculateNativeRawPlan(environmentRaw.raw);\n const progress = (stage: SimulateCaptureProgress[\"stage\"], total: number) => {\n let completed = 0;\n return (): void => { completed++; onProgress?.({ stage, completedTileCount: completed, totalTileCount: total }); };\n };\n const rawTick = progress(\"raw\", regionNative ? regionNative.height * Math.ceil(regionNative.width / tileWidth) : plan.tileCount);\n const rawCallbacks = { readTile: async (request: Parameters<typeof readTile>[0]): Promise<NativeEnvironmentRawTile> => { const tile = await readTile(request); rawTick(); return tile; },\n evaluateRadiance: rawProvider.evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl };\n const rawTask: NativeEnvironmentRawTask = regionNative ? createNativeEnvironmentRawRegionTask(environmentRaw, regionNative, rawCallbacks) :\n createNativeEnvironmentRawTask(environmentRaw, rawCallbacks);\n await runTask(rawTask);\n let rawOutput = rawTask.takeOutput();\n // Region (2.3): the region's sites, re-described by a plan of the region raster (active area = the region), for development.\n let developmentPlan = plan;\n if (region && regionNative) {\n const raster = { pixelWidth: regionNative.width, pixelHeight: regionNative.height };\n const regionGeometry = { imagingArea: { widthMm: raster.pixelWidth * pitch / 1000, heightMm: raster.pixelHeight * pitch / 1000 }, nativeRaster: raster, orientation: \"landscape\" as const,\n activeCaptureRect: { x: region.x + margin - regionNative.x, y: region.y + margin - regionNative.y, width: region.width, height: region.height },\n outputRaster: { pixelWidth: region.width, pixelHeight: region.height } };\n developmentPlan = calculateNativeRawPlan(buildRawInputFor(intentOf(whiteBalanceState), regionGeometry, { ...captureModeProfile, modes: captureModeProfile.modes.map((m) =>\n ({ ...m, processedImageRaster: { ...m.processedImageRaster, value: raster } })) } as NativeRawInput[\"captureModeProfile\"], { ...bindingProfile, nativeRaster: raster }, raster.pixelWidth * raster.pixelHeight));\n if (Array.from(rawOutput.raw.effectiveSaturationCodes).some((code) => code === 0)) fail(\"output.region needs every CFA phase in its native rectangle.\");\n rawOutput = { ...rawOutput, raw: { ...rawOutput.raw, plan: developmentPlan } };\n }\n const providerEvaluationCount = rawOutput.providerEvaluationCount;\n const rawMs = Date.now() - rawStarted, wbStarted = Date.now();\n let finalRawInput = environmentRaw;\n if (needsAuto) {\n // Grey-world AWB over pre-WB RAW: black-subtracted, white-normalized channel means of each 2×2 CFA block on a coarse grid.\n const raw = rawOutput.raw, step = Math.max(2, 2 * Math.floor(Math.sqrt(width * height / 4096) / 1)), samples = [];\n for (let y = margin - (margin % 2); y + 1 < nativeHeight; y += step) for (let x = margin - (margin % 2); x + 1 < nativeWidth; x += step) {\n const value = (dx: number, dy: number): number => { const i = (y + dy) * nativeWidth + x + dx; return (raw.codes[i]! - raw.blackLevels[i]!) / (raw.effectiveSaturationCodes[dy * 2 + dx]! - raw.blackLevels[i]!); };\n let clipped = false;\n for (const [dx, dy] of [[0, 0], [1, 0], [0, 1], [1, 1]]) if (raw.saturationFlags[(y + dy!) * nativeWidth + x + dx!]! !== 0) clipped = true;\n samples.push({ sampleId: \"block-\" + x + \"-\" + y, red: Math.max(1e-9, value(0, 0)), green: Math.max(1e-9, (value(1, 0) + value(0, 1)) / 2), blue: Math.max(1e-9, value(1, 1)), weight: 1, clipped });\n }\n const policy = body.whiteBalance.awbPolicies[0]!;\n assume(\"output.whiteBalance.auto\", \"model\", { policyId: policy.policyId, samples: samples.length },\n \"Grey-world AWB of the body's \" + policy.policyId + \" policy over 2×2 CFA block means of the pre-WB RAW; the RAW is then rendered again with that intent (the same radiance queries are repeated).\");\n whiteBalanceState = estimateAutoWhiteBalance({ stateId: \"facade-wb-auto\", profile: body.whiteBalance, policyId: policy.policyId,\n sampleSet: { imageStateId: \"facade-pre-wb-raw\", inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples } });\n finalRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding, maximumProviderEvaluations: environmentRaw.maximumProviderEvaluations };\n const wbTick = progress(\"white-balance\", plan.tileCount);\n // A second lean RAW pass with the measured intent. It gives the same RAW as re-running the sensor stage on a\n // retained optical stage, and is faster: retaining the optical stage takes the first pass off the lean executor.\n const wbTask = createNativeEnvironmentRawTask(finalRawInput, {\n readTile: async (request) => { const tile = await readTile(request); wbTick(); return tile; },\n evaluateRadiance: rawProvider.evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl });\n await runTask(wbTask);\n rawOutput = wbTask.takeOutput();\n }\n const wbMs = Date.now() - wbStarted, devStarted = Date.now();\n const colorProfile: ExportSensorColorProfile = { schemaVersion: \"0.1.0\", profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, colorSamplingProfileId: IDS.cfa,\n channelIds: [\"red\", \"green\", \"blue\"], scientificStatus: \"approximation\", referenceIlluminant: \"D65\", normalizedCameraChannelsToXyz: CAMERA_TO_XYZ,\n evidence, limitations: [\"Diagonal camera→XYZ matrix of the idealized colorimetric (Luther–Ives) sensor; exact up to spectral quadrature.\"] };\n const phaseProfiles = builtInDemosaic ? builtInDemosaic.phaseProfiles : bilinearPhaseProfiles();\n const developmentWhiteBalance = whiteBalanceState ? \"apply-resolved-sensor-gains\" as const : \"not-required\" as const;\n\n\n // DNG (2.0): the packed native RAW itself, before development takes ownership of it.\n let dng: NativeRawDng | undefined;\n if (format === \"dng\") {\n const noise = Object.fromEntries(CHANNELS.map((channel) => {\n const resolved = resolveSensorReadoutRegime({ profile: regimeByChannel[channel].readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId: regimeByChannel[channel].regimeId });\n return [channel, { conversionGainElectronsPerCode: resolved.regime.systemConversionGainElectronsPerCode.value / (resolved.regime.adc.digitalGain ?? 1),\n readNoiseRmsElectrons: resolved.combinedReadNoiseRmsElectrons }];\n }));\n const dngStarted = clockMs();\n dng = await serializeNativeRawDng({ raw: rawOutput.raw, colorProfile, noise, ...(dngCapturedAtUtc === undefined ? {} : { capturedAtUtc: dngCapturedAtUtc }),\n ...(textMetadata ? { textMetadata } : {}) });\n encodeMs = clockMs() - dngStarted;\n assumeTextMetadata(TEXT_METADATA_LAYOUT.dng);\n checkAbort();\n assume(\"output.dng\", \"model\", { writer: \"serializeNativeRawDng\", schemaVersion: dng.schemaVersion, whiteLevel: dng.whiteLevel, blackLevels: dng.blackLevels,\n noiseProfile: dng.noiseProfile, unrepresentedSaturationFlagCount: dng.unrepresentedSaturationFlagCount },\n \"Lossless uncompressed 16-bit CFA DNG of exactly the packed native RAW codes: per-phase BlackLevel, WhiteLevel = smallest per-phase effective white, ActiveArea and DefaultCrop from the capture geometry, ColorMatrix1/ForwardMatrix1 from the facade's diagonal camera→XYZ profile (D65), AsShotNeutral from the white-balance intent, BaselineExposure 0, and NoiseProfile from each channel's readout regime (conversion gain ÷ digital gain, combined read noise; Poisson + Gaussian + quantization only). No linear master or developed image is declared; saturation flags below WhiteLevel are not representable and are counted.\");\n }\n\n // Development\n const development: Omit<NativeRawDevelopmentInput, \"raw\"> = { phaseProfiles, colorProfile,\n whiteBalance: developmentWhiteBalance, rendering, highlightMode, ...(mirrorBorder ? { borderHandling: \"mirror\" as const } : {}),\n maximumRetainedPayloadBytes: developmentPlan.outputBytes + outputWidth * outputHeight * 3 * (rendering.bitDepth / 8) };\n let developed: { raw: NativeRawOutput; integerSamples: Uint8Array | Uint16Array; highlight: RawHighlightDiagnostics; diagnostics: SdrRenderingResult[\"diagnostics\"] };\n let gamutMappingDiagnostics: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number } | undefined;\n if (ahd) {\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n }, { yieldControl: () => yieldControl(), checkAbort, onDemosaicMs: (ms) => { demosaicMs = ms; } });\n if (!linearPath) {\n // The native development's SDR kernel, row by row, on the AHD-developed linear sRGB.\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n const codes = rendering.bitDepth === 8 ? new Uint8Array(outputWidth * outputHeight * 3) : new Uint16Array(outputWidth * outputHeight * 3);\n const counts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(linear.rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, codes, y * outputWidth * 3, scratch, counts);\n developed = { raw: rawOutput.raw, integerSamples: codes, highlight: linear.highlight, diagnostics: { renderingNegativeSampleCount: counts.negative,\n renderingAboveReferenceSampleCount: counts.above, toneChangedSampleCount: counts.changed, gamutClippedLowSampleCount: counts.low,\n gamutClippedHighSampleCount: counts.high, captureSaturation: \"consumed-in-raw-development\" } };\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n }\n } else if (!linearPath) {\n const devTask = createNativeRawDevelopmentTask({ ...development, raw: rawOutput.raw }, { yieldControl,\n onProgress: (p) => onProgress?.({ stage: \"development\", completedTileCount: p.completedTileCount, totalTileCount: p.totalTileCount }) });\n await runTask(devTask);\n developed = devTask.takeOutput();\n } else {\n // Wide gamut: the native development operator up to linear sRGB/D65 (unclipped), then XYZ → target primaries.\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n });\n {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) {\n gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n assume(\"output.gamutMapping\", \"model\", { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION, colorSpace: colorEncoding },\n \"prepareRgbGamutMapping: CIELAB L* and hue held, chroma above 90 % of the boundary chroma C_max(L*, h) compressed with a tanh knee so it never reaches C_max (Morovič 2008, §10). In-gamut colours below the knee are unchanged; saturated in-gamut colours above it are desaturated slightly. L* ≥ 100 (above the RAW white) maps to white. CIELAB hue is not perceptually constant for saturated blues, so they can shift toward purple.\");\n }\n assume(\"output.colorEncoding.conversion\", \"model\", { from: \"linear-srgb-d65 (unclipped)\", via: \"CIE XYZ\", to: colorEncoding, gamutHandling: perceptual ? \"cielab-hue-preserving-chroma-compression\" : \"clip-components\",\n transfer: colorEncoding === \"rec2020\" ? \"bt2020-oetf (= BT.709 OETF)\" : \"srgb (W3C CSS Color 4)\" },\n \"Developed with the native development operator (demosaic, per-site white-level clip, WB, highlight mode, diagonal camera→XYZ, XYZ→linear sRGB) but before any sRGB clipping, so colours outside sRGB are kept; converted to \" +\n colorEncoding + \" through XYZ (matrices from primaries and D65, as in W3C CSS Color 4), \" + (perceptual ? \"gamut-mapped perceptually (output.gamutMapping)\" : \"components clipped to [0, 1] in the target gamut\") +\n \", then encoded and rounded to nearest. RAW white maps to display white, as in the sRGB path.\");\n }\n }\n const devMs = Date.now() - devStarted, jpegStarted = Date.now();\n let jpeg: Uint8Array | undefined;\n if (format === \"jpeg\") {\n const samples = developed.integerSamples as Uint8Array;\n const jpegSha = await sha256Hex(Array.from(samples.subarray(0, Math.min(samples.length, 4096))).join(\",\") + \":\" + samples.length + \":\" + sourceSha256);\n const source = { captureId: IDS.capture, imageStateId: \"facade-developed\", artifactId: \"facade-developed-srgb8\", sha256: jpegSha, width: outputWidth, height: outputHeight, encoding: \"encoded-srgb-8-rgb\" as const };\n // The encoder reads every pixel once, in source tiles of at most 256 × 32 aligned to the crop origin.\n const reads = Math.ceil(outputHeight / 32) * Math.ceil(outputWidth / 256), jpegTick = progress(\"jpeg\", reads);\n const jpegTask = createPrintJpegTask({ source, crop: { x: 0, y: 0, width: outputWidth, height: outputHeight }, outputWidth, outputHeight, quantizationStep: jpegStep!,\n maximumEncodedBytes: Math.max(65536, outputWidth * outputHeight * 6), maximumProviderReads: reads,\n // The JPEG records its admission plan, so the raised limit is passed (and recorded) only when the image needs it.\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PRINT_JPEG_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }, {\n readTile: async (request) => {\n jpegTick();\n const out = new Uint8Array(request.width * request.height * 3);\n for (let row = 0; row < request.height; row++) out.set(samples.subarray(((request.y + row) * outputWidth + request.x) * 3, ((request.y + row) * outputWidth + request.x + request.width) * 3), row * request.width * 3);\n return { ...request, samples: out };\n }, yieldControl });\n const jpegEncodeStarted = clockMs();\n await runTask(jpegTask);\n jpeg = jpegTask.takeOutput().bytes;\n if (textMetadata) jpeg = addJpegTextMetadata(jpeg, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.jpeg);\n encodeMs = clockMs() - jpegEncodeStarted;\n assume(\"output.jpeg\", \"model\", { encoder: \"photivra-print-jpeg\", iccProfile: \"photivra-srgb\" }, \"Baseline JPEG from the existing print JPEG encoder with an embedded sRGB ICC profile; the source digest covers a sample prefix, length and scene digest.\");\n }\n const jpegMs = Date.now() - jpegStarted;\n let png: Uint8Array | undefined;\n if (format === \"png\") {\n const pngStarted = clockMs();\n png = serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples: developed.integerSamples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) });\n if (textMetadata) png = addPngTextMetadata(png, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n encodeMs = clockMs() - pngStarted;\n assume(\"output.png\", \"model\", { encoder: \"serializePngImage\", bitDepth: pngBitDepth, colourEncoding: pngColourEncoding(colorEncoding!) },\n \"Deterministic PNG (8/16-bit RGB, in-house zlib) with the colour encoding signalled in the file: the sRGB chunk for sRGB, otherwise a cICP chunk with ITU-T H.273 primaries/transfer code points. No mastering-display (mDCV) or content-light-level (cLLI) metadata is written.\");\n }\n\n const ranOptions = new Set<SimulateCaptureCostOption>([...(pupil ? [\"lens.pupilSampling\" as const] : []), ...(projection !== undefined ? [\"lens.projection\" as const] : []),\n ...(distortion ? [\"lens.distortion\" as const] : []), ...(vignetting ? [\"lens.vignetting\" as const] : []), ...(lensPsf ? [\"lens.psf\" as const] : []),\n ...(diffraction ? [\"lens.diffraction\" as const] : []), ...(antiAliasing ? [\"sensor.antiAliasing\" as const] : []), ...(boxAperture ? [\"sensor.pixelAperture.box\" as const] : []),\n ...(temporalSampleCount > 1 ? [\"sensor.temporalSampleCount\" as const] : []), ...(rotating ? [\"motion.rotation\" as const] : []),\n ...(rollingSchedule ? [\"motion.shutter.rolling\" as const] : []), ...(mirrorBorder ? [\"output.borderHandling.mirror\" as const] : []), ...(region ? [\"output.region\" as const] : []),\n ...(needsAuto ? [\"output.whiteBalance.auto\" as const] : []), ...(ahd ? [\"output.demosaic.ahd\" as const] : []),\n ...(highlightMode === \"reconstruct\" ? [\"output.highlightMode.reconstruct\" as const] : []), ...(wideGamut ? [\"output.colorEncoding.wide-gamut\" as const] : []),\n ...(perceptual ? [\"output.gamutMapping.perceptual\" as const] : []), ...(format === \"jpeg\" || format === \"png\" || format === \"dng\" ? [\"output.format.\" + format as SimulateCaptureCostOption] : [])]);\n return Object.freeze({\n facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples: developed.integerSamples, ...(jpeg ? { jpeg } : {}), ...(png ? { png, colorEncoding: colorEncoding! } : {}), ...(dng ? { dng: dng.bytes } : {}) },\n raw: developed.raw, plan: developmentPlan,\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } } } : {}),\n request: { environmentRaw: finalRawInput, siteInput, development, whiteBalanceState,\n ...(diffraction ? { diffraction: { profile: diffraction, psf: diffractionPsf!, execution: diffractionObjectSpace ? \"object-space-convolution\" as const : \"environment-psf-quadrature\" as const } } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds),\n meteredSceneLuminanceCdPerSquareMeter: meteredLuminance, resolution },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n diagnostics: { providerEvaluationCount, highlight: developed.highlight, rendering: developed.diagnostics, ...(gamutMappingDiagnostics ? { gamutMapping: gamutMappingDiagnostics } : {}),\n timingsMs: { raw: rawMs, whiteBalance: wbMs, development: devMs, jpeg: jpegMs, total: Date.now() - started,\n ...(diffraction && diffractionObjectSpace ? { diffraction: diffractionMs } : {}), ...(demosaicMs === undefined ? {} : { demosaic: demosaicMs }),\n ...(encodeMs === undefined ? {} : { encode: encodeMs }) },\n options: Object.freeze(SIMULATE_CAPTURE_COST_OPTIONS.filter((option) => ranOptions.has(option))) },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion,\n evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"resolveGenericEquipmentExposureCapabilities\", \"meterRelativeExposure\", \"createExposureMeterTargetFromMeteringResult\",\n \"resolve\" + (mode === \"manual\" ? \"Manual\" : mode === \"aperture-priority\" ? \"AperturePriority\" : mode === \"shutter-priority\" ? \"ShutterPriority\" : \"ProgramAuto\") + \"ExposureMode\",\n ...(rollingSchedule ? [\"resolveElectronicRollingShutterExposureSchedule\", \"createRollingShutterCaptureExposureSchedule\"] : []),\n ...(diffraction ? [\"createDiffractionLimitedPsfProfile\", ...(diffractionObjectSpace ? [\"resolveLensPsfConvolutionKernels\", \"calculateIrradianceConvolution\"] : [])] : []),\n ...(antiAliasing ? [\"resolveAntiAliasingSpatialKernel\"] : []), \"resolveGenericIsoSignalChain\", \"createNativeEnvironmentRawTask\", ...(needsAuto ? [\"estimateAutoWhiteBalance\"] : []),\n ...(builtInDemosaic ? [\"createBuiltInBayerDemosaicProfiles\"] : []), ...(ahd ? [\"createAhdDemosaicTask\"] : []),\n ...(ahd ? [\"native RAW development operator (colour, after AHD)\", ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"])] : linearPath ? [\"native RAW development operator (linear, pre-clip)\", \"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"createNativeRawDevelopmentTask\"]),\n ...(jpeg ? [\"createPrintJpegTask\"] : []), ...(png ? [\"serializePngImage\"] : []), ...(dng ? [\"resolveSensorReadoutRegime\", \"serializeNativeRawDng\"] : [])],\n limitations: [\"Educational approximation: synthetic tier sensor values, idealized colorimetric sensor, planar Lambertian scene and point optics; not a calibrated camera emulation.\",\n \"Not offered by the facade: atmospheric haze and polarizers (the scene-radiance provider contract declares no volumetric transport or polarization), flash, video, HDR brackets and processing operators; compose those APIs directly.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a)))\n });\n}\n\n/** Chart preset ids accepted by `simulateCapture({ scene: { preset } })`. */\nexport const SIMULATE_CAPTURE_CHART_PRESETS = CHART_SCENE_PRESETS;\n"]}
1
+ {"version":3,"file":"simulate-capture.js","sourceRoot":"","sources":["../../src/facade/simulate-capture.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAA8D,MAAM,qCAAqC,CAAC;AACtI,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,2CAA2C,EAAE,MAAM,uCAAuC,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,2CAA2C,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACnI,OAAO,EAAE,yBAAyB,EAAE,mCAAmC,EAAE,kCAAkC,EACzG,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAmC,MAAM,6BAA6B,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,qCAAqC,EAAqC,MAAM,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,CAAC,CAAC,4BAA4B,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3J,WAAW,EAAE,CAAC,sKAAsK;gBAClL,uOAAuO,CAAC,EAAE;QAC9O,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * `simulateCapture()` is the easy starting point. It turns a small input into a complete native\n * environment RAW request: scene radiance → optics → spectral EQE (external quantum efficiency) →\n * charge → readout and ADC. That request then runs through the existing native RAW development task\n * and, optionally, the existing JPEG encoder.\n *\n * It adds no physics of its own. Every number comes from existing public contracts: generic tier\n * presets, exposure metering and mode resolution, colorimetry, native environment RAW, native RAW\n * development and print JPEG.\n *\n * Everything the facade decides for the caller is listed in `result.assumptions`: defaults, derived\n * values and fixed modelling choices. Nothing is hidden. The complete underlying request is returned\n * in `result.request`; get the per-site inputs with `request.siteInput(index)`.\n *\n * The 2.0 options are opt-in and only combine existing public contracts. If none is given, the\n * request, RAW, samples and JPEG are byte-identical to the 1.0 facade:\n * - output formats: `png` (`serializePngImage`; sRGB, or Display P3 / Rec. 2020 through the colorimetry\n * matrices and transfer functions) and `dng`\n * (`serializeNativeRawDng` of the packed native RAW; no linear master is declared);\n * - demosaic: `createBuiltInBayerDemosaicProfiles` (bilinear) and mirror borders;\n * - optics: the environment `lensFieldMapping` (projection, radial / Brown–Conrady distortion), radial\n * illumination vignetting as field throughput and a caller sampled lens PSF;\n * - motion: constant camera angular velocity and the electronic rolling-shutter exposure schedule.\n * The 2.1 options are opt-in in the same way: `lens.diffraction`, `output.demosaic: \"ahd\"` and\n * `sensor.antiAliasing` (a birefringent point-splitting low-pass filter in the sensor optical stack).\n * The 2.4 `output.metadata` adds the caller's text to JPEG, PNG and DNG files (see `src/output/text-metadata.ts`);\n * without it every encoded file is byte-identical to 2.3.\n * @see docs/QUICK_START.md\n */\n\nimport { markInternalSceneRadianceEvaluator } from \"../core/internal-radiance-evaluator.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { requireInputObject } from \"../core/record-validation.js\";\nimport { ENGINE_API_VERSION } from \"../core/version.js\";\nimport type { EvidenceProvenance } from \"../core/evidence-provenance.js\";\nimport { GENERIC_TIER_ASSETS, type GenericEquipmentTier, type GenericEquipmentTierPreset } from \"../equipment/generic-tier-assets.js\";\nimport { parseCallerCameraPreset } from \"./camera-preset.js\";\nimport { createHostYield } from \"./host-yield.js\";\nimport { resolveGenericEquipmentExposureCapabilities } from \"../equipment/exposure-capabilities.js\";\nimport { resolveGenericIsoSignalChain } from \"../sensor/iso-signal-chain.js\";\nimport { meterRelativeExposure } from \"../exposure/metering.js\";\nimport { createExposureMeterTargetFromMeteringResult, setExposureCompensationOnMeterTarget } from \"../exposure/metering-target.js\";\nimport { resolveManualExposureMode, resolveAperturePriorityExposureMode, resolveShutterPriorityExposureMode,\n resolveProgramAutoExposureMode } from \"../exposure/exposure-mode-resolver.js\";\nimport { parseExposureProgramLineProfile, type ExposureProgramLineProfile } from \"../exposure/program-line.js\";\nimport { resolveCaptureGeometry } from \"../output/capture-geometry.js\";\nimport { estimateCie1931ColorMatchingFunctions, type PreparedColorimetricSpectrum } from \"../color/color-matching-functions.js\";\nimport { createColorTemperatureWhiteBalanceIntent, resolveColorTemperatureWhiteBalance, resolveCustomWhiteBalance,\n resolveManualWhiteBalance, estimateAutoWhiteBalance, type ResolvedWhiteBalanceState } from \"../color/white-balance.js\";\nimport { createCaptureWhiteBalanceIntent, type CaptureWhiteBalanceIntent } from \"../capture/simulated-capture.js\";\nimport { SENSOR_RAW_PRODUCER_NOISE_MODEL } from \"../capture/sensor-raw-producer.js\";\nimport { calculateNativeRawPlan, nativeRawMaximumProviderEvaluations, NATIVE_RAW_LIMITS, type NativeRawInput, type NativeRawOutput, type NativeRawPlan } from \"../capture/native-raw.js\";\nimport { createNativeEnvironmentRawTask, createNativeEnvironmentRawRegionTask, type NativeEnvironmentRawInput,\n type NativeEnvironmentRawTask, type NativeEnvironmentRawTile } from \"../capture/native-environment-raw.js\";\nimport { createNativeRawDevelopmentTask, type NativeRawDevelopmentInput, type RawHighlightDiagnostics } from \"../capture/native-raw-development.js\";\nimport type { RawFrameReconstructionPhaseProfile } from \"../capture/raw-frame-reconstruction.js\";\nimport type { ExportSensorColorProfile } from \"../capture/photographic-export.js\";\nimport { parseSdrRenderingProfile, type SdrRenderingProfile, type SdrToneCurve, type SdrToneCurveParameters, type SdrRenderingResult } from \"../output/sdr-rendering.js\";\nimport type { RawHighlightMode } from \"../color/sensor-color-development.js\";\nimport { createPrintJpegTask, PRINT_JPEG_LIMITS } from \"../output/print-jpeg.js\";\nimport type { SimulateEnvironmentSensorRawFrameInput } from \"../capture/environment-raw-producer.js\";\nimport { checkNativeRawIntegrity, prepareNativeRawDevelopment } from \"../capture/native-raw-development.js\";\nimport { createRawPixelDeveloper, normalizedRawSite, rawSiteSaturated, type RawDevelopmentSource } from \"../capture/raw-development-kernel.js\";\nimport { createAhdDemosaicTask } from \"../processing/demosaic.js\";\nimport { PROCESSING_MAX_PIXELS } from \"../processing/processing-task.js\";\nimport { renderSdrRunInto, type SdrPixelCounts } from \"../output/native-capture-sdr.js\";\nimport { prepareSdrPixelTone } from \"../output/sdr-rendering.js\";\nimport { BUILT_IN_BAYER_DEMOSAIC_MODEL_VERSION as BUILT_IN_DEMOSAIC_VERSION, createBuiltInBayerDemosaicProfiles } from \"../sensor/raw-reconstruction.js\";\nimport { transformOrientedRasterPointToNative } from \"../output/capture-geometry.js\";\nimport { resolveCaptureColorModel } from \"../color/capture-color.js\";\nimport { evaluateBt709Oetf, evaluateSrgbEncoding, resolveRgbColorSpace } from \"../color/rgb-color-spaces.js\";\nimport { serializePngImage, PNG_ENCODER_LIMITS, type PngColourEncoding } from \"../output/png-encoder.js\";\nimport { addJpegTextMetadata, addPngTextMetadata, parseOutputTextMetadata, type OutputTextMetadata } from \"../output/text-metadata.js\";\nimport { parseLensProjectionModel, type LensProjectionModel } from \"../camera/lens-projection.js\";\nimport { prepareEnvironmentLensFieldMapping, type EnvironmentLensFieldMapping } from \"../optics/sensor-environment-query.js\";\nimport type { RadialDistortionProfile } from \"../optics/radial-distortion.js\";\nimport type { BrownConradyDistortionProfile } from \"../optics/brown-conrady-distortion.js\";\nimport type { IlluminationVignettingProfile } from \"../optics/illumination-vignetting.js\";\nimport type { CalculateSensorPsfIrradianceQuadratureInput } from \"../optics/sensor-psf-quadrature.js\";\nimport type { CalculateEnvironmentSensorPhotoSignalInput } from \"../sensor/environment-photo-signal.js\";\nimport { createRollingShutterCaptureExposureSchedule, resolveElectronicRollingShutterExposureSchedule,\n type ElectronicRollingShutterExposureSchedule } from \"../sensor/readout-exposure-linkage.js\";\nimport { calculateCaptureExposureWindows } from \"../sensor/exposure-window.js\";\nimport { calculateSensorSpectralQuadrature } from \"../sensor/spectral-quadrature.js\";\nimport { createDiffractionLimitedPsfProfile, type DiffractionLimitedPsfProfile } from \"../optics/diffraction-psf-profile.js\";\nimport { createDiffractedPlanarProvider } from \"./diffraction-provider.js\";\nimport { resolveGenericPrimeLens, type GenericPrimeLens } from \"../equipment/generic-prime-lenses.js\";\nimport { calculateEnvironmentSensorPhotoSignal } from \"../sensor/environment-photo-signal.js\";\nimport { calculateSiteEffectiveSaturationCode } from \"../capture/raw-white-level.js\";\nimport { prepareSensorColorDevelopment } from \"../color/sensor-color-development.js\";\nimport type { SceneRadianceEvaluationRequest } from \"../schema/scene-radiance.js\";\nimport { resolveAntiAliasingSpatialKernel, type AntiAliasingPointSplitComponent, type SensorOpticalStackProfile } from \"../sensor/optical-stack.js\";\nimport { multiplyMatrices, type ColorMatrix3x3, type ColorVector3 } from \"../color/colorimetry-math.js\";\nimport { prepareRgbGamutMapping, type PreparedRgbGamutMapping } from \"../color/gamut-mapping.js\";\nimport { serializeNativeRawDng, type NativeRawDng } from \"../capture/native-raw-dng.js\";\nimport { parseSensorReadoutConversionProfile, resolveSensorReadoutRegime } from \"../sensor/raw-readout.js\";\nimport { resolveChartScene, chartMaterialInputs, CHART_SCENE_PRESETS, type ChartScene, type ResolvedChartScene } from \"./chart-scenes.js\";\nimport { resolveCaptureIlluminant, calculateIlluminantIrradianceScale, buildPlanarSceneRadianceProvider, requireCallerScene, FACADE_SPECTRAL_RANGE_NANOMETERS,\n resolveChartSizeOption, type ChartSizeOption,\n PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W, type CaptureIlluminant, type CallerMaterialScene, type CallerRadianceScene, type CallerReflectanceScene, type ResolvedCallerScene,\n type PlanarSceneRadianceProvider, type ResolvedCaptureIlluminant } from \"./scene-radiance.js\";\n\n/** Version of how the facade builds requests. It changes whenever the same input would build a different request. */\nexport const SIMULATE_CAPTURE_FACADE_VERSION = \"1.0.0\" as const;\n\nexport type SimulateCaptureExposureMode = \"manual\" | \"aperture-priority\" | \"shutter-priority\" | \"program\";\nexport type SimulateCaptureOutputFormat = \"srgb-8\" | \"srgb-16\" | \"jpeg\" | \"png\" | \"dng\";\nexport type SimulateCaptureWhiteBalance =\n | \"scene-illuminant\"\n | \"auto\"\n | \"none\"\n | { kelvin: number; tint?: number }\n | { channelGains: { red: number; green: number; blue: number } };\n/**\n * PNG colour encoding. `srgb` is the developed sRGB output. The others take the developed linear\n * colour (camera → XYZ → linear sRGB/D65, unclipped) and convert it through CIE XYZ into the target\n * primaries:\n * - `display-p3`: Display P3 primaries (W3C CSS Color 4 `display-p3`; also SMPTE EG 432-1) with the\n * sRGB transfer function;\n * - `rec2020`: ITU-R BT.2020 primaries and OETF.\n * PQ and HLG (BT.2100) are not part of 2.0; see THIRD_PARTY.md.\n */\nexport type SimulateCaptureColorEncoding = \"srgb\" | \"display-p3\" | \"rec2020\";\n/**\n * Demosaic. `bilinear`: the built-in Bayer kernels (`createBuiltInBayerDemosaicProfiles`). `ahd` (2.1): adaptive\n * homogeneity-directed demosaicing (`createAhdDemosaicTask`, after Hirakawa & Parks 2005), a non-linear\n * edge-directed method that reduces zipper and false colour on sharp edges.\n */\nexport type SimulateCaptureDemosaic = \"bilinear\" | \"ahd\";\n/**\n * `margin` renders extra native sites around the output, as far as the kernel reaches. `mirror` renders\n * exactly the output and reads mirrored (reflect-101) copies of the missing border sites. Mirroring is\n * checked to keep the CFA (colour filter array) pattern consistent.\n */\nexport type SimulateCaptureBorderHandling = \"margin\" | \"mirror\";\nexport type SimulateCaptureLensDistortion =\n | { kind: \"radial\"; profile: RadialDistortionProfile }\n | { kind: \"brown-conrady\"; profile: BrownConradyDistortionProfile };\n/** Diffraction model (2.1): the shorthand or a record with an explicit kernel radius in sites. */\nexport type SimulateCaptureLensDiffraction = \"circular-aperture\" | { aperture: \"circular-aperture\"; kernelRadiusSamples?: number };\n/**\n * Optical anti-aliasing (low-pass) filter (2.1), modelled as birefringent point splitting: each image point is\n * split into equally bright copies (the engine's `normalized-point-splitting-kernel` optical-stack response).\n * - `four-spot`: two crossed birefringent plates; copies at (±d/2, ±d/2), weight 1/4 each, MTF |cos(π·f_x·d)·cos(π·f_y·d)|.\n * - `two-spot`: one plate splitting along `axis`; copies at ±d/2, weight 1/2 each, MTF |cos(π·f·d)|.\n * - `point-splitting`: the engine contract itself, offsets in micrometres (+x right, +y down) and positive weights\n * summing to 1 (at most 16 components, each within 4 sites).\n * d = `separationSites` × pixel pitch, 0 < separationSites ≤ 4, default 1 (first MTF zero at the sensor's Nyquist\n * frequency 1/(2·pitch)).\n */\nexport type SimulateCaptureSensorAntiAliasing =\n | { kind: \"four-spot\"; separationSites?: number }\n | { kind: \"two-spot\"; axis: \"horizontal\" | \"vertical\"; separationSites?: number }\n | { kind: \"point-splitting\"; components: readonly AntiAliasingPointSplitComponent[] };\n/** Pixel aperture (2.3): centre sampling, or the square photosite integrated with an N × N midpoint rule. */\nexport type SimulateCapturePixelAperture = \"point\" | \"box\" | { kind: \"box\"; samplesPerAxis?: number };\n/** Default midpoint samples per axis of `sensor.pixelAperture: \"box\"`. */\nexport const SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES = 4;\nexport interface SimulateCaptureMotion {\n /** Constant camera angular velocity, rad/s, in the engine's pitch/yaw/roll convention. Missing axes are 0. */\n angularVelocityRadPerSec?: { pitch?: number; yaw?: number; roll?: number };\n /** Default \"global\". `rolling` derives the exposure schedule from the body's rolling readout declaration. */\n shutter?: \"global\" | \"rolling\";\n /** Rolling shutter only: time from the first to the last line over the simulated frame, in s. Default: the body's declared readout skew. */\n rollingShutterSkewSeconds?: number;\n}\n\nexport interface SimulateCaptureOptions {\n /** Generic tier preset id or a full preset record (for example a modified copy of a catalog entry). Default \"professional\". */\n camera?: GenericEquipmentTier | GenericEquipmentTierPreset;\n lens?: {\n /** Must lie in the lens capability (the generic primes are 50 mm). Default: the lens's shortest focal length. */\n focalLengthMm?: number;\n /**\n * Opt-in (2.3): a lens of the generic prime family by its full-frame-equivalent focal length\n * (`GENERIC_PRIME_EQUIVALENT_FOCAL_LENGTHS_MM`). Its physical focal length is the equivalent ÷ the diagonal crop\n * factor of the simulated frame (output width × height × pixel pitch); it replaces the tier lens's focal length and\n * f-number range (the tier lens's transmission is kept). An f-number outside the prime's range, or a subject or\n * focus distance below its minimum focus distance, is rejected. Not combinable with `focalLengthMm`.\n */\n prime?: number;\n /** Aperture for manual and aperture-priority modes. Default 8. */\n fNumber?: number;\n /** Focus distance in metres. Default: the subject distance. */\n focusDistanceM?: number;\n /** Opt-in ideal circular-pupil ray sampling (defocus/depth of field). Default off (central ray only). */\n pupilSampling?: { radialSamples: number; angularSamples: number };\n /** Ideal lens projection (`LENS_PROJECTION_MODELS`). Default \"rectilinear\". Not combinable with pupilSampling. */\n projection?: LensProjectionModel;\n /** Caller-declared radial or Brown–Conrady distortion profile. Default none. Not combinable with pupilSampling. */\n distortion?: SimulateCaptureLensDistortion;\n /** Caller-declared radial relative-illumination (vignetting) profile, applied as environment field throughput. */\n vignetting?: IlluminationVignettingProfile;\n /**\n * Caller sampled lens PSF, passed unchanged to the environment contract. Its focal length, f-number and\n * focus must equal the resolved capture settings exactly. Not combinable with pupilSampling.\n */\n psf?: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n /**\n * Opt-in (2.1) diffraction blur of an ideal, aberration-free, in-focus lens with a circular pupil at the\n * capture's resolved f-number: the engine builds the Airy kernels (`createDiffractionLimitedPsfProfile`)\n * on the site pitch. `kernelRadiusSamples` (0–32) sets the kernel window; default: the third dark ring at\n * the longest spectral node, capped at 32 sites. Not combinable with `psf` or `pupilSampling`. Default off.\n */\n diffraction?: SimulateCaptureLensDiffraction;\n };\n exposure?: {\n /** Default \"manual\". */\n mode?: SimulateCaptureExposureMode;\n /** Default 100. */\n iso?: number;\n /** Shutter for manual and shutter-priority modes. Default 1/125 s. */\n shutterSeconds?: number;\n /** Exposure compensation applied to the meter target, in stops. Default 0. */\n compensationStops?: number;\n };\n /** Required: an engine chart (for example `{ preset: \"uniform\" }`, an 18 % grey card) or a caller reflectance/radiance function. */\n scene: ChartScene | CallerReflectanceScene | CallerRadianceScene | CallerMaterialScene;\n /** Distance from the camera to the scene plane in metres. Default 5. */\n subjectDistanceM?: number;\n /**\n * Opt-in (2.3) fixed-size chart: place the scene at this physical size on the plane at the subject distance,\n * centred on the optical axis, instead of sizing it to fill the frame. Outside it the plane is a neutral surround\n * (default 18 %). Chart presets are resolved in the chart's own frame (aspect heightM / widthM); caller functions\n * are called only on the chart and receive chart-local `chartU`, `chartV`. `result.scene.chart` reports the\n * framed width, the fraction of the frame the chart covers and the thin-lens magnification.\n */\n chartSize?: ChartSizeOption;\n /** Default: Planckian 6500 K (a blackbody stand-in for daylight; CIE D65 is not bundled). */\n illuminant?: CaptureIlluminant;\n /** Illuminance on the scene plane, lux. Default about 21 481 lux (see `SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX` and the assumptions). */\n illuminanceLux?: number;\n output?: {\n /** Output pixels; the native sensor raster adds a one-site demosaic border on each side. Defaults 64 × 64. */\n width?: number;\n height?: number;\n /** Default \"srgb-8\". */\n format?: SimulateCaptureOutputFormat;\n /** Default \"identity\". */\n toneCurve?: SdrToneCurve;\n /** Required by the luminance tone curves (see `SdrToneCurveParameters`). The facade does not make one up. */\n toneCurveParameters?: SdrToneCurveParameters;\n /** Default \"clip\". */\n highlightMode?: RawHighlightMode;\n /** Default \"scene-illuminant\". */\n whiteBalance?: SimulateCaptureWhiteBalance;\n /** JPEG constant quantization step 1-255 (not a manufacturer 'quality'). Default 2. */\n jpegQuantizationStep?: number;\n /** PNG only. Default \"srgb\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** PNG only: 8 or 16 bits per sample. Default 8. */\n bitDepth?: 8 | 16;\n /**\n * PNG SDR encodings only. Default \"clip\" (per-component clip to the target gamut). \"perceptual\" maps\n * through `prepareRgbGamutMapping`: constant CIELAB L* and hue, chroma above 90 % of the boundary compressed.\n */\n gamutMapping?: \"clip\" | \"perceptual\";\n /** Default: the 1.0 facade's bilinear RGGB kernels. */\n demosaic?: SimulateCaptureDemosaic;\n /** Default \"margin\". */\n borderHandling?: SimulateCaptureBorderHandling;\n /** DNG only: optional capture-event time (YYYY-MM-DDTHH:mm:ss.sssZ); without it no date tags are written. */\n dng?: { capturedAtUtc?: string };\n /**\n * Opt-in (2.4) text written into the file for formats \"jpeg\", \"png\" and \"dng\": the caller's description,\n * software, copyright and comment, unchanged (JPEG XMP + COM, PNG tEXt/iTXt, DNG TIFF tags + XMP; see the\n * quick start). Each field is 1–2048 UTF-8 bytes with no control characters except line feed. Default: none.\n */\n metadata?: OutputTextMetadata;\n /**\n * Opt-in large images: the most native sensor sites (the output plus the demosaic margin on each side) the\n * capture may allocate, an integer up to `NATIVE_RAW_LIMITS.ceilingPixels` (2^27). With it, `width` and\n * `height` may each reach 16 384 sites including the margin; without it they stay at most 4094. Time and\n * memory grow with the pixel count (see \"Large images\" in the quick start); browsers may fail at large sizes.\n */\n maximumPixels?: number;\n /**\n * Opt-in (2.3) region rendering: render only this rectangle, in output-pixel coordinates of the whole frame\n * `width` × `height` (x right, y down from its top-left). The pixels are byte-identical to the same pixels of\n * the whole render: framing, metering, exposure, noise seeds (absolute native site indices), rolling-shutter row\n * timing, diffraction and demosaic all use the whole frame. Use it to tile a large frame across workers or to\n * render a 100 % crop. `result.image` is the region; `result.region` reports it. Not combinable with\n * `whiteBalance: \"auto\"`, whose statistics would come from the region only. From 2.6 the diffraction convolution\n * covers only the region plus the kernel and filter reach, so a small region of a large frame costs about as much\n * as a capture of the region's size.\n */\n region?: { x: number; y: number; width: number; height: number };\n };\n /** Camera motion and shutter type. Default: still camera, global electronic shutter. */\n motion?: SimulateCaptureMotion;\n sensor?: {\n /**\n * Pixel pitch in micrometres, 0.5–1000. Default 6. The simulated sensor is output width × pitch wide. 2.5: above 100 µm the\n * capture is a downsized view of a whole frame (for example 36 mm / 48 pixels = 750 µm), recorded in the assumption\n * `sensor.wholeFrameView`: brightness is unchanged and the noise is that of a binned view, not of the real sensor's pixels.\n */\n pixelPitchMicrometers?: number;\n /** Maximum spectral quadrature subinterval in nm. Default 20. */\n spectralStepNanometers?: number;\n /** Temporal midpoint samples across the exposure. Default 1. */\n temporalSampleCount?: number;\n /** Noise seed (uint32). Default 1. */\n noiseSeed?: number;\n /**\n * Opt-in (2.1) optical anti-aliasing filter (birefringent point splitting, `SimulateCaptureSensorAntiAliasing`).\n * Multiplies the scene queries by the number of split points. Default off (the tiers declare no filter).\n */\n antiAliasing?: SimulateCaptureSensorAntiAliasing;\n /**\n * Opt-in (2.3) pixel aperture. `\"point\"` (default): each site samples the irradiance at its centre.\n * `\"box\"`: each site integrates the irradiance over its whole square photosite (fill factor 1) with an\n * N × N midpoint rule, N = `samplesPerAxis` (1–16, default 4), so detail finer than a pixel averages out as\n * on a real sensor (pixel MTF |sinc(f·p)|) instead of aliasing. Multiplies the scene queries by N².\n */\n pixelAperture?: SimulateCapturePixelAperture;\n };\n /** Aborting cancels the running task; the promise rejects with a domain error and returns no partial image. */\n signal?: AbortSignal;\n /** Called after each committed RAW, development or JPEG tile. Cannot change output. */\n onProgress?: (progress: SimulateCaptureProgress) => void;\n}\n\n/**\n * Options reported in `diagnostics.options` (2.1), in this order, when they ran: the ones that change how much work\n * a capture does. `motion.rotation` is a non-zero angular velocity; `sensor.temporalSampleCount` a count above 1.\n */\nexport const SIMULATE_CAPTURE_COST_OPTIONS = Object.freeze([\"lens.pupilSampling\", \"lens.projection\", \"lens.distortion\", \"lens.vignetting\", \"lens.psf\",\n \"lens.diffraction\", \"sensor.antiAliasing\", \"sensor.pixelAperture.box\", \"sensor.temporalSampleCount\", \"motion.rotation\", \"motion.shutter.rolling\", \"output.borderHandling.mirror\", \"output.region\",\n \"output.whiteBalance.auto\", \"output.demosaic.ahd\", \"output.highlightMode.reconstruct\", \"output.colorEncoding.wide-gamut\", \"output.gamutMapping.perceptual\",\n \"output.format.jpeg\", \"output.format.png\", \"output.format.dng\"] as const);\nexport type SimulateCaptureCostOption = typeof SIMULATE_CAPTURE_COST_OPTIONS[number];\n\nexport interface SimulateCaptureProgress {\n stage: \"raw\" | \"white-balance\" | \"development\" | \"jpeg\";\n completedTileCount: number;\n totalTileCount: number;\n}\n\n/** One decision the facade made: a default, a derived value or a fixed modelling choice. */\nexport interface SimulateCaptureAssumption {\n /** Dotted option path or modelling topic, for example \"exposure.shutterSeconds\" or \"model.lens-psf\". */\n id: string;\n kind: \"default\" | \"derived\" | \"model\";\n value: unknown;\n explanation: string;\n}\n\nexport interface SimulateCaptureResult {\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: {\n width: number;\n height: number;\n format: SimulateCaptureOutputFormat;\n /** Interleaved RGB, row by row from the top-left. sRGB-encoded (W3C CSS Color 4 sRGB; also IEC 61966-2-1) unless `colorEncoding` says otherwise. */\n samples: Uint8Array | Uint16Array;\n /** Baseline JPEG bytes when format is \"jpeg\". */\n jpeg?: Uint8Array;\n /** PNG file bytes when format is \"png\". */\n png?: Uint8Array;\n /** Encoding of `samples` and `png` when format is \"png\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** Lossless uncompressed CFA DNG of the packed RAW when format is \"dng\" (`serializeNativeRawDng`); `samples` are then sRGB 8-bit. */\n dng?: Uint8Array;\n };\n /**\n * Packed native RAW (codes, black levels, saturation flags) as produced by the native environment RAW task. With\n * `output.region` (2.3): the region's native sites only, with `plan` describing that raster (its active area is the\n * region); `request.environmentRaw` and `request.siteInput` stay those of the whole frame.\n */\n raw: NativeRawOutput;\n plan: NativeRawPlan;\n /**\n * 2.3, present with `output.region`: the rendered rectangle in output pixels of the whole `frameWidth` × `frameHeight`\n * frame, and the native sites rendered for it (`nativeRect`, in the whole frame's native raster: the region, the\n * demosaic reach on each side clipped to the raster, and its origin rounded down to the 2 × 2 CFA repeat).\n */\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number; nativeRect: { x: number; y: number; width: number; height: number } };\n /** The complete underlying request. */\n request: {\n environmentRaw: NativeEnvironmentRawInput;\n /** Rebuilds the exact physical site input the provider supplied for a native row-major index. */\n siteInput(nativeIndex: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n development: Omit<NativeRawDevelopmentInput, \"raw\">;\n whiteBalanceState: ResolvedWhiteBalanceState | null;\n /**\n * Present with lens.diffraction (2.1): the engine-built Airy profile, the equivalent environment sampled PSF\n * selection, and how it was applied. With `object-space-convolution` the site inputs declare no PSF and the\n * provider answers with the PSF-convolved radiance; putting `psf` into each site input and using the plain\n * scene provider gives the same expected signal (to float rounding) through the per-tap environment quadrature.\n */\n diffraction?: { profile: DiffractionLimitedPsfProfile; psf: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n execution: \"object-space-convolution\" | \"environment-psf-quadrature\" };\n };\n exposure: {\n mode: SimulateCaptureExposureMode;\n settings: { fNumber: number; shutterSeconds: number; iso: number };\n /** Exposure value at ISO 100 of the settings, log2(N²/t). */\n ev100: number;\n meteredSceneLuminanceCdPerSquareMeter: number;\n /** Full output of the existing exposure-mode resolver. */\n resolution: unknown;\n };\n scene: {\n sceneId: string;\n preset: string;\n parameters: Readonly<Record<string, unknown>>;\n illuminant: { id: string; description: string; illuminanceLux: number };\n distanceM: number;\n /** Physical size of the framed scene plane, metres. */\n framedWidthM: number;\n framedHeightM: number;\n /**\n * 2.3, present with `chartSize`: the chart's physical size and surround, the fraction of the frame width and\n * height it covers (above 1 when it is larger than the frame and cropped), the thin-lens magnification\n * v/d (image distance over subject distance, the scale the facade's framing uses) and the chart's size on the\n * sensor in millimetres and output pixels.\n */\n chart?: { widthM: number; heightM: number; surroundReflectance: number; frameWidthFraction: number; frameHeightFraction: number;\n magnification: number; imageWidthMm: number; imageHeightMm: number; imageWidthPixels: number; imageHeightPixels: number };\n /**\n * SHA-256 of the canonical scene description, recorded as the capture source digest. Caller spectra (a\n * `spectrum` or `daylight` illuminant, chart reflectance spectra) are part of the description: tabulated\n * data exactly, function spectra sampled at 1 nm over 380-780 nm, plus the daylight basis datasetId.\n * The body of a caller scene's evaluate function is not hashed.\n */\n sourceSha256: string;\n };\n diagnostics: {\n providerEvaluationCount: number;\n highlight: RawHighlightDiagnostics;\n rendering: SdrRenderingResult[\"diagnostics\"];\n /** Present with output.gamutMapping \"perceptual\": pixels whose chroma or lightness the mapping changed. */\n gamutMapping?: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number };\n /**\n * Wall-clock milliseconds per stage. `raw`, `whiteBalance` (the second RAW pass of auto white balance), `development`\n * (includes DNG writing), `jpeg` and `total` are whole milliseconds (`Date.now()`). Since 2.1, where a stage ran:\n * `diffraction` (the object-space convolution of `lens.diffraction`; part of `raw` and `whiteBalance`), `demosaic`\n * (the AHD demosaic; part of `development`) and `encode` (PNG, JPEG or DNG serialization), with sub-millisecond\n * resolution where the host has `performance.now()`. Timings vary from run to run and never enter any digest or output byte.\n */\n timingsMs: { raw: number; whiteBalance: number; development: number; jpeg: number; total: number; diffraction?: number; demosaic?: number; encode?: number };\n /**\n * 2.1: the opt-in options that changed the work of this run, in a fixed order (see `SIMULATE_CAPTURE_COST_OPTIONS`).\n * Empty for a capture with every default. With `timingsMs` it lets an application measure each option's cost on\n * the user's device.\n */\n options: readonly SimulateCaptureCostOption[];\n };\n provenance: {\n scientificStatus: \"approximation\";\n cameraPresetId: string;\n cameraPresetVersion: string;\n evidence: readonly EvidenceProvenance[];\n /** Existing engine contracts the facade composed, in execution order. */\n composedContracts: readonly string[];\n limitations: readonly string[];\n };\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\nexport const FACADE_EVIDENCE: readonly EvidenceProvenance[] = Object.freeze([Object.freeze({ sourceOrigin: \"photivra\" as const,\n sourceReference: \"photivra:simulate-capture-facade\", reuseStatus: \"photivra-owned\" as const })]);\nconst DEFAULTS = Object.freeze({ camera: \"professional\" as const, fNumber: 8, shutterSeconds: 1 / 125, iso: 100, compensationStops: 0,\n subjectDistanceM: 5, width: 64, height: 64, format: \"srgb-8\" as const, toneCurve: \"identity\" as const, highlightMode: \"clip\" as const,\n whiteBalance: \"scene-illuminant\" as const, jpegQuantizationStep: 2, pixelPitchMicrometers: 6, spectralStepNanometers: 20,\n temporalSampleCount: 1, noiseSeed: 1, illuminantKelvin: 6500 });\n/** Standard output sensitivity S = 10 / H (CIPA DC-004-2020 §3.2): the reference exposure in lx·s is 10 / S. */\nconst SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS = 10;\n/** Camera equation H = 0.65·L·t/N² (CIPA DC-004-2020 §5.5 (4); 0.65 = τ·π/4 with τ = 0.828, Explanation 4). */\nconst CAMERA_EQUATION_CONSTANT = 0.65;\n/** Neutral reference reflectance: DC-004 ties the SOS reference level to an 18 % grey (Explanation 1 and 2.2). */\nconst GREY_CARD_REFLECTANCE = 0.18;\n/** Scene luminance (cd/m²) whose focal-plane exposure 0.65·L·t/N² equals the SOS reference exposure 10/S. */\nfunction sosReferenceLuminance(fNumber: number, shutterSeconds: number, iso: number): number {\n return SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS * fNumber ** 2 / (CAMERA_EQUATION_CONSTANT * shutterSeconds * iso);\n}\n/**\n * Default illuminance, lux: an 18 % Lambertian grey card (L = 0.18·E/π) then gets exactly the CIPA DC-004 standard\n * output sensitivity reference exposure H = 10/S at f/8, 1/125 s, ISO 100:\n * E = π·10·N²/(0.65·t·S·0.18) = π·80 000/11.7 ≈ 21 480.98 lux.\n */\nexport const SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX = Math.PI * sosReferenceLuminance(DEFAULTS.fNumber, DEFAULTS.shutterSeconds, DEFAULTS.iso) /\n GREY_CARD_REFLECTANCE;\n/**\n * Sensitive-aperture area (µm²) at which the tier's ISO signal chain applies unchanged: the default 6 µm square\n * aperture with fill factor 1. At other areas the facade scales the electron-domain readout values by\n * area / this reference, so the same focal-plane exposure H gives the same output code (see `isoAreaScaledReadout`).\n */\n/** 2.5: the largest accepted pixel pitch, µm (44 mm ÷ 48 pixels ≈ 917 µm, a whole full-frame or larger sensor at a small output). */\nconst SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS = 1000;\n/** Pitches above this, µm, are larger than any camera photosite: the capture is a downsized whole-frame view (assumption sensor.wholeFrameView). */\nconst SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS = 100;\nconst ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS = DEFAULTS.pixelPitchMicrometers * DEFAULTS.pixelPitchMicrometers;\n/** Demosaic border, native sites per side. */\nconst MARGIN = 1;\n/**\n * AHD border, native sites per side: an AHD output pixel depends on sites up to 5 away (directional green ±2,\n * colour differences ±1 of it, the homogeneity's 4-neighbours and its 3 × 3 sum), so a 5-site rendered margin keeps\n * every output pixel off the plane's mirrored edge.\n */\nconst AHD_MARGIN = 5;\n/** Sites whose values enter an AHD output pixel (interpolation reach), for the saturated-pixel count. */\nconst AHD_VALUE_REACH = 3;\n\n/** Anti-aliasing filter limits: split points, and the largest offset in sites (bounds the scene work and the convolution margin). */\nconst AA_MAXIMUM_COMPONENTS = 16;\nconst AA_MAXIMUM_OFFSET_SITES = 4;\n/** Default birefringent separation in sites: the two-spot MTF |cos(π·f·d)| then has its first zero at Nyquist, f = 1/(2·pitch). */\nconst AA_DEFAULT_SEPARATION_SITES = 1;\ninterface ParsedAntiAliasing { kind: SimulateCaptureSensorAntiAliasing[\"kind\"]; separationSites?: number; axis?: \"horizontal\" | \"vertical\";\n components: AntiAliasingPointSplitComponent[] }\n/** Parses `sensor.antiAliasing` into engine point-splitting components (offsets in µm, +x right, +y down). */\nfunction parseAntiAliasing(value: unknown, pitch: number): ParsedAntiAliasing {\n requireInputObject(value, \"sensor.antiAliasing\");\n const kind = (value as { kind?: unknown }).kind;\n const separation = (record: Record<string, unknown>): number => {\n if (record.separationSites === undefined) return AA_DEFAULT_SEPARATION_SITES;\n const d = positive(record.separationSites, \"sensor.antiAliasing.separationSites\");\n if (d > AA_MAXIMUM_OFFSET_SITES) fail(\"sensor.antiAliasing.separationSites must be greater than 0 and at most \" + AA_MAXIMUM_OFFSET_SITES + \".\");\n return d;\n };\n if (kind === \"four-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"separationSites\"]), d = separation(record), h = d * pitch / 2;\n return { kind, separationSites: d, components: [[-h, -h], [h, -h], [-h, h], [h, h]].map(([x, y]) => ({ offsetMicrometers: { x: x!, y: y! }, normalizedWeight: 0.25 })) };\n }\n if (kind === \"two-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"axis\", \"separationSites\"]), d = separation(record), h = d * pitch / 2;\n if (record.axis !== \"horizontal\" && record.axis !== \"vertical\") fail(\"sensor.antiAliasing.axis must be horizontal or vertical.\");\n const axis = record.axis as \"horizontal\" | \"vertical\";\n return { kind, axis, separationSites: d, components: [-h, h].map((o) => ({ offsetMicrometers: axis === \"horizontal\" ? { x: o, y: 0 } : { x: 0, y: o }, normalizedWeight: 0.5 })) };\n }\n if (kind === \"point-splitting\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"components\"]);\n if (!Array.isArray(record.components) || record.components.length === 0 || record.components.length > AA_MAXIMUM_COMPONENTS) {\n fail(\"sensor.antiAliasing.components must be an array of 1 to \" + AA_MAXIMUM_COMPONENTS + \" components.\");\n }\n // The engine's optical-stack parser checks shape, finiteness, positive weights and the unit sum (1e-12).\n const kernel = resolveAntiAliasingSpatialKernel({ schemaVersion: \"0.1.0\", profileId: \"facade-aa-check\", evidence: FACADE_EVIDENCE,\n effectiveAntiAliasingSpatialResponse: { kind: \"normalized-point-splitting-kernel\", evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-physical\",\n scope: \"field-wavelength-polarization-invariant-approximation\", components: record.components as AntiAliasingPointSplitComponent[] } });\n for (const c of kernel.components) if (Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)) > AA_MAXIMUM_OFFSET_SITES * pitch) {\n fail(\"sensor.antiAliasing.components offsets must lie within \" + AA_MAXIMUM_OFFSET_SITES + \" sites (\" + AA_MAXIMUM_OFFSET_SITES * pitch + \" µm) of the site centre.\");\n }\n return { kind, components: kernel.components.map((c) => ({ offsetMicrometers: { ...c.offsetMicrometers }, normalizedWeight: c.normalizedWeight })) };\n }\n return fail(\"sensor.antiAliasing.kind must be four-spot, two-spot or point-splitting.\");\n}\n\n/** Midpoint nodes of an N × N rule over a square photosite, as offsets from its centre in sites (+x right, +y down). */\nexport function apertureNodeOffsets(n: number): { x: number; y: number }[] {\n const out: { x: number; y: number }[] = [];\n for (let j = 0; j < n; j++) for (let i = 0; i < n; i++) out.push({ x: (i + 0.5) / n - 0.5, y: (j + 0.5) / n - 0.5 });\n return out;\n}\n/** Third dark ring of the Airy pattern in units of λ·N_w (j₁,₃/π, j₁,₃ = 10.1734681351): the default diffraction kernel reach. */\nconst AIRY_THIRD_ZERO_PER_LAMBDA_N = 10.173468135062722 / Math.PI;\n/** Default temporal midpoints when the camera rotates (2.0 motion option). */\nconst ROTATING_TEMPORAL_SAMPLE_COUNT = 8;\nconst IDS = Object.freeze({ frame: \"facade-frame\", mode: \"native-still\", cfa: \"photivra-generic-bayer\", binding: \"facade-native-cfa\",\n sceneState: \"facade-scene-state\", scene: \"facade-scene\", provider: \"facade-provider\", lights: \"facade-lights\", materials: \"facade-materials\",\n capture: \"facade-capture\", spectral: \"facade-colorimetric-eqe\", sampling: \"facade-sampling\", stack: \"facade-no-aa\", stackAa: \"facade-aa\",\n stationarity: \"facade-stationarity\", operatingState: \"facade-operating-state\", dark: \"facade-dark\", completeness: \"facade-completeness\",\n chargeSampling: \"facade-charge-sampling\", capacity: \"facade-capacity\" });\nexport const CHANNELS = [\"red\", \"green\", \"blue\"] as const;\ntype Channel = typeof CHANNELS[number];\n/**\n * Synthetic colorimetric sensor: channel EQE(λ) = a·cmf(λ)·(555 nm/λ), with cmf = x̄, ȳ, z̄. The λ factor turns\n * the energy-weighted CMF (colour-matching function) into a photon-counting response. So channel counts are\n * proportional to CIE XYZ (the Luther–Ives condition holds, up to quadrature error), and the camera→XYZ\n * matrix is diagonal.\n */\nconst EQE_SCALE: Readonly<Record<Channel, number>> = Object.freeze({ red: 0.5, green: 0.5, blue: 0.25 });\nconst CMF_KEY: Readonly<Record<Channel, \"x\" | \"y\" | \"z\">> = Object.freeze({ red: \"x\", green: \"y\", blue: \"z\" });\nexport const CAMERA_TO_XYZ: readonly (readonly number[])[] = Object.freeze([[EQE_SCALE.green / EQE_SCALE.red, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.green / EQE_SCALE.blue]].map((r) => Object.freeze(r)));\nconst XYZ_TO_CAMERA = [[EQE_SCALE.red / EQE_SCALE.green, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.blue / EQE_SCALE.green]] as const;\n/** Synthetic dark current per site at the operating temperature, e⁻/s. */\nexport const DARK_CURRENT_ELECTRONS_PER_SECOND = 1;\nconst OPERATING_TEMPERATURE_C = 20;\n\nexport function fail(message: string): never { throw new InvalidConfigurationError(message); }\n/** Where `output.metadata` goes in each file format (reported in the `output.metadata` assumption). */\nconst TEXT_METADATA_LAYOUT = Object.freeze({\n jpeg: \"XMP packet in APP1 (dc:description, xmp:CreatorTool, dc:rights, exif:UserComment), plus a COM segment holding the comment\",\n png: \"One tEXt (printable Latin-1) or iTXt (UTF-8) chunk per field, keywords Description, Software, Copyright, Comment, before the first IDAT\",\n dng: \"ImageDescription (statement, then the description) and Copyright when printable ASCII; an XMP packet in tag 700 with every field\"\n});\ntype ReadoutProfile = GenericEquipmentTierPreset[\"body\"][\"readout\"][number][\"profile\"];\n/**\n * The readout profile with every regime's charge-domain transfer scaled by `areaScale`: system conversion gain\n * (e⁻ per code) and pre-ADC saturation (e⁻ equivalent) are multiplied by it, so codes per unit focal-plane exposure\n * stay those of the reference aperture. Read noise stays in electrons per pixel; codes, black level, ADC and digital\n * gain are unchanged. The result is re-checked by the readout parser.\n */\nfunction isoAreaScaledReadout(profile: ReadoutProfile, areaScale: number): ReadoutProfile {\n return parseSensorReadoutConversionProfile({ ...profile, regimes: profile.regimes.map((regime) => ({ ...regime,\n systemConversionGainElectronsPerCode: { ...regime.systemConversionGainElectronsPerCode, value: regime.systemConversionGainElectronsPerCode.value * areaScale },\n preAdcSaturationElectronEquivalent: { ...regime.preAdcSaturationElectronEquivalent, value: regime.preAdcSaturationElectronEquivalent.value * areaScale } })) });\n}\n/** Diagnostic clock for the 2.1 stage timings: `performance.now()` where the host has it. Never affects output. */\nexport function clockMs(): number { return globalThis.performance?.now() ?? Date.now(); }\nfunction positive(value: unknown, name: string): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) fail(name + \" must be a positive finite number.\");\n return value as number;\n}\nfunction integerIn(value: unknown, name: string, minimum: number, maximum: number): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < minimum || value > maximum) fail(name + \" must be an integer from \" + minimum + \" to \" + maximum + \".\");\n return value as number;\n}\nexport function allowKeys(value: unknown, name: string, keys: readonly string[]): Record<string, unknown> {\n if (value === undefined) return {};\n requireInputObject(value, name);\n for (const key of Object.keys(value as object)) if (!keys.includes(key)) fail(\"Unknown \" + name + \" field: \" + key + \".\");\n return value as Record<string, unknown>;\n}\nfunction sampled(values: readonly { nm: number; value: number }[]): { wavelengthUnit: \"nm\"; wavelengthBasis: \"vacuum\"; interpolation: \"piecewise-linear\";\n outsideRangeBehavior: \"fail-closed\"; evidence: readonly EvidenceProvenance[]; samples: { wavelengthNanometers: number; value: number }[] } {\n return { wavelengthUnit: \"nm\", wavelengthBasis: \"vacuum\", interpolation: \"piecewise-linear\", outsideRangeBehavior: \"fail-closed\", evidence: FACADE_EVIDENCE,\n samples: values.map((s) => ({ wavelengthNanometers: s.nm, value: s.value })) };\n}\nasync function sha256Hex(text: string): Promise<string> {\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) fail(\"simulateCapture needs crypto.subtle (a secure browser context or Node 22+) to digest the scene description.\");\n const bytes = new Uint8Array(await subtle.digest(\"SHA-256\", new TextEncoder().encode(text)));\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * The form in which a caller spectrum enters the scene digest. Tabulated data is hashed exactly as its\n * (wavelength, value) pairs. A function spectrum has no data to hash, so it is sampled at the facade's\n * 1 nm integer nodes over 380-780 nm (the grid the facade also uses to normalize illuminance).\n */\nfunction spectrumDigestForm(raw: unknown, prepared: PreparedColorimetricSpectrum): unknown {\n const record = raw as { kind?: unknown; samples?: readonly { wavelengthNanometers: number; value: number }[] };\n if (record.kind === \"tabulated\" && Array.isArray(record.samples)) {\n return { kind: \"tabulated\", samples: record.samples.map((sample) => [sample.wavelengthNanometers, sample.value]) };\n }\n const values: number[] = [];\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) values.push(prepared.evaluate(nm));\n return { kind: \"function-sampled-1nm\", rangeNanometers: [FACADE_SPECTRAL_RANGE_NANOMETERS.minimum, FACADE_SPECTRAL_RANGE_NANOMETERS.maximum], values };\n}\nfunction luminanceOf(radiance: (nm: number) => number): number {\n let sum = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm += 5) {\n const w = nm === FACADE_SPECTRAL_RANGE_NANOMETERS.minimum || nm === FACADE_SPECTRAL_RANGE_NANOMETERS.maximum ? 2.5 : 5;\n sum += w * radiance(nm) * estimateCie1931ColorMatchingFunctions(nm).y;\n }\n return PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W * sum;\n}\n/** The white balance measured from a perfect white diffuser under the scene illuminant (\"scene-illuminant\"). */\nexport function sceneIlluminantWhiteBalance(illuminant: ResolvedCaptureIlluminant): ResolvedWhiteBalanceState {\n const xyz = illuminantXyz(illuminant), camera = XYZ_TO_CAMERA.map((row) => row[0] * xyz[0] + row[1] * xyz[1] + row[2] * xyz[2]);\n return resolveCustomWhiteBalance({ stateId: \"facade-wb-scene-illuminant\", sampleSet: { imageStateId: \"facade-white-diffuser\",\n inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples: [{ sampleId: \"white\", red: camera[0]!, green: camera[1]!, blue: camera[2]!, weight: 1, clipped: false }] } });\n}\nfunction illuminantXyz(illuminant: ResolvedCaptureIlluminant): [number, number, number] {\n let x = 0, y = 0, z = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) {\n const s = illuminant.shape.evaluate(nm), c = estimateCie1931ColorMatchingFunctions(nm);\n x += s * c.x; y += s * c.y; z += s * c.z;\n }\n return [x / y, 1, z / y];\n}\n/** Bilinear RGGB demosaic as explicit linear neighbourhood kernels (weights sum to one per output channel). */\nexport function bilinearPhaseProfiles(): RawFrameReconstructionPhaseProfile[] {\n const cross = [[1, 0], [-1, 0], [0, 1], [0, -1]], diagonal = [[1, 1], [1, -1], [-1, 1], [-1, -1]], horizontal = [[1, 0], [-1, 0]], vertical = [[0, 1], [0, -1]];\n type Contribution = { offsetX: number; offsetY: number; sourceChannelId: Channel; weight: number };\n const average = (offsets: number[][], channel: Channel): Contribution[] => offsets.map(([x, y]) => ({ offsetX: x!, offsetY: y!, sourceChannelId: channel, weight: 1 / offsets.length }));\n const self = (channel: Channel): Contribution[] => [{ offsetX: 0, offsetY: 0, sourceChannelId: channel, weight: 1 }];\n const kernels: Record<string, Record<Channel, ReturnType<typeof self>>> = {\n \"0,0\": { red: self(\"red\"), green: average(cross, \"green\"), blue: average(diagonal, \"blue\") },\n \"1,0\": { red: average(horizontal, \"red\"), green: self(\"green\"), blue: average(vertical, \"blue\") },\n \"0,1\": { red: average(vertical, \"red\"), green: self(\"green\"), blue: average(horizontal, \"blue\") },\n \"1,1\": { red: average(diagonal, \"red\"), green: average(cross, \"green\"), blue: self(\"blue\") }\n };\n return [[0, 0], [1, 0], [0, 1], [1, 1]].map(([px, py], index) => ({ phaseX: px!, phaseY: py!, profile: { schemaVersion: \"0.1.0\" as const,\n profileId: \"facade-bilinear-phase-\" + index, profileVersion: \"1\", captureModeId: IDS.mode, colorSamplingProfileId: IDS.cfa,\n scientificStatus: \"approximation\" as const, method: \"explicit-linear-native-neighborhood\" as const,\n normalization: \"weights-sum-to-one-per-output-channel\" as const, negativeBlackSubtractedValuesAllowed: true,\n kernels: CHANNELS.map((c) => ({ outputChannelId: c, contributions: kernels[px + \",\" + py]![c] })), evidence: FACADE_EVIDENCE,\n limitations: [\"Bilinear interpolation of the RGGB mosaic; no edge-directed demosaic, false-colour suppression or calibration.\"] } })) as unknown as RawFrameReconstructionPhaseProfile[];\n}\nfunction defaultProgramLine(): ExposureProgramLineProfile {\n // Generic educational program line written for the engine, relative to the f/8, 1/125 s reference. For less light\n // it first opens the aperture toward f/4, then lengthens the shutter. For more light it first closes toward\n // f/16, then shortens the shutter.\n return parseExposureProgramLineProfile({ schemaVersion: \"0.1.0\", profileId: \"facade-generic-program-line\", profileVersion: \"1.0.0\",\n scientificStatus: \"approximation\", policyKind: \"generic-program-line\", interpolation: \"log2-aperture-shutter\", evidence: FACADE_EVIDENCE,\n limitations: [\"Generic educational program line authored for the capture facade; not any manufacturer's program.\"],\n nodes: [\n { nodeId: \"minus-6\", opticalExposureStopsFromReference: -6, aperture: 16, shutterSeconds: 1 / 2000 },\n { nodeId: \"minus-2\", opticalExposureStopsFromReference: -2, aperture: 16, shutterSeconds: 1 / 125 },\n { nodeId: \"zero\", opticalExposureStopsFromReference: 0, aperture: 8, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-2\", opticalExposureStopsFromReference: 2, aperture: 4, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-9\", opticalExposureStopsFromReference: 9, aperture: 4, shutterSeconds: 128 / 125 }\n ] });\n}\n\n/** PNG colour signalling: the sRGB chunk for sRGB, ITU-T H.273 code points through cICP otherwise. */\nfunction pngColourEncoding(encoding: SimulateCaptureColorEncoding): PngColourEncoding {\n if (encoding === \"srgb\") return { kind: \"srgb\", renderingIntent: \"perceptual\" };\n if (encoding === \"display-p3\") return { kind: \"cicp\", primaries: \"display-p3\", transfer: \"srgb\", fullRange: true };\n return { kind: \"cicp\", primaries: \"bt2020\", transfer: \"bt709\", fullRange: true };\n}\n/**\n * Develops the packed RAW to unclipped linear sRGB/D65, using the exact operator inside\n * `createNativeRawDevelopmentTask`. Validation, demosaic kernels, border handling, per-site white-level\n * clipping, white balance, highlight mode and the camera→XYZ→linear-sRGB matrices are all the same. It\n * stops before tone mapping, gamut clipping and quantization. It reads the RAW without taking ownership.\n */\nasync function developLinearSrgb(input: NativeRawDevelopmentInput, afterRow: (completed: number, total: number) => Promise<void>,\n ahd?: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const v = prepareNativeRawDevelopment(input), plan = v.plan, raw = input.raw, layout = plan.frame.colorSamplingProfile.layout;\n if (layout.kind !== \"periodic-mosaic\") fail(\"Development requires a periodic CFA.\");\n const native = plan.exposure.geometry.nativeRaster, g = plan.exposure.resolvedGeometry, active = g.activeCapture.nativeRect;\n checkNativeRawIntegrity(raw, native.pixelWidth, layout.repeatWidthSites, layout.repeatHeightSites, 0, native.pixelHeight);\n const developer = createRawPixelDeveloper({ nativeWidth: native.pixelWidth, repeatWidth: layout.repeatWidthSites, repeatHeight: layout.repeatHeightSites,\n codes: raw.codes, blackLevels: raw.blackLevels, saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes }, v.phases, v.development, v.mirror);\n const width = v.raster.pixelWidth, height = v.raster.pixelHeight, rgb = new Float64Array(width * height * 3), row = new Float64Array(width * 3);\n const at = (x: number, y: number): { x: number; y: number } => {\n const q = transformOrientedRasterPointToNative({ point: { x: v.crop.x + x + 0.5, y: v.crop.y + y + 0.5 }, nativeRaster: g.activeCapture.raster, orientation: plan.exposure.geometry.orientation });\n return { x: Math.floor(q.x) + active.x, y: Math.floor(q.y) + active.y };\n };\n if (ahd) return developAhd(v, raw, layout.repeatWidthSites, layout.repeatHeightSites, width, height, at, afterRow, ahd);\n for (let y = 0; y < height; y++) {\n const first = at(0, y), second = width > 1 ? at(1, y) : first;\n developer.developRun(first.x, first.y, second.x - first.x, second.y - first.y, width, row);\n rgb.set(row, y * width * 3);\n await afterRow(y + 1, height);\n }\n const c = developer.counts;\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: c.saturatedPixelCount, whiteBalanceClippedSampleCount: c.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: c.reconstructedPixelCount } };\n}\n/**\n * AHD development (2.1): the same site normalization as the native development kernel (flagged or white-level sites\n * are 1, others (code − black)/(white − black)) on the whole native raster, demosaiced by `createAhdDemosaicTask`\n * (mirrored plane edges), then the native development's own colour operator (`developInto`: WB, highlight mode,\n * camera → XYZ → linear sRGB) per output pixel. The AHD homogeneity metric sees white-balanced colour: its\n * camera → XYZ matrix is the profile's matrix times the WB gains (the output values are not transformed by it).\n * The mosaic is stored in float32, as the AHD task requires.\n */\nasync function developAhd(v: ReturnType<typeof prepareNativeRawDevelopment>, raw: NativeRawOutput, repeatWidth: number, repeatHeight: number, width: number, height: number,\n at: (x: number, y: number) => { x: number; y: number }, afterRow: (completed: number, total: number) => Promise<void>,\n host: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const native = v.plan.exposure.geometry.nativeRaster, W = native.pixelWidth, H = native.pixelHeight;\n const source: RawDevelopmentSource = { nativeWidth: W, repeatWidth, repeatHeight, codes: raw.codes, blackLevels: raw.blackLevels,\n saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes };\n const samples = new Float32Array(W * H), saturated = new Uint8Array(W * H);\n for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {\n samples[y * W + x] = normalizedRawSite(source, x, y);\n if (rawSiteSaturated(source, x, y)) saturated[y * W + x] = 1;\n }\n const intent = v.plan.exposure.whiteBalanceIntent, gains = intent ? [intent.channelGains.red, intent.channelGains.green, intent.channelGains.blue] : [1, 1, 1];\n const m = v.color.normalizedCameraChannelsToXyz;\n const cameraToXyz = [0, 1, 2].map((r) => [0, 1, 2].map((c) => m[r]![c]! * gains[c]!)) as unknown as ColorMatrix3x3;\n // A caller-raised pixel limit already bounds the raster, so its working memory is not capped again at the 1 GiB default.\n const task = createAhdDemosaicTask({ plane: { width: W, height: H, captureModeId: v.plan.frame.modeId, colorSamplingProfile: v.plan.frame.colorSamplingProfile, samples },\n channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" }, cameraToXyz, ...(v.plan.maximumPixels === undefined ? {} : { maximumWorkingBytes: Number.MAX_SAFE_INTEGER }) }, { yieldControl: async () => { await host.yieldControl(); host.checkAbort(); } });\n const demosaicStarted = clockMs();\n await task.run();\n host.onDemosaicMs?.(clockMs() - demosaicStarted);\n const demosaiced = task.takeOutput().data, rgb = new Float64Array(width * height * 3);\n const counts = { saturatedPixelCount: 0, whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 };\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const p = at(x, y), i = p.y * W + p.x;\n let clipped = false;\n for (let dy = -AHD_VALUE_REACH; dy <= AHD_VALUE_REACH && !clipped; dy++) for (let dx = -AHD_VALUE_REACH; dx <= AHD_VALUE_REACH; dx++) {\n const sx = p.x + dx, sy = p.y + dy;\n if (sx >= 0 && sy >= 0 && sx < W && sy < H && saturated[sy * W + sx] !== 0) { clipped = true; break; }\n }\n if (clipped) counts.saturatedPixelCount++;\n v.development.developInto(demosaiced[3 * i]!, demosaiced[3 * i + 1]!, demosaiced[3 * i + 2]!, rgb, (y * width + x) * 3, counts);\n }\n await afterRow(y + 1, height);\n }\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: counts.saturatedPixelCount, whiteBalanceClippedSampleCount: counts.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: counts.reconstructedPixelCount } };\n}\n/** Linear sRGB/D65 → CIE XYZ (inverse of the development's XYZ → sRGB matrix) → linear target RGB/D65. */\nfunction linearSrgbToTarget(target: \"srgb\" | \"display-p3\" | \"rec2020\"): readonly (readonly number[])[] {\n return multiplyMatrices(resolveRgbColorSpace(target).value.xyzToRgb, resolveCaptureColorModel().cameraRgbToXyz as unknown as ColorMatrix3x3);\n}\n/** Knee of the `perceptual` gamut mapping: chroma below 90 % of the gamut-boundary chroma (at constant L*, h) is untouched. */\nconst PERCEPTUAL_GAMUT_KNEE_FRACTION = 0.9;\n/**\n * SDR encoding from linear sRGB/D65:\n * 1. Convert to the target primaries with a matrix.\n * 2. Either clip each component to [0, 1], or, with `mapping`, compress chroma while keeping CIELAB hue\n * and lightness (`prepareRgbGamutMapping`).\n * 3. Apply the target transfer function and round to the nearest code (ties round up).\n */\nfunction encodeSdrFromLinear(rgb: Float64Array, encoding: \"srgb\" | \"display-p3\" | \"rec2020\", bitDepth: 8 | 16, mapping?: PreparedRgbGamutMapping):\n { samples: Uint8Array | Uint16Array; diagnostics: SdrRenderingResult[\"diagnostics\"]; adjustedPixelCount: number; lightnessClippedPixelCount: number } {\n const m = linearSrgbToTarget(encoding), toXyz = resolveCaptureColorModel().cameraRgbToXyz, maximum = 2 ** bitDepth - 1;\n const transfer = encoding === \"rec2020\" ? evaluateBt709Oetf : evaluateSrgbEncoding;\n const samples = bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n let low = 0, high = 0, adjusted = 0, lightnessClipped = 0;\n for (let i = 0; i < rgb.length; i += 3) {\n const r = rgb[i]!, g = rgb[i + 1]!, b = rgb[i + 2]!;\n if (mapping) {\n const xyz = [0, 1, 2].map((k) => toXyz[k]![0]! * r + toXyz[k]![1]! * g + toXyz[k]![2]! * b) as unknown as ColorVector3;\n const mapped = mapping.map(xyz);\n if (mapped.adjusted) adjusted++;\n if (mapped.lightnessClipped) lightnessClipped++;\n for (let k = 0; k < 3; k++) samples[i + k] = Math.floor(transfer(mapped.linearRgb[k]!) * maximum + 0.5);\n continue;\n }\n for (let k = 0; k < 3; k++) {\n const row = m[k]!;\n let value = row[0]! * r + row[1]! * g + row[2]! * b;\n if (value < 0) { value = 0; low++; } else if (value > 1) { value = 1; high++; }\n samples[i + k] = Math.floor(transfer(value) * maximum + 0.5);\n }\n }\n return { samples, adjustedPixelCount: adjusted, lightnessClippedPixelCount: lightnessClipped, diagnostics: { renderingNegativeSampleCount: low,\n renderingAboveReferenceSampleCount: high, toneChangedSampleCount: 0, gamutClippedLowSampleCount: low, gamutClippedHighSampleCount: high, captureSaturation: \"consumed-in-raw-development\" } };\n}\n\n/**\n * Simulates one still capture of a planar scene and returns the developed image, the packed RAW, the full\n * underlying request/plan, provenance and every assumption made. See docs/QUICK_START.md.\n */\nexport async function simulateCapture(options: SimulateCaptureOptions): Promise<SimulateCaptureResult> {\n return await runCapture(options, \"capture\") as SimulateCaptureResult;\n}\n\n/**\n * The ideal reference of a capture request (2.3): the same scene, framing, chart size, output size, region and pixel\n * grid as `simulateCapture(options)` would use, rendered with no camera effects (no lens blur, diffraction, defocus,\n * distortion, vignetting, anti-aliasing filter, mosaic or demosaic, noise, dark signal or motion), at the capture's\n * own exposure and developed with its white balance, colour matrices, tone curve and encoding (the\n * `reference.exposure` assumption). Deterministic and cheap: no RAW is simulated. Formats srgb-8, srgb-16 and png.\n * The result is labelled `kind: \"ideal-reference\"`; it is not a capture.\n * @see docs/QUICK_START.md, \"Ideal reference\".\n */\nexport async function simulateIdealReference(options: SimulateCaptureOptions): Promise<IdealReferenceResult> {\n return await runCapture(options, \"ideal-reference\") as IdealReferenceResult;\n}\n\n/** Result of {@link simulateIdealReference}: an ideal reference image, not a capture (no RAW, plan or request). */\nexport interface IdealReferenceResult {\n kind: \"ideal-reference\";\n /** Human-readable label for a user interface. */\n label: string;\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: { width: number; height: number; format: SimulateCaptureOutputFormat; samples: Uint8Array | Uint16Array; png?: Uint8Array; colorEncoding?: SimulateCaptureColorEncoding };\n /** The resolved exposure of the capture this reference matches. */\n exposure: { mode: SimulateCaptureExposureMode; settings: { fNumber: number; shutterSeconds: number; iso: number }; ev100: number };\n scene: SimulateCaptureResult[\"scene\"];\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number };\n diagnostics: { sampleCount: number; timingsMs: { reference: number; total: number } };\n provenance: { scientificStatus: \"approximation\"; cameraPresetId: string; cameraPresetVersion: string; evidence: readonly EvidenceProvenance[];\n composedContracts: readonly string[]; limitations: readonly string[] };\n /** The capture request's assumptions, then `reference.kind`, `reference.excludes`, `reference.exposure` and `reference.sampling`. */\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\n/** Default stratified samples per axis of a display view (`view.samplesPerAxis`): 16 × 16 sampled real pixels per display pixel with detail, 4 × 4 where it is uniform. */\nexport const SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS = 16;\n/** The display size and sampling of {@link simulateDisplayView}. */\nexport interface SimulateDisplayViewOptions {\n /** Display pixels, 1 to the capture's output width and height. */\n width: number;\n height: number;\n /** Stratified Monte Carlo samples per axis for each display pixel's expected value (1–32, default 8: 64 real pixels). */\n samplesPerAxis?: number;\n /** \"srgb-8\" (default) or \"srgb-16\". */\n format?: \"srgb-8\" | \"srgb-16\";\n /** Render only this rectangle of the display view, in display pixels; byte-identical to the same pixels of the whole view. */\n region?: { x: number; y: number; width: number; height: number };\n}\n/** Result of {@link simulateDisplayView}: the full-resolution capture resized for display, estimated; not a capture. */\nexport interface DisplayViewResult {\n kind: \"display-view\";\n /** Human-readable label for a user interface. */\n label: string;\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n /** The display view (or its region): interleaved sRGB samples, row by row from the top-left. */\n image: { width: number; height: number; format: \"srgb-8\" | \"srgb-16\"; samples: Uint8Array | Uint16Array };\n /**\n * The view: display size, the capture frame it shows (output pixels), real pixels per display pixel along each axis,\n * the samples per axis and, with `view.region`, the rendered rectangle.\n */\n view: { width: number; height: number; frameWidth: number; frameHeight: number; scaleX: number; scaleY: number; samplesPerAxis: number;\n region?: { x: number; y: number; width: number; height: number } };\n /** The resolved exposure of the capture this view shows. */\n exposure: { mode: SimulateCaptureExposureMode; settings: { fNumber: number; shutterSeconds: number; iso: number }; ev100: number };\n scene: SimulateCaptureResult[\"scene\"];\n /**\n * Work done: real pixels sampled, real-site expectations evaluated, scene queries, display pixels sampled in full (detail) or with\n * a quarter of the samples per axis (uniform), display pixels whose value includes the AHD low-signal correction, and wall-clock\n * milliseconds (diagnostic only; never affects the samples).\n */\n diagnostics: { sampleCount: number; siteEvaluations: number; sceneLookups: number; detailPixelCount: number; uniformPixelCount: number; ahdCorrectedPixelCount: number;\n timingsMs: { view: number; total: number } };\n provenance: { scientificStatus: \"approximation\"; cameraPresetId: string; cameraPresetVersion: string; evidence: readonly EvidenceProvenance[];\n composedContracts: readonly string[]; limitations: readonly string[] };\n /** The capture request's assumptions, then `view.definition`, `view.estimation`, `view.noise`, `view.demosaic` and `view.source`. */\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\n/** Internal: the resolved request state that the display view's renderer (simulate-display-view.ts) reads. */\nexport interface DisplayViewRunContext {\n ahd: boolean;\n antiAliasing: ParsedAntiAliasing | undefined;\n aspect: number;\n assume: (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string) => void;\n assumptions: SimulateCaptureAssumption[];\n axisChannelResponse: (caller: string) => { electronsPerRadiance: Record<Channel, Map<number, number>>; wavelengths: number[]; relativePerElectron: Record<Channel, number>; };\n boxSamples: number;\n buildProvider: (sceneIlluminant: ResolvedCaptureIlluminant, scale: number) => PlanarSceneRadianceProvider;\n callerScene: ResolvedCallerScene | undefined;\n chart: ResolvedChartScene | undefined;\n chartReport: { widthM: number; heightM: number; surroundReflectance: number; frameWidthFraction: number; frameHeightFraction: number; magnification: number; imageWidthMm: number; imageHeightMm: number; imageWidthPixels: number; imageHeightPixels: number; } | undefined;\n chartSize: { widthM: number; heightM: number; surroundReflectance: number; defaulted: (\"heightM\" | \"surroundReflectance\")[]; } | undefined;\n diffraction: DiffractionLimitedPsfProfile | undefined;\n diffractionPsf: { kind: \"sampled-local\"; configuration: Pick<CalculateSensorPsfIrradianceQuadratureInput, \"psf\" | \"psfWavelengthBasis\" | \"spatialModel\">; } | undefined;\n fNumber: number;\n focalLengthMm: number;\n focusDistanceM: number;\n height: number;\n highlightMode: RawHighlightMode;\n illuminanceLux: number;\n illuminant: ResolvedCaptureIlluminant;\n illuminantOption: CaptureIlluminant;\n imagingArea: { widthMm: number; heightMm: number; };\n intentOf: (state: ResolvedWhiteBalanceState | null) => CaptureWhiteBalanceIntent | null;\n metresPerFrameUnit: number;\n noiseSeed: number;\n outputOptions: Record<string, unknown>;\n parsedView: ParsedDisplayView | undefined;\n pitch: number;\n preset: GenericEquipmentTierPreset;\n provider: PlanarSceneRadianceProvider;\n regimeByChannel: Record<\"red\" | \"green\" | \"blue\", { readoutProfile: ReadoutProfile; regimeId: string; }>;\n resolvedIso: number;\n sceneOption: unknown;\n scenePreset: \"composite\" | \"uniform\" | \"patches\" | \"slanted-edge\" | \"siemens-star\" | \"step-wedge\" | \"grey-ramp\" | \"checkerboard\" | \"point-grid\" | \"dead-leaves\" | \"bar-groups\" | \"hyperbolic-wedge\" | \"zone-plate\" | \"slanted-squares\" | \"line-grid\" | \"fiducial\" | \"reflectance-function\" | \"radiance-function\" | \"material-function\";\n shutterSeconds: number;\n started: number;\n subjectDistanceM: number;\n toneCurve: SdrToneCurve;\n whiteBalanceOption: SimulateCaptureWhiteBalance;\n whiteBalanceState: ResolvedWhiteBalanceState | null;\n width: number;\n checkAbort: () => void;\n margin: number;\n mode: SimulateCaptureExposureMode;\n nativeHeight: number;\n nativeWidth: number;\n sourceSha256: string;\n yieldControl: () => Promise<void>;\n /** The Kelvin white balance request, which the view resolves with the portable functions. */\n kelvinWhiteBalanceInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] | undefined;\n}\nexport interface ParsedDisplayView { width: number; height: number; samplesPerAxis: number; bitDepth: 8 | 16; format: \"srgb-8\" | \"srgb-16\"; region?: { x: number; y: number; width: number; height: number } }\n/** Internal: validates a display view against the capture's output size and fills its defaults. */\nexport function parseDisplayViewOption(value: unknown, frameWidth: number, frameHeight: number): ParsedDisplayView {\n if (value === undefined) fail(\"simulateDisplayView needs a view, for example { width: 384, height: 256 }.\");\n const v = allowKeys(value, \"view\", [\"width\", \"height\", \"samplesPerAxis\", \"format\", \"region\"]);\n const width = integerIn(v.width, \"view.width\", 1, frameWidth), height = integerIn(v.height, \"view.height\", 1, frameHeight);\n const samplesPerAxis = v.samplesPerAxis === undefined ? SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS : integerIn(v.samplesPerAxis, \"view.samplesPerAxis\", 1, 32);\n const format = v.format === undefined ? \"srgb-8\" : v.format;\n if (format !== \"srgb-8\" && format !== \"srgb-16\") fail(\"view.format must be srgb-8 or srgb-16.\");\n let region: ParsedDisplayView[\"region\"];\n if (v.region !== undefined) {\n const r = allowKeys(v.region, \"view.region\", [\"x\", \"y\", \"width\", \"height\"]);\n const x = integerIn(r.x, \"view.region.x\", 0, width - 1), y = integerIn(r.y, \"view.region.y\", 0, height - 1);\n region = { x, y, width: integerIn(r.width, \"view.region.width\", 1, width - x), height: integerIn(r.height, \"view.region.height\", 1, height - y) };\n }\n return { width, height, samplesPerAxis, bitDepth: format === \"srgb-8\" ? 8 : 16, format: format as \"srgb-8\" | \"srgb-16\", ...(region ? { region } : {}) };\n}\n\n/** Internal: passed as the view of a \"display-view\" run to resolve the request without a view (`prepareDisplayView`, #387). */\nexport const DISPLAY_VIEW_WITHOUT_VIEW: unique symbol = Symbol(\"display view without view\");\n/**\n * Internal: the request path shared by {@link simulateCapture}, {@link simulateIdealReference} and the display view, whose renderer is\n * passed in; for a display view the renderer's value is returned (a result, or a prepared view with DISPLAY_VIEW_WITHOUT_VIEW).\n */\nexport async function runCapture(options: SimulateCaptureOptions, run: \"capture\" | \"ideal-reference\" | \"display-view\", viewOption?: unknown,\n renderView?: (context: DisplayViewRunContext) => Promise<unknown>):\n Promise<unknown> {\n const started = Date.now(), idealReference = run === \"ideal-reference\", displayView = run === \"display-view\";\n requireInputObject(options, \"simulateCapture options\");\n const top = allowKeys(options, \"simulateCapture options\", [\"camera\", \"lens\", \"exposure\", \"scene\", \"subjectDistanceM\", \"chartSize\", \"illuminant\",\n \"illuminanceLux\", \"output\", \"sensor\", \"motion\", \"signal\", \"onProgress\"]);\n const signal = top.signal as AbortSignal | undefined, onProgress = top.onProgress as SimulateCaptureOptions[\"onProgress\"];\n if (signal !== undefined && (typeof signal !== \"object\" || signal === null || typeof (signal as AbortSignal).aborted !== \"boolean\")) fail(\"signal must be an AbortSignal.\");\n if (onProgress !== undefined && typeof onProgress !== \"function\") fail(\"onProgress must be a function.\");\n const assumptions: SimulateCaptureAssumption[] = [];\n const assume = (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string): void => { assumptions.push({ id, kind, value, explanation }); };\n function pick<T>(record: Record<string, unknown>, key: string, path: string, fallback: T, explanation: string): T {\n if (record[key] !== undefined) return record[key] as T;\n assume(path, \"default\", fallback, explanation);\n return fallback;\n }\n const checkAbort = (): void => { if (signal?.aborted) fail(\"simulateCapture aborted.\"); };\n checkAbort();\n\n // Camera\n const cameraOption = pick<GenericEquipmentTier | GenericEquipmentTierPreset>(top, \"camera\", \"camera\", DEFAULTS.camera,\n \"Generic Photivra tier preset 2.0.0 (synthetic educational values, not a real camera).\");\n let preset: GenericEquipmentTierPreset;\n if (typeof cameraOption === \"string\") preset = GENERIC_TIER_ASSETS.find((p) => p.tier === cameraOption) ?? fail(\"Unknown camera tier.\");\n else preset = parseCallerCameraPreset(cameraOption);\n const body = preset.body, lens = preset.lens;\n\n // Lens\n const lensOptions = allowKeys(top.lens, \"lens\", [\"focalLengthMm\", \"fNumber\", \"focusDistanceM\", \"pupilSampling\", \"projection\", \"distortion\", \"vignetting\", \"psf\", \"diffraction\", \"prime\"]);\n // Generic prime (2.3): resolved on the simulated frame's size, which the output and sensor sections validate again below.\n let prime: GenericPrimeLens | undefined;\n if (lensOptions.prime !== undefined) {\n if (lensOptions.focalLengthMm !== undefined) fail(\"lens.prime and lens.focalLengthMm cannot both be given: the prime sets the focal length.\");\n const o = (typeof top.output === \"object\" && top.output !== null ? top.output : {}) as Record<string, unknown>, sn = (typeof top.sensor === \"object\" && top.sensor !== null ? top.sensor : {}) as Record<string, unknown>;\n const frameW = positive(o.width ?? DEFAULTS.width, \"output.width\"), frameH = positive(o.height ?? DEFAULTS.height, \"output.height\"), framePitch = positive(sn.pixelPitchMicrometers ?? DEFAULTS.pixelPitchMicrometers, \"sensor.pixelPitchMicrometers\");\n if (typeof lensOptions.prime !== \"number\") fail(\"lens.prime must be a generic prime's full-frame-equivalent focal length in mm.\");\n prime = resolveGenericPrimeLens({ equivalentFocalLengthMm: lensOptions.prime as number, activeImagingArea: { widthMm: frameW * framePitch / 1000, heightMm: frameH * framePitch / 1000 } });\n assume(\"lens.prime\", \"model\", { lensId: prime.lensId, equivalentFocalLengthMm: prime.equivalentFocalLengthMm, focalLengthMm: prime.focalLengthMm, cropFactor35Mm: prime.cropFactor35Mm,\n widestFNumber: prime.widestFNumber, narrowestFNumber: prime.narrowestFNumber, minimumFocusDistanceM: prime.minimumFocusDistanceM },\n \"Generic prime (not a real product): focal length = equivalent ÷ the simulated frame's diagonal crop factor, f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber +\n \", minimum focus max(0.10 m, f·(1 + 1/0.15)) (thin-lens approximation). It replaces the tier lens's focal length and f-number range; the tier lens's transmission is kept.\");\n }\n const lensExposure = prime ? { ...lens.exposure, profileId: \"photivra-\" + prime.lensId + \":exposure\",\n focalLengthMmRange: { ...lens.exposure.focalLengthMmRange, value: { minimum: prime.focalLengthMm, maximum: prime.focalLengthMm } },\n aperture: { ...lens.exposure.aperture, widestAvailableFNumber: { kind: \"constant\" as const, fNumber: { value: prime.widestFNumber, evidence: FACADE_EVIDENCE } },\n narrowestAvailableFNumber: { value: prime.narrowestFNumber, evidence: FACADE_EVIDENCE } } } as typeof lens.exposure : lens.exposure;\n const focalDefault = lensExposure.focalLengthMmRange.value.minimum;\n const focalLengthMm = prime ? prime.focalLengthMm :\n positive(pick(lensOptions, \"focalLengthMm\", \"lens.focalLengthMm\", focalDefault, \"The preset lens's focal length (the generic primes are 50 mm).\"), \"lens.focalLengthMm\");\n const capabilities = resolveGenericEquipmentExposureCapabilities({ bodyProfile: body.exposure, lensProfile: lensExposure, selectedFocalLengthMm: focalLengthMm });\n const subjectDistanceM = positive(pick(top, \"subjectDistanceM\", \"subjectDistanceM\", DEFAULTS.subjectDistanceM, \"Scene plane 5 m in front of the camera (the generic tiers' reference focus distance).\"), \"subjectDistanceM\");\n if (subjectDistanceM * 1000 <= focalLengthMm * 2) fail(\"subjectDistanceM must exceed twice the focal length.\");\n const focusDistanceM = positive(pick(lensOptions, \"focusDistanceM\", \"lens.focusDistanceM\", subjectDistanceM, \"Focused on the scene plane.\"), \"lens.focusDistanceM\");\n if (focusDistanceM * 1000 <= focalLengthMm) fail(\"lens.focusDistanceM must exceed the focal length.\");\n if (prime && (subjectDistanceM < prime.minimumFocusDistanceM || focusDistanceM < prime.minimumFocusDistanceM))\n fail(\"The \" + prime.lensId + \" focuses no closer than \" + prime.minimumFocusDistanceM + \" m (max(0.10 m, f·(1 + 1/0.15))); subjectDistanceM and lens.focusDistanceM must be at least that.\");\n let pupil: { radialSamples: number; angularSamples: number } | undefined;\n if (lensOptions.pupilSampling === undefined) assume(\"lens.pupilSampling\", \"default\", null,\n \"No pupil sampling: each scene query follows the central (chief) ray, so defocus and depth of field are not rendered. Enable lens.pupilSampling for an ideal circular pupil.\");\n else {\n const p = allowKeys(lensOptions.pupilSampling, \"lens.pupilSampling\", [\"radialSamples\", \"angularSamples\"]);\n // The environment pupil contract admits 4..64 azimuthal midpoints and at most 256 rays.\n pupil = { radialSamples: integerIn(p.radialSamples, \"lens.pupilSampling.radialSamples\", 1, 16), angularSamples: integerIn(p.angularSamples, \"lens.pupilSampling.angularSamples\", 4, 64) };\n if (pupil.radialSamples * pupil.angularSamples > 256) fail(\"lens.pupilSampling needs at most 256 rays (radialSamples × angularSamples).\");\n }\n // 2.0 optics hooks: only what the environment site contract accepts.\n const projection: LensProjectionModel | undefined = lensOptions.projection === undefined ? undefined : parseLensProjectionModel(lensOptions.projection);\n let distortion: SimulateCaptureLensDistortion | undefined;\n if (lensOptions.distortion !== undefined) {\n const d = allowKeys(lensOptions.distortion, \"lens.distortion\", [\"kind\", \"profile\"]);\n if (d.kind !== \"radial\" && d.kind !== \"brown-conrady\") fail(\"lens.distortion.kind must be radial or brown-conrady.\");\n distortion = d as unknown as SimulateCaptureLensDistortion;\n }\n const lensFieldMapping: EnvironmentLensFieldMapping | undefined = projection === undefined && distortion === undefined ? undefined :\n { projectionModel: projection ?? \"rectilinear\", distortion: distortion ?? { kind: \"none\" }, radiometricAreaCorrection: \"inverse-distortion-jacobian\" };\n if (lensFieldMapping) {\n if (pupil) fail(\"lens.projection and lens.distortion cannot be combined with lens.pupilSampling: ideal pupil rays use the rectilinear, distortion-free projection.\");\n try { prepareEnvironmentLensFieldMapping(lensFieldMapping); } catch (error) { fail(\"Invalid lens projection or distortion: \" + (error as Error).message); }\n }\n let vignetting: IlluminationVignettingProfile | undefined;\n if (lensOptions.vignetting !== undefined) { requireInputObject(lensOptions.vignetting, \"lens.vignetting\"); vignetting = lensOptions.vignetting as IlluminationVignettingProfile; }\n let lensPsf: NonNullable<NonNullable<SimulateCaptureOptions[\"lens\"]>[\"psf\"]> | undefined;\n if (lensOptions.psf !== undefined) {\n const p = allowKeys(lensOptions.psf, \"lens.psf\", [\"kind\", \"configuration\"]);\n if (p.kind !== \"sampled-local\") fail(\"lens.psf.kind must be sampled-local.\");\n requireInputObject(p.configuration, \"lens.psf.configuration\");\n if (pupil) fail(\"lens.psf cannot be combined with lens.pupilSampling: geometric defocus would be counted twice.\");\n lensPsf = p as unknown as typeof lensPsf;\n }\n // Diffraction (2.1): validated here, built once the f-number is resolved.\n let diffractionRadiusOption: number | null | undefined;\n if (lensOptions.diffraction !== undefined) {\n const d = lensOptions.diffraction;\n if (d === \"circular-aperture\") diffractionRadiusOption = null;\n else {\n const record = allowKeys(d, \"lens.diffraction\", [\"aperture\", \"kernelRadiusSamples\"]);\n if (record.aperture !== \"circular-aperture\") fail(\"lens.diffraction must be \\\"circular-aperture\\\" or { aperture: \\\"circular-aperture\\\", kernelRadiusSamples }.\");\n diffractionRadiusOption = record.kernelRadiusSamples === undefined ? null : integerIn(record.kernelRadiusSamples, \"lens.diffraction.kernelRadiusSamples\", 0, 32);\n }\n if (lensPsf) fail(\"lens.diffraction cannot be combined with lens.psf: diffraction would be counted twice.\");\n if (pupil) fail(\"lens.diffraction cannot be combined with lens.pupilSampling: the environment contract does not mix a sampled PSF with pupil rays.\");\n }\n\n // Motion (2.0): constant camera rotation and the shutter type.\n const motionOptions = allowKeys(top.motion, \"motion\", [\"angularVelocityRadPerSec\", \"shutter\", \"rollingShutterSkewSeconds\"]);\n const angular = { pitch: 0, yaw: 0, roll: 0 };\n if (motionOptions.angularVelocityRadPerSec !== undefined) {\n const a = allowKeys(motionOptions.angularVelocityRadPerSec, \"motion.angularVelocityRadPerSec\", [\"pitch\", \"yaw\", \"roll\"]);\n for (const axis of [\"pitch\", \"yaw\", \"roll\"] as const) if (a[axis] !== undefined) {\n const value = a[axis];\n if (typeof value !== \"number\" || !Number.isFinite(value) || Math.abs(value) > 100) fail(\"motion.angularVelocityRadPerSec.\" + axis + \" must be a finite number within ±100 rad/s.\");\n angular[axis] = value as number;\n }\n }\n const rotating = angular.pitch !== 0 || angular.yaw !== 0 || angular.roll !== 0;\n const shutterKind = motionOptions.shutter === undefined ? \"global\" : motionOptions.shutter;\n if (shutterKind !== \"global\" && shutterKind !== \"rolling\") fail(\"motion.shutter must be global or rolling.\");\n if (motionOptions.rollingShutterSkewSeconds !== undefined && shutterKind !== \"rolling\") fail(\"motion.rollingShutterSkewSeconds needs motion.shutter \\\"rolling\\\".\");\n const rollingSkewOption = motionOptions.rollingShutterSkewSeconds === undefined ? undefined : positive(motionOptions.rollingShutterSkewSeconds, \"motion.rollingShutterSkewSeconds\");\n // Diffraction runs as an object-space convolution when every PSF tap's source is another site centre seen\n // through one linear map (still camera, rectilinear, no distortion or field throughput); otherwise per tap.\n const diffractionObjectSpace = diffractionRadiusOption !== undefined && !rotating && !lensFieldMapping && !vignetting;\n\n // Output and sensor\n const outputOptions = allowKeys(top.output, \"output\", [\"width\", \"height\", \"format\", \"toneCurve\", \"toneCurveParameters\", \"highlightMode\", \"whiteBalance\", \"jpegQuantizationStep\",\n \"colorEncoding\", \"bitDepth\", \"gamutMapping\", \"demosaic\", \"borderHandling\", \"dng\", \"maximumPixels\", \"region\", \"metadata\"]);\n // Opt-in large images: a caller-raised native pixel limit. Without it the 4094-pixel sides are unchanged.\n const raisedPixels = outputOptions.maximumPixels === undefined ? undefined : integerIn(outputOptions.maximumPixels, \"output.maximumPixels\", 1, NATIVE_RAW_LIMITS.ceilingPixels);\n const maximumSide = raisedPixels === undefined ? 4094 : NATIVE_RAW_LIMITS.maximumDimension;\n const width = integerIn(pick(outputOptions, \"width\", \"output.width\", DEFAULTS.width, \"64 × 64 output pixels.\"), \"output.width\", 1, maximumSide);\n const height = integerIn(pick(outputOptions, \"height\", \"output.height\", DEFAULTS.height, \"64 × 64 output pixels.\"), \"output.height\", 1, maximumSide);\n const format = pick<SimulateCaptureOutputFormat>(outputOptions, \"format\", \"output.format\", DEFAULTS.format, \"8-bit sRGB samples.\");\n if (![\"srgb-8\", \"srgb-16\", \"jpeg\", \"png\", \"dng\"].includes(format)) fail(\"output.format must be srgb-8, srgb-16, jpeg, png or dng.\");\n let dngCapturedAtUtc: string | undefined;\n if (format === \"dng\") {\n const d = allowKeys(outputOptions.dng, \"output.dng\", [\"capturedAtUtc\"]);\n dngCapturedAtUtc = d.capturedAtUtc as string | undefined;\n if (dngCapturedAtUtc === undefined) assume(\"output.dng.capturedAtUtc\", \"default\", null, \"No capture time: the DNG carries no DateTimeOriginal (the engine never invents a wall clock).\");\n } else if (outputOptions.dng !== undefined) fail(\"output.dng applies only to output.format \\\"dng\\\".\");\n const textMetadata = parseOutputTextMetadata(outputOptions.metadata, \"output.metadata\");\n if (textMetadata && format !== \"jpeg\" && format !== \"png\" && format !== \"dng\") fail(\"output.metadata applies only to output.format \\\"jpeg\\\", \\\"png\\\" or \\\"dng\\\".\");\n const assumeTextMetadata = (layout: string): void => {\n if (textMetadata) assume(\"output.metadata\", \"model\", { fields: Object.keys(textMetadata), layout },\n \"The caller's text, written unchanged; the engine adds no text of its own (in the DNG the description follows the existing simulated-RAW statement). Without output.metadata the file is byte-identical to 2.3.\");\n };\n let colorEncoding: SimulateCaptureColorEncoding | undefined, pngBitDepth: 8 | 16 | undefined;\n if (format === \"png\") {\n colorEncoding = pick<SimulateCaptureColorEncoding>(outputOptions, \"colorEncoding\", \"output.colorEncoding\", \"srgb\",\n \"sRGB (W3C CSS Color 4 srgb) samples signalled with the PNG sRGB chunk (perceptual intent) and its prescribed gAMA/cHRM values.\");\n if (![\"srgb\", \"display-p3\", \"rec2020\"].includes(colorEncoding)) fail(\"output.colorEncoding must be srgb, display-p3 or rec2020.\");\n pngBitDepth = pick<8 | 16>(outputOptions, \"bitDepth\", \"output.bitDepth\", 8, \"8 bits per sample.\");\n if (pngBitDepth !== 8 && pngBitDepth !== 16) fail(\"output.bitDepth must be 8 or 16.\");\n } else if (outputOptions.colorEncoding !== undefined || outputOptions.bitDepth !== undefined) fail(\"output.colorEncoding and output.bitDepth apply only to output.format \\\"png\\\".\");\n let perceptual = false;\n if (format === \"png\") {\n const gamutMapping = pick<\"clip\" | \"perceptual\">(outputOptions, \"gamutMapping\", \"output.gamutMapping\", \"clip\", \"Out-of-gamut components are clipped to [0, 1] in the target space.\");\n if (gamutMapping !== \"clip\" && gamutMapping !== \"perceptual\") fail(\"output.gamutMapping must be clip or perceptual.\");\n perceptual = gamutMapping === \"perceptual\";\n } else if (outputOptions.gamutMapping !== undefined) fail(\"output.gamutMapping applies only to output.format \\\"png\\\".\");\n const wideGamut = colorEncoding !== undefined && colorEncoding !== \"srgb\";\n // The linear development path serves wide-gamut encodings and perceptual gamut mapping.\n const linearPath = wideGamut || perceptual;\n const toneCurve = pick<SdrToneCurve>(outputOptions, \"toneCurve\", \"output.toneCurve\", DEFAULTS.toneCurve, \"Identity tone curve: scene-linear values are clipped at display white, then sRGB-encoded.\");\n if (linearPath && toneCurve !== \"identity\") fail(\"output.toneCurve other than identity is available only for sRGB output; wide-gamut encodings are converted from the linear developed colour.\");\n const highlightMode = pick<RawHighlightMode>(outputOptions, \"highlightMode\", \"output.highlightMode\", DEFAULTS.highlightMode, \"Saturated RAW highlights are clipped to neutral.\");\n const whiteBalanceOption = pick<SimulateCaptureWhiteBalance>(outputOptions, \"whiteBalance\", \"output.whiteBalance\", DEFAULTS.whiteBalance,\n \"White balance measured from a perfect white diffuser under the scene illuminant (a custom/grey-card white balance).\");\n const jpegStep = format === \"jpeg\" ? integerIn(pick(outputOptions, \"jpegQuantizationStep\", \"output.jpegQuantizationStep\", DEFAULTS.jpegQuantizationStep,\n \"Constant JPEG quantization step 2 (not a manufacturer quality scale).\"), \"output.jpegQuantizationStep\", 1, 255) : undefined;\n if (format !== \"jpeg\" && outputOptions.jpegQuantizationStep !== undefined) fail(\"output.jpegQuantizationStep applies only to output.format \\\"jpeg\\\".\");\n const sensorOptions = allowKeys(top.sensor, \"sensor\", [\"pixelPitchMicrometers\", \"spectralStepNanometers\", \"temporalSampleCount\", \"noiseSeed\", \"antiAliasing\", \"pixelAperture\"]);\n const pitch = positive(pick(sensorOptions, \"pixelPitchMicrometers\", \"sensor.pixelPitchMicrometers\", DEFAULTS.pixelPitchMicrometers,\n \"6 µm pixels (about a 24 MP full-frame sensor). The simulated sensor is width × pitch wide, so small images are a central crop of a large sensor, not a downscaled full frame.\"), \"sensor.pixelPitchMicrometers\");\n if (pitch < 0.5 || pitch > SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS) fail(\"sensor.pixelPitchMicrometers must be 0.5-\" + SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS + \".\");\n const spectralStep = positive(pick(sensorOptions, \"spectralStepNanometers\", \"sensor.spectralStepNanometers\", DEFAULTS.spectralStepNanometers,\n \"Spectral midpoint quadrature over 380-780 nm with subintervals of at most 20 nm.\"), \"sensor.spectralStepNanometers\");\n if (spectralStep < 1 || spectralStep > 100) fail(\"sensor.spectralStepNanometers must be 1-100.\");\n const temporalSampleCount = integerIn(rotating ? pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", ROTATING_TEMPORAL_SAMPLE_COUNT,\n \"Eight temporal midpoints across each site's exposure window sample the camera rotation (motion blur); raise it for long exposures or fast rotation.\") :\n pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", DEFAULTS.temporalSampleCount,\n \"One temporal sample: the static scene and still camera make more samples unnecessary.\"), \"sensor.temporalSampleCount\", 1, 256);\n const noiseSeed = integerIn(pick(sensorOptions, \"noiseSeed\", \"sensor.noiseSeed\", DEFAULTS.noiseSeed, \"Fixed noise seed 1 (deterministic output).\"), \"sensor.noiseSeed\", 0, 0xffffffff);\n const antiAliasing = sensorOptions.antiAliasing === undefined ? undefined : parseAntiAliasing(sensorOptions.antiAliasing, pitch);\n // Pixel aperture (2.3): N × N midpoint nodes over the square photosite; 1 = the default centre sample.\n let boxSamples = 1;\n if (sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\") {\n const a = sensorOptions.pixelAperture;\n if (a === \"box\") boxSamples = SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES;\n else {\n const record = allowKeys(a, \"sensor.pixelAperture\", [\"kind\", \"samplesPerAxis\"]);\n if (record.kind !== \"box\") fail(\"sensor.pixelAperture must be \\\"point\\\", \\\"box\\\" or { kind: \\\"box\\\", samplesPerAxis }.\");\n boxSamples = record.samplesPerAxis === undefined ? SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES : integerIn(record.samplesPerAxis, \"sensor.pixelAperture.samplesPerAxis\", 1, 16);\n }\n }\n const boxAperture = sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\";\n // Display view: its own parameters, and the capture options it reproduces, checked before any scene work.\n const parsedView = displayView && viewOption !== DISPLAY_VIEW_WITHOUT_VIEW ? parseDisplayViewOption(viewOption, width, height) : undefined;\n if (displayView) {\n const unsupported = (option: string, reason: string): never => fail(\"simulateDisplayView does not support \" + option + \": \" + reason);\n if (pupil) unsupported(\"lens.pupilSampling\", \"defocus moves each query off the site lattice the expected-signal tables use.\");\n if (lensFieldMapping) unsupported(\"lens.projection or lens.distortion\", \"the expected signal assumes the ideal rectilinear, distortion-free mapping of the site lattice.\");\n if (vignetting) unsupported(\"lens.vignetting\", \"the expected signal assumes the same radiance-to-irradiance factor at every site.\");\n if (lensPsf) unsupported(\"lens.psf\", \"only the engine-built diffraction kernels (lens.diffraction) are tabulated.\");\n if (rotating) unsupported(\"motion.angularVelocityRadPerSec\", \"camera rotation moves the queries off the site lattice.\");\n if (outputOptions.region !== undefined) unsupported(\"output.region\", \"pass the rectangle as view.region, in display pixels.\");\n if (outputOptions.whiteBalance === \"auto\") unsupported(\"output.whiteBalance \\\"auto\\\"\", \"the capture measures it from its noisy full-resolution RAW; use \\\"scene-illuminant\\\" or a fixed white balance.\");\n if (outputOptions.toneCurve !== undefined && outputOptions.toneCurve !== \"identity\" && outputOptions.toneCurve !== \"positive-reinhard-per-channel\")\n unsupported(\"output.toneCurve \" + String(outputOptions.toneCurve), \"luminance tone curves couple the channels; the view supports identity and positive-reinhard-per-channel.\");\n if (outputOptions.highlightMode === \"reconstruct\") unsupported(\"output.highlightMode \\\"reconstruct\\\"\", \"the view supports the per-channel highlight clip.\");\n }\n\n const colorSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.cfa, evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-color-sampling-site-index\" as const,\n layout: { kind: \"periodic-mosaic\" as const, repeatWidthSites: 2, repeatHeightSites: 2, siteChannelIds: [\"red\", \"green\", \"green\", \"blue\"], anchor: \"native-sensor-top-left-site\" as const } };\n // Demosaic (2.0): built-in Bayer kernels and border handling. Omitted, the 1.0 bilinear kernels and a\n // one-site rendered border are used unchanged.\n const demosaicOption = outputOptions.demosaic as SimulateCaptureDemosaic | undefined, borderOption = outputOptions.borderHandling as SimulateCaptureBorderHandling | undefined;\n if (demosaicOption !== undefined && demosaicOption !== \"bilinear\" && demosaicOption !== \"ahd\") fail(\"output.demosaic must be bilinear or ahd.\");\n const ahd = demosaicOption === \"ahd\";\n if (borderOption !== undefined && borderOption !== \"margin\" && borderOption !== \"mirror\") fail(\"output.borderHandling must be margin or mirror.\");\n const builtInDemosaic = demosaicOption === undefined ? undefined : createBuiltInBayerDemosaicProfiles({ kernel: \"bilinear\",\n captureModeId: IDS.mode, colorSamplingProfile, channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" } }).value;\n const mirrorBorder = borderOption === \"mirror\";\n const margin = mirrorBorder ? 0 : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n if (mirrorBorder && (width < 2 || height < 2)) fail(\"output.borderHandling \\\"mirror\\\" needs an output of at least 2 × 2 pixels.\");\n if (ahd && mirrorBorder && (width < 3 || height < 3)) fail(\"output.demosaic \\\"ahd\\\" with mirror borders needs an output of at least 3 × 3 pixels.\");\n\n // Geometry: the demosaic border (if any) on each side; output crop is the active area.\n const nativeWidth = width + 2 * margin, nativeHeight = height + 2 * margin;\n // Region (2.3): a rectangle of the whole frame. Its native sites are the region plus the demosaic reach on each side\n // (clipped to the raster, where mirror borders apply exactly as in the whole render), with the origin rounded down to\n // the 2 × 2 CFA repeat so the region raster keeps the frame's CFA phase.\n let region: { x: number; y: number; width: number; height: number } | undefined, regionNative: typeof region;\n if (outputOptions.region !== undefined) {\n const r = allowKeys(outputOptions.region, \"output.region\", [\"x\", \"y\", \"width\", \"height\"]);\n const x = integerIn(r.x, \"output.region.x\", 0, width - 1), y = integerIn(r.y, \"output.region.y\", 0, height - 1);\n region = { x, y, width: integerIn(r.width, \"output.region.width\", 1, width - x), height: integerIn(r.height, \"output.region.height\", 1, height - y) };\n const reach = margin > 0 ? margin : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n let x0 = Math.max(0, region.x + margin - reach), y0 = Math.max(0, region.y + margin - reach);\n x0 -= x0 % 2; y0 -= y0 % 2;\n regionNative = { x: x0, y: y0, width: Math.min(nativeWidth, region.x + region.width + margin + reach) - x0, height: Math.min(nativeHeight, region.y + region.height + margin + reach) - y0 };\n }\n const outputWidth = region ? region.width : width, outputHeight = region ? region.height : height;\n if (region && regionNative) assume(\"output.region\", \"model\", { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } },\n \"Only this rectangle of the \" + width + \" × \" + height + \" frame is rendered. Framing, metering, exposure, diffraction kernels and every site's physics, noise seeds and exposure window (rolling-shutter row timing) are those of the whole frame (absolute native indices), \" +\n \"and the native rectangle includes the demosaic reach on each side (\" + (margin > 0 ? margin : \"mirror-border\") + \"), so the pixels are byte-identical to the same pixels of the whole render. \" +\n // 2.6: with lens.diffraction the convolution is limited to the region; the sentence of 2.3–2.5 is kept verbatim otherwise, so\n // region results without diffraction stay byte-identical to 2.5.0.\n (diffractionRadiusOption !== undefined ? \"With lens.diffraction the object-space convolution (when it applies) covers only the lattice the region's native sites query (plus the kernel radius), in bands of at most 32 native rows; its values are the whole render's.\" :\n \"With lens.diffraction the object-space convolution runs over whole-width bands of 32 native rows that the region touches.\"));\n if (raisedPixels !== undefined) {\n if (nativeWidth > NATIVE_RAW_LIMITS.maximumDimension || nativeHeight > NATIVE_RAW_LIMITS.maximumDimension || nativeWidth * nativeHeight > raisedPixels) {\n fail(\"output.maximumPixels (\" + raisedPixels + \") must cover the native sensor raster of \" + nativeWidth + \" × \" + nativeHeight +\n \" sites (the output plus the demosaic margin), at most \" + NATIVE_RAW_LIMITS.maximumDimension + \" per side.\");\n }\n // The display view allocates no full-resolution raster, so the AHD working limit does not apply to it.\n if (ahd && !displayView && (regionNative ? regionNative.width * regionNative.height : nativeWidth * nativeHeight) > PROCESSING_MAX_PIXELS) fail(\"output.demosaic \\\"ahd\\\" admits at most \" + PROCESSING_MAX_PIXELS + \" native sites.\");\n }\n const imagingArea = { widthMm: nativeWidth * pitch / 1000, heightMm: nativeHeight * pitch / 1000 };\n const geometry = { imagingArea, nativeRaster: { pixelWidth: nativeWidth, pixelHeight: nativeHeight }, orientation: \"landscape\" as const,\n activeCaptureRect: { x: margin, y: margin, width, height }, outputRaster: { pixelWidth: width, pixelHeight: height } };\n const resolvedGeometry = resolveCaptureGeometry(geometry).value;\n const imageDistanceMm = focalLengthMm * focusDistanceM * 1000 / (focusDistanceM * 1000 - focalLengthMm);\n const metresPerFrameUnit = (width * pitch / 2000) * subjectDistanceM / imageDistanceMm;\n const aspect = height / width;\n // Fixed-size chart (2.3): validated here, before any scene work.\n const chartSize = top.chartSize === undefined ? undefined : resolveChartSizeOption(top.chartSize, aspect);\n assume(\"scene.framing\", \"derived\", { framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect },\n chartSize ? \"The scene plane is perpendicular to the optical axis; the frame covers this much of it (thin lens, focused distance), and the chart has the physical size in scene.chartSize.\" :\n \"The scene plane is perpendicular to the optical axis and the chart is sized to fill the active frame exactly.\");\n let chartReport: NonNullable<SimulateCaptureResult[\"scene\"][\"chart\"]> | undefined;\n if (chartSize) {\n for (const key of chartSize.defaulted) assume(\"chartSize.\" + key, \"default\", chartSize[key], key === \"heightM\" ?\n \"The chart has the frame's shape: height = width × output height / output width.\" : \"An 18 % neutral grey plane surrounds the chart.\");\n const magnification = imageDistanceMm / (subjectDistanceM * 1000), framedWidthM = 2 * metresPerFrameUnit, framedHeightM = framedWidthM * aspect;\n chartReport = { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance,\n frameWidthFraction: chartSize.widthM / framedWidthM, frameHeightFraction: chartSize.heightM / framedHeightM, magnification,\n imageWidthMm: chartSize.widthM * 1000 * magnification, imageHeightMm: chartSize.heightM * 1000 * magnification,\n imageWidthPixels: chartSize.widthM * 1e6 * magnification / pitch, imageHeightPixels: chartSize.heightM * 1e6 * magnification / pitch };\n assume(\"scene.chartSize\", \"model\", chartReport,\n \"Fixed-size chart: the chart is widthM × heightM metres on the scene plane, centred on the optical axis, and the rest of the plane is a neutral Lambertian surround under the same light. \" +\n \"Its image size follows the facade's thin-lens framing: magnification m = v/d with the image distance v = f·s/(s − f) at the focus distance s and the subject distance d, so the frame spans \" +\n \"sensor width / m on the plane. frameWidthFraction and frameHeightFraction above 1 mean the chart is larger than the frame and cropped.\");\n }\n if (demosaicOption === undefined && borderOption === undefined) {\n assume(\"output.demosaic\", \"model\", \"bilinear-rggb\", \"Bilinear RGGB demosaic through explicit linear kernels; the native raster has a one-site border on each side so every output pixel has full support.\");\n } else {\n if (demosaicOption === undefined) assume(\"output.demosaic\", \"default\", \"bilinear-rggb\", \"The 1.0 facade's bilinear RGGB kernels (explicit linear neighbourhood weights).\");\n else if (ahd) assume(\"output.demosaic\", \"model\", { method: \"ahd-hirakawa-parks-2005\", dependenceReachSites: AHD_MARGIN },\n \"Adaptive homogeneity-directed demosaicing (createAhdDemosaicTask, after Hirakawa & Parks, IEEE TIP 14(3), 2005): directional green, red/blue from colour differences, and per pixel the more homogeneous of the horizontal and vertical candidates in CIELAB (white-balanced camera colour); the paper's iterative median step is not applied. Non-linear; the mosaic is normalized and white-level clipped as in the native development and stored in float32, and the native development's colour operator follows. request.development keeps the built-in bilinear kernels, which validate the development but are not used for these pixels.\");\n else assume(\"output.demosaic\", \"model\", { kernel: builtInDemosaic!.kernel, modelVersion: BUILT_IN_DEMOSAIC_VERSION, kernelReachSites: builtInDemosaic!.kernelReachSites },\n \"Built-in bilinear Bayer kernels (createBuiltInBayerDemosaicProfiles): nearest same-channel averages.\");\n if (borderOption === undefined) assume(\"output.borderHandling\", \"default\", \"margin\", \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n else assume(\"output.borderHandling\", \"model\", borderOption, mirrorBorder ?\n \"No rendered border: the native raster equals the output and reconstruction reads reflect-101 mirror images of the missing sites (CFA consistency validated), so edge pixels use mirrored rather than rendered neighbours.\" :\n \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n }\n\n // Radiance queries per native site: spectral subintervals × temporal midpoints × pupil rays × PSF taps.\n const psfTaps = lensPsf ? Math.max(1, ...((lensPsf.configuration.psf.profile.nodes ?? []) as readonly { kernel?: { widthSamples?: unknown; heightSamples?: unknown } }[])\n .map((node) => Number(node.kernel?.widthSamples) * Number(node.kernel?.heightSamples)).filter((taps) => Number.isSafeInteger(taps) && taps > 0)) : 1;\n const queriesPerSite = temporalSampleCount * (Math.ceil((FACADE_SPECTRAL_RANGE_NANOMETERS.maximum - FACADE_SPECTRAL_RANGE_NANOMETERS.minimum) / spectralStep) + 1) *\n (pupil ? pupil.radialSamples * pupil.angularSamples : 1) * psfTaps * (antiAliasing ? antiAliasing.components.length : 1) * boxSamples * boxSamples;\n\n // Scene and illuminant\n // The scene is the one required input: the facade never guesses what is being photographed.\n if (top.scene === undefined) fail(\"simulateCapture needs a scene, for example { preset: \\\"uniform\\\" } (an 18 % grey card) or { preset: \\\"slanted-edge\\\" }.\");\n const sceneOption = top.scene;\n requireInputObject(sceneOption, \"scene\");\n const illuminantOption = pick<CaptureIlluminant>(top, \"illuminant\", \"illuminant\", { kind: \"planckian\", temperatureKelvin: DEFAULTS.illuminantKelvin },\n \"Planckian (blackbody) 6500 K as a stand-in for daylight. CIE D65 is not bundled; pass its S0/S1/S2 basis as a daylight illuminant to use it.\");\n const illuminant = resolveCaptureIlluminant(illuminantOption);\n const illuminanceLux = positive(pick(top, \"illuminanceLux\", \"illuminanceLux\", SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX,\n \"π·10·N²/(0.65·t·S·0.18) lux at f/8, 1/125 s, ISO 100 (CIPA DC-004 standard output sensitivity H = 10/S and camera equation H = 0.65·L·t/N²): an 18 % grey card then gets the reference exposure for the default settings. It does not follow the caller's exposure settings.\"), \"illuminanceLux\");\n const irradianceScale = calculateIlluminantIrradianceScale(illuminant.shape, illuminanceLux);\n let chart: ResolvedChartScene | undefined, callerScene: ResolvedCallerScene | undefined;\n const sceneRecord = sceneOption as Record<string, unknown>;\n if (\"kind\" in sceneRecord) {\n callerScene = requireCallerScene(sceneOption);\n } else {\n chart = resolveChartScene({ scene: sceneOption as ChartScene, aspect: chartSize ? chartSize.heightM / chartSize.widthM : aspect });\n // Composite charts (2.3) report nested defaults by dotted path, for example \"elements.2.parameters.cycles\".\n const parameterAt = (key: string): unknown => key in chart!.parameters ? chart!.parameters[key] :\n key.split(\".\").reduce<unknown>((value, part) => (value as Record<string, unknown> | undefined)?.[part], chart!.parameters);\n for (const key of chart.defaultedParameters) assume(\"scene.\" + key, \"default\", parameterAt(key), \"Chart default for \" + chart.preset + \".\");\n }\n const scenePreset = chart ? chart.preset : callerScene!.kind;\n // Caller spectra enter the digest as data (see spectrumDigestForm). Without caller spectra the description is unchanged,\n // so default captures keep their digests.\n const illuminantRecord = typeof illuminantOption === \"object\" ? illuminantOption as { kind?: unknown; basis?: { datasetId?: unknown } } : undefined;\n const illuminantSpectrum = illuminantRecord?.kind === \"spectrum\" ? { spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } :\n illuminantRecord?.kind === \"daylight\" ? { basisDatasetId: illuminantRecord.basis?.datasetId, spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } : undefined;\n const materialInputs = chart ? chartMaterialInputs(chart) : [];\n const sceneSpectra = chart ? chart.materials.flatMap((m, index) => m.kind !== \"spectrum\" ? [] : [{ material: index, spectrum: spectrumDigestForm(materialInputs[index], m.spectrum) }]) : [];\n // 2.7: a material scene's materials enter the digest as data (neutral reflectances, and caller spectra as above).\n const sceneMaterials = callerScene?.kind === \"material-function\" ? callerScene.materials.map((m, index) => (m.kind === \"neutral\" ? m.reflectance :\n spectrumDigestForm(callerScene.materialInputs[index], m.spectrum))) : undefined;\n const sceneDescription = { facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, scene: chart ? { preset: chart.preset, parameters: chart.parameters } :\n { kind: callerScene!.kind, sceneId: callerScene!.sceneId }, illuminant: illuminant.id, illuminanceLux, subjectDistanceM, framedWidthM: 2 * metresPerFrameUnit, aspect,\n ...(chartSize ? { chartSize: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}),\n ...(illuminantSpectrum === undefined ? {} : { illuminantSpectrum }), ...(sceneSpectra.length === 0 ? {} : { sceneSpectra }), ...(sceneMaterials ? { sceneMaterials } : {}) };\n if (callerScene?.kind === \"material-function\") assume(\"scene.digest\", \"model\", \"caller-function-not-hashed\", \"The source digest covers the caller's sceneId, its materials and the framing, not the body of the caller's materialAt function.\");\n else if (callerScene) assume(\"scene.digest\", \"model\", \"caller-function-not-hashed\", \"The source digest covers the caller's sceneId and the framing, not the body of the caller's evaluate function.\");\n const sourceSha256 = await sha256Hex(JSON.stringify(sceneDescription, (_key, value: unknown) => (typeof value === \"object\" && value !== null && \"evaluate\" in value ? \"caller-spectrum\" : value)));\n checkAbort();\n const buildProvider = (sceneIlluminant: ResolvedCaptureIlluminant, scale: number): PlanarSceneRadianceProvider => buildPlanarSceneRadianceProvider({ scene: chart ?? callerScene!,\n sceneId: IDS.scene, providerProfileId: IDS.provider, illuminant: sceneIlluminant, irradianceScale: scale, geometry: { distanceM: subjectDistanceM, metresPerFrameUnit,\n ...(chartSize ? { chart: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}) }, evidence: FACADE_EVIDENCE,\n limitations: Object.freeze([\"Planar Lambertian scene under uniform illumination; no shadows, inter-reflection, gloss or fluorescence.\"]) });\n const provider = buildProvider(illuminant, irradianceScale);\n // 2.6: a chart preset's evaluator is engine-built end to end (its results: the schema's exact keys, constant fields,\n // the request's identifiers, deep-frozen FACADE_EVIDENCE, UNCERTAINTY and limitations, and an engine-computed\n // radiance), so the native task may skip re-parsing the fixed parts. Caller scenes keep the full validation.\n if (chart) markInternalSceneRadianceEvaluator(provider.evaluateRadiance);\n assume(\"model.scene-radiometry\", \"model\", \"lambertian-plane\", \"Radiance = reflectance × irradiance / π on one plane; illuminance from K_m = 683 lm/W and the engine's analytic CIE 1931 ȳ fit.\");\n\n // Metering (CIPA DC-004 standard output sensitivity and camera equation) and exposure-mode resolution\n const exposureOptions = allowKeys(top.exposure, \"exposure\", [\"mode\", \"iso\", \"shutterSeconds\", \"compensationStops\"]);\n const mode = pick<SimulateCaptureExposureMode>(exposureOptions, \"mode\", \"exposure.mode\", \"manual\", \"Manual exposure.\");\n if (![\"manual\", \"aperture-priority\", \"shutter-priority\", \"program\"].includes(mode)) fail(\"Unknown exposure mode.\");\n const iso = positive(pick(exposureOptions, \"iso\", \"exposure.iso\", DEFAULTS.iso, \"ISO 100, the tiers' base ISO.\"), \"exposure.iso\");\n const compensation = exposureOptions.compensationStops === undefined ? DEFAULTS.compensationStops : exposureOptions.compensationStops;\n if (typeof compensation !== \"number\" || !Number.isFinite(compensation) || Math.abs(compensation) > 10) fail(\"exposure.compensationStops must be within ±10.\");\n if (exposureOptions.compensationStops === undefined) assume(\"exposure.compensationStops\", \"default\", 0, \"No exposure compensation.\");\n const reference = { aperture: DEFAULTS.fNumber, shutterSeconds: DEFAULTS.shutterSeconds, iso: DEFAULTS.iso };\n const referenceLuminance = sosReferenceLuminance(reference.aperture, reference.shutterSeconds, reference.iso);\n assume(\"exposure.referenceExposure\", \"model\", { ...reference, meteredLuminanceCdPerSquareMeter: referenceLuminance },\n \"Exposure anchor: f/8, 1/125 s, ISO 100 gives the CIPA DC-004 standard output sensitivity reference exposure H = 10/S = 0.1 lx·s for an average scene luminance of 10·N²/(0.65·t·S) ≈ 1230.77 cd/m² (camera equation H = 0.65·L·t/N²).\");\n const meterProfile = body.metering[0]!.profile, zones = 16, zoneSamples = [];\n let luminanceSum = 0;\n for (let j = 0; j < zones; j++) for (let i = 0; i < zones; i++) {\n const u = -1 + (i + 0.5) * 2 / zones, v = aspect - (j + 0.5) * 2 * aspect / zones;\n const luminance = luminanceOf((nm) => provider.radianceAt(u, v, nm));\n luminanceSum += luminance;\n zoneSamples.push({ sampleId: \"zone-\" + i + \"-\" + j, positionOrientedCaptureUv: { u: (i + 0.5) / zones, v: (j + 0.5) / zones },\n relativeLinearSignal: meterProfile.target.targetRelativeSignal * luminance / referenceLuminance, areaWeight: 1 });\n }\n const meteredLuminance = luminanceSum / (zones * zones);\n assume(\"exposure.metering\", \"model\", { policy: meterProfile.policy.kind, zones: zones * zones },\n \"The body's \" + meterProfile.policy.kind + \" meter reads scene luminance on a 16 × 16 zone grid, before the lens (no lens transmission, vignetting or flare).\");\n const meterResult = meterRelativeExposure({ profile: meterProfile, sampleSet: { measurementId: \"facade-meter\", sceneStateId: IDS.sceneState,\n inputDomain: \"relative-pre-exposure-linear-signal\", captureRegion: \"oriented-active-capture\", captureGeometry: resolvedGeometry,\n processingState: { exposureSettingsApplied: false, whiteBalanceApplied: false, toneMappingApplied: false, displayGammaApplied: false, sharpeningApplied: false },\n samples: zoneSamples } });\n let target = createExposureMeterTargetFromMeteringResult({ targetId: \"facade-target\", meterResult: meterResult.value });\n if (compensation !== 0) target = setExposureCompensationOnMeterTarget({ targetId: \"facade-target-ec\", baseTarget: target, exposureCompensationStops: compensation });\n let resolution: { status: string; resolvedSettings?: { aperture?: number; shutterSeconds?: number; iso?: number } };\n let fNumber: number, shutterSeconds: number;\n if (mode === \"manual\" || mode === \"aperture-priority\") {\n fNumber = positive(pick(lensOptions, \"fNumber\", \"lens.fNumber\", DEFAULTS.fNumber, \"f/8.\"), \"lens.fNumber\");\n if (prime && (fNumber < prime.widestFNumber || fNumber > prime.narrowestFNumber))\n fail(\"lens.fNumber \" + fNumber + \" is outside the \" + prime.lensId + \" range f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber + \".\");\n } else {\n if (lensOptions.fNumber !== undefined) fail(\"lens.fNumber is resolved automatically in \" + mode + \" mode; omit it.\");\n fNumber = NaN;\n }\n if (mode === \"manual\" || mode === \"shutter-priority\") {\n shutterSeconds = positive(pick(exposureOptions, \"shutterSeconds\", \"exposure.shutterSeconds\", DEFAULTS.shutterSeconds, \"1/125 s.\"), \"exposure.shutterSeconds\");\n } else {\n if (exposureOptions.shutterSeconds !== undefined) fail(\"exposure.shutterSeconds is resolved automatically in \" + mode + \" mode; omit it.\");\n shutterSeconds = NaN;\n }\n if (mode === \"manual\") {\n resolution = resolveManualExposureMode({ target, capabilities, referenceExposure: reference, manualAperture: fNumber, manualShutterSeconds: shutterSeconds,\n isoControl: { kind: \"manual\", iso } });\n } else if (mode === \"aperture-priority\") {\n resolution = resolveAperturePriorityExposureMode({ target, capabilities, referenceExposure: reference, manualAperture: fNumber, manualIso: iso,\n shutterQuantizationPolicy: \"nearest-log2-shorter-on-tie\" });\n } else if (mode === \"shutter-priority\") {\n resolution = resolveShutterPriorityExposureMode({ target, capabilities, referenceExposure: reference, manualShutterSeconds: shutterSeconds,\n isoControl: { kind: \"manual\", iso, apertureQuantizationPolicy: \"nearest-log2-narrower-on-tie\" } });\n } else {\n assume(\"exposure.programLine\", \"model\", \"facade-generic-program-line\", \"Engine-authored generic program line (f/16 1/2000 s … f/8 1/125 s … f/4 1.024 s); not a manufacturer program.\");\n resolution = resolveProgramAutoExposureMode({ target, capabilities, referenceExposure: reference, programLine: defaultProgramLine(), isoControl: { kind: \"manual\", iso } });\n }\n if (resolution.status !== \"resolved\" || !resolution.resolvedSettings) fail(\"Exposure could not be resolved (\" + resolution.status + \"); the scene may have no signal.\");\n fNumber = resolution.resolvedSettings.aperture ?? fNumber;\n shutterSeconds = resolution.resolvedSettings.shutterSeconds ?? shutterSeconds;\n const resolvedIso = resolution.resolvedSettings.iso ?? iso;\n\n // Sensor readout for the ISO setting. Standard output sensitivity S = 10/H (CIPA DC-004 §3.2) is defined at the\n // output, independent of pixel size, while the collected charge is proportional to the sensitive-aperture area\n // (EMVA 1288 Release 4.0, Eq. 3). The tier's signal chain is anchored to the 6 µm aperture; at another area the\n // charge-domain readout scales with the area so the same H gives the same code. At 6 µm nothing is changed.\n const areaScale = pitch * pitch / ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS;\n const regimeByChannel = {} as Record<Channel, { readoutProfile: ReadoutProfile; regimeId: string }>;\n for (const channel of CHANNELS) {\n const asset = body.readout.find((a) => a.profile.channelId === channel) ?? fail(\"Camera readout lacks channel \" + channel + \".\");\n const chain = resolveGenericIsoSignalChain({ profile: body.signalChain, isoCapability: body.iso, requestedIsoSetting: { kind: \"standard\", exposureIndex: resolvedIso },\n captureModeId: IDS.mode, readoutProfile: asset.profile });\n regimeByChannel[channel] = { readoutProfile: areaScale === 1 ? asset.profile : isoAreaScaledReadout(asset.profile, areaScale), regimeId: chain.readout.regime.regimeId };\n }\n const capacityRegimes = (areaScale === 1 ? body.readout[0]!.profile : isoAreaScaledReadout(body.readout[0]!.profile, areaScale)).regimes;\n const baseRegime = capacityRegimes[0]! as unknown as { preAdcSaturationElectronEquivalent: { value: number } };\n const capacityElectrons = Math.max(...capacityRegimes.map((r) => (r as unknown as { preAdcSaturationElectronEquivalent: { value: number } }).preAdcSaturationElectronEquivalent.value),\n baseRegime.preAdcSaturationElectronEquivalent.value);\n assume(\"sensor.capacityElectrons\", \"derived\", capacityElectrons, \"Physical charge capacity set to the body's largest declared pre-ADC saturation (its base-ISO saturation signal), so storage never clips before the declared readout white.\");\n if (areaScale !== 1) {\n assume(\"sensor.isoAreaNormalization\", \"model\", { referenceApertureAreaSquareMicrometers: ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS,\n apertureAreaSquareMicrometers: pitch * pitch, areaScale },\n \"Approximation. The tier's ISO signal chain is declared for a 6 µm square aperture. Standard output sensitivity S = 10/H (CIPA DC-004-2020 §3.2) is defined at the output, \" +\n \"independent of pixel size, and the collected charge is proportional to the aperture area (EMVA 1288 Release 4.0, Eq. 3), so the system conversion gain (e⁻ per code) and the \" +\n \"pre-ADC saturation of every ISO regime are multiplied by area / 36 µm² = \" + areaScale + \". The same exposure gives the same output code at any pitch; per-pixel shot-noise SNR \" +\n \"falls with smaller pixels. Read noise and dark current stay per pixel in electrons. The charge capacity follows the scaled base-ISO saturation, so it is proportional to \" +\n \"the aperture area: a design consequence of holding the tier's ISO rating and highlight headroom fixed, not a measured full-well model (published sensor data grow less than \" +\n \"proportionally with area across technologies).\");\n }\n // Whole-frame views (2.5): a pitch above 100 µm is larger than any camera photosite, so the capture is a downsized view of a frame width × pitch wide.\n if (pitch > SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS) {\n assume(\"sensor.wholeFrameView\", \"model\", { pixelPitchMicrometers: pitch, frameWidthMm: width * pitch / 1000, frameHeightMm: height * pitch / 1000 },\n \"A pixel pitch above 100 µm is larger than any camera photosite, so each output pixel stands for a \" + pitch + \" µm square of a \" + width * pitch / 1000 + \" × \" + height * pitch / 1000 +\n \" mm frame: a downsized view of the whole frame, with the framing, crop factor, generic prime and minimum focus of that frame. Its signal is the charge of the whole square \" +\n \"(sensor.isoAreaNormalization), so its shot noise is that of all the real photosites in the square summed or averaged (Poisson counts add), and the image brightness is the \" +\n \"same as at any other pitch. Read noise and dark current are applied once per output pixel, not once per real photosite, so in deep shadows the noise is lower than a real \" +\n \"sensor's binned output. This is the noise of a binned, downsized view, not the real sensor's per-pixel noise. A point pixel aperture samples one point of each square; \" +\n \"use sensor.pixelAperture box (or sensor.antiAliasing) to average scene detail finer than the pitch.\");\n }\n assume(\"sensor.darkCurrent\", \"model\", { electronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND, temperatureC: OPERATING_TEMPERATURE_C },\n \"Synthetic uniform dark current of 1 e⁻/s per site at 20 °C (the tier presets declare none); dark shot noise follows from it.\");\n assume(\"sensor.spectralResponse\", \"model\", { kind: \"colorimetric-cmf-eqe\", peakScale: EQE_SCALE },\n \"Idealized colorimetric sensor: channel EQE = a·{x̄, ȳ, z̄}(λ)·555/λ (the engine's analytic CIE 1931 fit), so RAW channels are proportional to CIE XYZ (Luther–Ives) and the camera matrix is diagonal. Not a real camera's response; CMF air wavelengths are used as vacuum wavelengths (difference about 0.03 %).\");\n if (boxAperture) {\n assume(\"sensor.pixelAperture\", \"model\", { kind: \"box\", samplesPerAxis: boxSamples, fillFactor: 1 },\n \"Each site integrates the irradiance uniformly over its square photosite (fill factor 1; the environment's uniform geometric-aperture response) with a \" + boxSamples + \" × \" + boxSamples +\n \" midpoint rule (spatialSampleCountX/Y). The ideal box aperture of width p has the pixel MTF |sinc(f·p)| = |sin(πfp)/(πfp)|; the midpoint rule gives |sin(πfp)/(N·sin(πfp/N))| \" +\n \"instead, within 3 % of it below the Nyquist frequency 1/(2p) for N ≥ 4, with the same zeros at multiples of 1/p except at multiples of N/p, where scene detail still aliases. \" +\n \"No microlens, carrier diffusion or crosstalk. The scene queries are multiplied by \" + boxSamples * boxSamples + \".\");\n }\n if (!antiAliasing) assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens or anti-aliasing filter.\");\n else {\n assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens.\");\n assume(\"sensor.antiAliasing\", \"model\", { kind: antiAliasing.kind, ...(antiAliasing.axis ? { axis: antiAliasing.axis } : {}),\n ...(antiAliasing.separationSites === undefined ? {} : { separationSites: antiAliasing.separationSites, separationMicrometers: antiAliasing.separationSites * pitch }),\n components: antiAliasing.components },\n \"Optical low-pass (anti-aliasing) filter as a normalized point-splitting kernel in the sensor optical stack (resolveAntiAliasingSpatialKernel): every site integrates the light that would \" +\n \"otherwise land at its centre minus each offset, weighted. \" + (antiAliasing.kind === \"point-splitting\" ? \"Caller-declared components. \" :\n \"This is the ideal birefringent \" + (antiAliasing.kind === \"four-spot\" ? \"two-plate (crossed) splitter: four equal spots at (±d/2, ±d/2), MTF |cos(π·f_x·d)·cos(π·f_y·d)|\" :\n \"single-plate splitter: two equal spots at ±d/2 along the \" + antiAliasing.axis + \" axis, MTF |cos(π·f·d)|\") + \", d = \" + antiAliasing.separationSites + \" site(s); first zero at f = 1/(2d). \") +\n \"Approximations: the split is the same at every wavelength, field point and polarization (birefringence dispersion and the thickness-dependent displacement are not modelled), the spots are exact points with equal weights for unpolarized light, \" +\n \"and the filter's transmission, reflections and focus shift are not modelled. Not a measured filter; the tier presets declare none. The scene queries are multiplied by \" + antiAliasing.components.length + \".\");\n }\n // Shutter (2.0): the electronic rolling-shutter schedule derived from the body's rolling readout declaration.\n let rollingSchedule: ElectronicRollingShutterExposureSchedule | undefined;\n if (shutterKind === \"rolling\") {\n const declared = (body as { rollingReadoutTiming?: { profile: unknown } }).rollingReadoutTiming?.profile as Parameters<typeof resolveElectronicRollingShutterExposureSchedule>[0][\"readout\"] | undefined;\n if (!declared || declared.readoutMode !== \"rolling\") fail(\"motion.shutter \\\"rolling\\\" needs a camera body with a rolling readout timing declaration.\");\n const readout = rollingSkewOption === undefined ? declared : { ...declared, spatialSamplingSkewSeconds: { value: rollingSkewOption, unit: \"s\" as const, evidence: FACADE_EVIDENCE } };\n rollingSchedule = resolveElectronicRollingShutterExposureSchedule({ readout, linkageEvidence: FACADE_EVIDENCE,\n nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\", evidence: FACADE_EVIDENCE } });\n assume(\"sensor.shutter\", \"model\", { kind: \"electronic-rolling\", modelId: rollingSchedule.modelId, modelVersion: rollingSchedule.modelVersion,\n lineScanSkewSeconds: rollingSchedule.lineScanSkewSeconds, scanDirection: readout.scanDirectionNative.value },\n \"Electronic rolling shutter (line reset/read linkage): a site at normalized scan position s integrates over [s·τ, s·τ + T]. \" +\n (rollingSkewOption === undefined ? \"τ is the body's declared full-frame data-readout skew, applied unchanged across the simulated frame (it is not scaled to the cropped sensor), so a small frame shows the skew of a full-sensor readout.\" :\n \"τ is the caller-declared skew across the simulated frame.\"));\n } else assume(\"sensor.shutter\", \"model\", \"global-electronic\", \"Global electronic shutter: every site integrates the same exposure window.\");\n if (rotating) assume(\"motion.angularVelocityRadPerSec\", \"model\", { ...angular },\n \"Constant camera angular velocity applied to every scene ray at each temporal midpoint of each site's exposure window (engine rotation convention, docs/SENSOR_ENVIRONMENT_QUERY.md); motion blur is the midpoint quadrature over sensor.temporalSampleCount samples.\");\n if (lensPsf) assume(\"lens.psf\", \"model\", { kind: \"sampled-local\" }, \"Caller-supplied sampled lens PSF redistributes irradiance through the environment PSF quadrature; its evidence and limits are the caller's.\");\n // With lens.diffraction the PSF is recorded as lens.diffraction once its kernels are built.\n else if (diffractionRadiusOption === undefined) assume(\"lens.psf\", \"model\", \"not-applied\", \"No lens PSF or diffraction blur is applied (point optics); the generic tiers' optical data are declared only at f/4.\");\n assume(\"lens.transmission\", \"model\", lens.matchedReference.transmission,\n \"The tier lens's spectrally flat transmission is used at every f-number and focus in the lens capability; the tier declares it only at its f/4, 5 m reference state.\");\n if (!vignetting && !lensFieldMapping) assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, distortion, lateral colour or stray light.\");\n else {\n if (vignetting) assume(\"lens.vignetting\", \"model\", { kind: \"radial-illumination-vignetting\", profile: vignetting },\n \"Caller-declared radial relative illumination 1 + r2·ρ² + r4·ρ⁴ + r6·ρ⁶, applied once as environment field throughput at the physical sensor point before any PSF.\");\n else assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, lateral colour or stray light.\");\n if (distortion) assume(\"lens.distortion\", \"model\", distortion,\n \"Caller-declared \" + distortion.kind + \" distortion: each sensor point is inverse-distorted before the scene-ray query and irradiance is multiplied exactly once by the area factor 1/det(J).\");\n }\n if (projection === undefined) assume(\"lens.projection\", \"default\", \"rectilinear\", \"Ideal rectilinear (pinhole) projection.\");\n else assume(\"lens.projection\", \"model\", projection, \"Ideal \" + projection + \" projection through the environment lens field mapping. At finite focus its scale is the thin-lens image distance (an approximation); the chart is still sized with the rectilinear thin-lens scale, so its edges move with the projection.\");\n\n // White balance\n let whiteBalanceState: ResolvedWhiteBalanceState | null = null, needsAuto = false, kelvinWhiteBalanceInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] | undefined;\n if (whiteBalanceOption === \"none\") whiteBalanceState = null;\n else if (whiteBalanceOption === \"auto\") {\n if (region) fail(\"output.region cannot be combined with output.whiteBalance \\\"auto\\\": grey-world statistics of a region differ from the whole frame's.\");\n needsAuto = true;\n }\n else if (whiteBalanceOption === \"scene-illuminant\") whiteBalanceState = sceneIlluminantWhiteBalance(illuminant);\n else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"kelvin\" in whiteBalanceOption) {\n const wb = allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"kelvin\", \"tint\"]);\n const intent = createColorTemperatureWhiteBalanceIntent({ intentId: \"facade-wb-cct\", colorTemperatureKelvin: positive(wb.kelvin, \"output.whiteBalance.kelvin\"),\n tint: wb.tint === undefined ? 0 : wb.tint as number });\n const kelvinInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] = { stateId: \"facade-wb-cct\", intent, whiteLocus: \"planckian\", tintInterpretation: \"duv-cie-1960-uv\",\n camera: { profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, xyzToCameraRgb: XYZ_TO_CAMERA.map((r) => [...r]) as unknown as Parameters<typeof resolveColorTemperatureWhiteBalance>[0][\"camera\"][\"xyzToCameraRgb\"] } };\n whiteBalanceState = resolveColorTemperatureWhiteBalance(kelvinInput);\n kelvinWhiteBalanceInput = kelvinInput;\n } else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"channelGains\" in whiteBalanceOption) {\n allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"channelGains\"]);\n requireInputObject(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\");\n allowKeys(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\", [\"red\", \"green\", \"blue\"]);\n whiteBalanceState = resolveManualWhiteBalance({ stateId: \"facade-wb-manual\", channelGains: whiteBalanceOption.channelGains });\n } else fail(\"Unknown output.whiteBalance.\");\n const intentOf = (state: ResolvedWhiteBalanceState | null): CaptureWhiteBalanceIntent | null => (state ? createCaptureWhiteBalanceIntent({ state }) : null);\n\n const rendering: SdrRenderingProfile = { schemaVersion: \"0.1.0\", profileId: \"facade-sdr\", profileVersion: \"1\", renderingExposureEv: 0, toneCurve,\n ...(outputOptions.toneCurveParameters === undefined ? {} : { toneCurveParameters: outputOptions.toneCurveParameters as SdrToneCurveParameters }),\n gamutHandling: \"clip-components\", outputDynamicRange: \"sdr\", transferFunction: \"srgb\", bitDepth: format === \"srgb-16\" || (format === \"png\" && !wideGamut && pngBitDepth === 16) ? 16 : 8, rounding: \"nearest-ties-up\", dither: \"none\" };\n if (!linearPath) assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components\" },\n \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no exposure push, out-of-gamut components clipped.\");\n else assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components-in-target-gamut\", sdrRendererUsed: false },\n \"The sRGB SDR renderer is not used: the linear development (RAW white level = relative 1.0, no exposure push) is converted to the target encoding; request.development.rendering is validated but only its exposure and tone curve (identity) apply.\");\n // Rendering choices are validated before any radiance work, so a bad tone curve fails fast.\n parseSdrRenderingProfile(rendering);\n if (highlightMode !== \"clip\" && highlightMode !== \"reconstruct\") fail(\"output.highlightMode must be clip or reconstruct.\");\n\n // Frame profiles\n const evidence = FACADE_EVIDENCE;\n const nativeRaster = { pixelWidth: nativeWidth, pixelHeight: nativeHeight };\n const captureModeProfile = { schemaVersion: \"0.1.0\" as const, modes: [{ modeId: IDS.mode, evidence, acquisition: { kind: \"single-frame\" as const },\n perFrameSampling: { kind: \"native-effective-raster\" as const }, reconstructionStages: [], processedImageRaster: { value: nativeRaster, evidence },\n dependencies: [\"color-sampling-model\"] }] } as unknown as NativeRawInput[\"captureModeProfile\"];\n const bindingProfile = { schemaVersion: \"0.1.0\" as const, bindingId: IDS.binding, colorSamplingProfileId: IDS.cfa, nativeRaster, evidence,\n relationship: { kind: \"regular-native-effective-sample-blocks\" as const, sitesPerNativeSampleX: 1, sitesPerNativeSampleY: 1, anchor: \"shared-native-top-left\" as const } };\n const exposureWindow = rollingSchedule ? createRollingShutterCaptureExposureSchedule(rollingSchedule) as unknown as {\n shutterMechanism: \"electronic\"; nominalExposureDurationSeconds: { value: number; unit: \"s\"; evidence: readonly EvidenceProvenance[] };\n opening: { kind: \"simultaneous\" }; closing: { kind: \"simultaneous\" } } :\n { shutterMechanism: \"electronic\" as const, nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\" as const, evidence },\n opening: { kind: \"simultaneous\" as const }, closing: { kind: \"simultaneous\" as const } };\n const buildRawInput = (intent: CaptureWhiteBalanceIntent | null): NativeRawInput => buildRawInputFor(intent, geometry, captureModeProfile, bindingProfile, nativeWidth * nativeHeight);\n const buildRawInputFor = (intent: CaptureWhiteBalanceIntent | null, rasterGeometry: typeof geometry, modeProfile: NativeRawInput[\"captureModeProfile\"],\n binding: NativeRawInput[\"bindingProfile\"], sites: number): NativeRawInput => ({\n exposure: { captureId: IDS.capture, sceneStateId: IDS.sceneState, sceneTimeSeconds: 0, geometry: rasterGeometry,\n exposure: { focalLengthMm, aperture: fNumber, shutterSeconds, iso: resolvedIso }, focus: { kind: \"finite\", distanceM: focusDistanceM },\n noise: { seedUint32: noiseSeed, realizationId: \"facade-noise\", model: { ...SENSOR_RAW_PRODUCER_NOISE_MODEL } },\n source: { kind: \"scene-radiance-source\", artifactId: \"facade-scene-\" + scenePreset, sha256: sourceSha256, dynamicRangeHistory: \"no-loss-declared\" },\n whiteBalanceIntent: intent, adoptedWhiteXyz: null,\n models: [{ profile: { id: \"photivra-simulate-capture\", version: SIMULATE_CAPTURE_FACADE_VERSION }, scientificStatus: \"approximation\", publicEvidenceIds: [\"photivra:simulate-capture-facade\"] }] },\n frameId: IDS.frame, modeId: IDS.mode, captureModeProfile: modeProfile, colorSamplingProfile, bindingProfile: binding, exposureWindow,\n maximumOutputBytes: sites * 7, tileWidth, ...(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }) });\n const sceneBinding = { sceneStateId: IDS.sceneState, providerSceneId: IDS.scene, evidence };\n\n // Shared per-site environment pieces (identical objects for every site keep the native task's shared-state fast path).\n const range = { ...FACADE_SPECTRAL_RANGE_NANOMETERS };\n // EQE breakpoints coincide with the quadrature subintervals, so the quadrature is not split further.\n const eqeSpacing = (range.maximum - range.minimum) / Math.ceil((range.maximum - range.minimum) / spectralStep);\n const eqeSamples = (channel: Channel): { nm: number; value: number }[] => {\n const out: { nm: number; value: number }[] = [];\n for (let nm = range.minimum; nm <= range.maximum + 1e-9; nm += eqeSpacing) out.push({ nm, value: EQE_SCALE[channel] * estimateCie1931ColorMatchingFunctions(nm)[CMF_KEY[channel]] * 555 / nm });\n return out;\n };\n const operatingConditions = { temperatureC: 25, incidenceAngleDegreesFromNormal: 0, polarization: \"unpolarized\" as const };\n // One single-channel response profile per CFA channel keeps each site's response data small.\n const spectralResponseProfiles = Object.fromEntries(CHANNELS.map((only) => [only, { schemaVersion: \"0.1.0\" as const, profileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, evidence,\n channels: [only].map((channelId) => ({ channelId, kind: \"effective-external-quantum-efficiency\" as const, responseScope: \"sensor-package-incident-effective-channel-response\" as const,\n scientificStatus: \"approximation\" as const, uncertainty: { kind: \"not-quantified\" as const, limitation: \"Idealized colorimetric response; not a measured sensor.\" },\n evidence, referenceConditions: operatingConditions, conditionDependence: \"not-modeled\" as const, externalQuantumEfficiency: sampled(eqeSamples(channelId)) })) }])) as Record<Channel, unknown>;\n const apertureArea = pitch * pitch;\n const samplingApertureProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.sampling, colorSamplingProfileId: IDS.cfa, colorSamplingBindingId: IDS.binding, evidence,\n siteCenterLattice: { kind: \"regular-rectangular-site-center-lattice\" as const, coordinateSystem: \"native-sensor-physical\" as const, pitchXMicrometers: pitch, pitchYMicrometers: pitch,\n firstSiteCenterFromImagingAreaTopLeftMicrometers: { x: pitch / 2, y: pitch / 2 }, evidence },\n geometricSensitiveAperture: { kind: \"uniform-axis-aligned-rectangle\" as const, widthMicrometers: pitch, heightMicrometers: pitch, centerOffsetFromSiteCenterMicrometers: { x: 0, y: 0 }, evidence } };\n const stackId = antiAliasing ? IDS.stackAa : IDS.stack;\n const opticalStackProfile: SensorOpticalStackProfile = antiAliasing ? { schemaVersion: \"0.1.0\", profileId: stackId, evidence, effectiveAntiAliasingSpatialResponse: {\n kind: \"normalized-point-splitting-kernel\", evidence, coordinateSystem: \"native-sensor-physical\", scope: \"field-wavelength-polarization-invariant-approximation\",\n components: antiAliasing.components } } : { schemaVersion: \"0.1.0\" as const, profileId: IDS.stack, evidence, effectiveAntiAliasingSpatialResponse: { kind: \"absent\" as const, evidence } };\n const perChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, {\n applicationProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-application-\" + channelId, spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId,\n samplingApertureProfileId: IDS.sampling, opticalStackProfileId: stackId, evidence, incidentAreaBasis: { kind: \"geometric-sensitive-aperture\" as const, areaSquareMicrometers: apertureArea },\n spatialResponseModel: { kind: \"uniform-over-geometric-sensitive-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Uniform response over the square aperture.\" },\n referenceConditionPolicy: { kind: \"exact-match-required\" as const } },\n operatingRangeProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-linearity-\" + channelId, responseApplicationProfileId: \"facade-application-\" + channelId,\n spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Declared linear photo response for the idealized sensor.\" }, evidence,\n inputRange: { kind: \"wavelength-integrated-geometric-aperture-radiant-power\" as const, unit: \"W\" as const, minimumInclusive: 0, maximumInclusive: 1 },\n wavelengthApplicability: { wavelengthBasis: \"vacuum\" as const, minimumNanometers: range.minimum, maximumNanometers: range.maximum, containment: \"requested-range-must-be-contained\" as const },\n linearityCriterion: { maximumAbsoluteRelativeDeviation: 0.01 },\n spatialLinearityModel: { kind: \"linear-superposition-over-geometric-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared linear superposition.\" },\n spectralInputModel: { kind: \"per-spectral-bin\" as const, maximumBinWidthNanometers: Math.max(spectralStep, 20), scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared per-bin linearity.\" },\n referenceConditions: operatingConditions, referenceConditionPolicy: { kind: \"exact-match-required\" as const } } }])) as Record<Channel, { applicationProfile: unknown; operatingRangeProfile: unknown }>;\n const sourcePlane = { value: \"sensor-package-incident\" as const, evidence };\n const localExposure = { bindingProfile, exposureWindowInput: { ...exposureWindow, nativeRaster } };\n const sceneBindings = {\n illuminationProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.lights, sceneId: IDS.scene, evidence, sources: [{ sourceId: \"illuminant\", family: \"environment\" as const,\n enabled: true, geometry: { kind: \"environment\" as const }, magnitude: { kind: \"relative-linear-scale\" as const, scale: 1, scientificStatus: \"approximation\" as const,\n limitation: \"Absolute level is carried by the provider radiance (\" + illuminanceLux + \" lux).\" },\n spectrum: { kind: \"unresolved\" as const, limitation: \"Spectral radiance is supplied numerically by the provider (\" + illuminant.id + \").\" },\n temporalBehavior: { kind: \"time-invariant\" as const }, evidence }] },\n materialResponseProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.materials, sceneId: IDS.scene, evidence, materials: [{ materialResponseId: \"facade-surface\", evidence,\n representation: { kind: \"spectral-wavelength-preserving-data\" as const, dataArtifact: { id: \"facade-scene-\" + scenePreset, checksumSha256: sourceSha256 },\n wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range, scatteringModel: \"provider-defined-wavelength-preserving\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic Lambertian reflectance.\" }, wavelengthChangingBehaviorModeled: false, emissionModeled: false } }],\n fluorescenceModeled: false, volumetricMaterialTransportModeled: false, polarizationModeled: false },\n providerProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.provider, sceneId: IDS.scene, illuminationProfileId: IDS.lights, materialResponseProfileId: IDS.materials,\n outputQuantity: \"outgoing-spectral-radiance\" as const, outputUnit: \"W/m^2/sr/nm\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic planar scene.\" },\n fidelity: { spectral: \"wavelength-resolved\" as const, material: \"spectral-data\" as const, visibility: \"resolved\" as const, directTransport: \"approximation\" as const, indirectTransport: \"not-modeled\" as const },\n wavelengthChangingTransportModeled: false, volumetricTransportModeled: false, polarizationModeled: false, evidence, limitations: [\"Engine-authored planar chart or caller scene function.\",\n ...(diffractionObjectSpace ? [\"Radiance is the scene radiance convolved with the lens diffraction PSF mapped onto the scene plane (object-space convolution, request.diffraction).\"] : [])] } };\n const lensId = lensExposure.profileId;\n const opticsProfile = { schemaVersion: \"0.1.0\" as const, profileId: lensId + \":facade-transmission\", profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, lensProfileId: lensId,\n scientificStatus: \"approximation\" as const, applicability: { focalLengthMm: { minimum: capabilities.selectedFocalLengthMm, maximum: capabilities.selectedFocalLengthMm },\n nominalFNumber: { minimum: capabilities.aperture.widestAvailableFNumber, maximum: capabilities.aperture.narrowestAvailableFNumber }, focus: { kind: \"any\" as const } },\n transmission: { kind: \"spectral-transmission\" as const, scientificStatus: \"approximation\" as const, wavelengthBasis: \"vacuum\" as const,\n samples: { value: [{ wavelengthNanometers: range.minimum, linearTransmissionFactor: lens.matchedReference.transmission },\n { wavelengthNanometers: range.maximum, linearTransmissionFactor: lens.matchedReference.transmission }], evidence: preset.evidence },\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Synthetic spectrally flat transmission from the tier preset.\" } },\n distortionAreaMappingOwnership: \"not-applied-by-bridge\" as const, psfRedistributionOwnership: \"downstream-normalized-energy-redistribution\" as const,\n sensorOpticalStackIncluded: false, strayLightIncluded: false, polarizationModeled: false, wavelengthChangingBehaviorModeled: false, volumetricScatteringModeled: false,\n evidence: preset.evidence, limitations: [...lens.limitations, \"Flat transmission applied across the lens capability by the capture facade.\"] };\n const optics = { profile: opticsProfile, focalLengthMm, nominalFNumber: fNumber,\n focus: { kind: \"ideal-symmetric-thin-lens\" as const, objectDistanceM: focusDistanceM, pupilMagnificationAssumption: \"unity\" as const } };\n const motion = { angularVelocityRadPerSec: angular, timeReference: \"first-opening-boundary-phase\" as const, environmentDirectionConvention: \"outgoing-radiance-toward-camera\" as const };\n const fieldThroughput = vignetting ? { kind: \"radial-illumination-vignetting\" as const, profile: vignetting, evidence,\n limitation: \"Caller-declared radial relative illumination applied by the capture facade; not a measured lens.\" } :\n { kind: \"unity\" as const, evidence, limitation: \"No vignetting or field throughput loss applied by the facade.\" };\n const spectralSamplingByChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, { channelId, wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range,\n maximumSubintervalWidthNanometers: spectralStep }])) as Record<Channel, unknown>;\n // Diffraction (2.1): Airy kernels at the resolved f-number on the site pitch, one per spectral node of the sensor quadrature.\n let diffraction: DiffractionLimitedPsfProfile | undefined, diffractionPsf: typeof lensPsf | undefined;\n if (diffractionRadiusOption !== undefined) {\n const wavelengths = [...new Set(CHANNELS.flatMap((channelId) => calculateSensorSpectralQuadrature({ ...(spectralSamplingByChannel[channelId] as { channelId: string;\n wavelengthBasis: \"vacuum\"; wavelengthRangeNanometers: { minimum: number; maximum: number }; maximumSubintervalWidthNanometers: number }), colorSamplingProfile,\n spectralResponseProfile: spectralResponseProfiles[channelId] as never }).value.nodes.map((node) => node.wavelengthNanometers)))].sort((a, b) => a - b);\n const lambdaN = wavelengths[wavelengths.length - 1]! / 1000 * fNumber * imageDistanceMm / focalLengthMm;\n // The environment resolves the PSF at each pre-filter source point, up to the largest split offset outside the imaging area.\n const aaReachMm = antiAliasing ? Math.max(...antiAliasing.components.map((c) => Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)))) / 1000 : 0;\n // The default reach is capped at the 32-site convolution limit; a capped window ends inside the third dark ring, and the\n // larger tail energy outside it is listed per wavelength like any other (2.2.1 states the cap in the explanation).\n const thirdRingSites = Math.max(1, Math.ceil(AIRY_THIRD_ZERO_PER_LAMBDA_N * lambdaN / pitch));\n const kernelRadiusSamples = diffractionRadiusOption ?? Math.min(32, thirdRingSites);\n diffraction = createDiffractionLimitedPsfProfile({ aperture: \"circular\", focalLengthMm, apertureFNumber: fNumber, focus: { kind: \"finite\", distanceM: focusDistanceM },\n wavelengthsNm: wavelengths, samplePitchMicrometers: pitch, kernelRadiusSamples, fieldHalfExtentMm: aaReachMm === 0 ? { x: imagingArea.widthMm / 2, y: imagingArea.heightMm / 2 } :\n { x: imagingArea.widthMm / 2 + aaReachMm, y: imagingArea.heightMm / 2 + aaReachMm },\n profileId: \"facade-diffraction-airy\" }).value;\n diffractionPsf = { kind: \"sampled-local\", configuration: { psf: { profile: diffraction.profile, focalLengthMm, focus: { kind: \"finite\", distanceM: focusDistanceM },\n apertureFNumber: fNumber, signedDefocusImagePlaneMicrometers: 0 }, psfWavelengthBasis: { value: \"vacuum\", evidence },\n spatialModel: { kind: \"destination-local-shift-invariant-approximation\", evidence, limitation: \"Diffraction-limited Airy PSF, the same at every field point.\" } } };\n assume(\"lens.diffraction\", \"model\", { model: diffraction.model, aperture: \"circular-aperture\", fNumber, workingFNumber: diffraction.workingFNumber,\n kernelRadiusSamples, samplePitchMicrometers: pitch, maximumTruncatedEnergyFraction: diffraction.maximumTruncatedEnergyFraction,\n truncatedEnergyByWavelength: diffraction.wavelengths.map((w) => ({ wavelengthNm: w.wavelengthNm, truncatedEnergyFraction: w.truncatedEnergyFraction })),\n execution: diffractionObjectSpace ? \"object-space-convolution\" : \"environment-psf-quadrature\" },\n \"Scalar Fraunhofer diffraction of an ideal, aberration-free circular pupil (Airy pattern, createDiffractionLimitedPsfProfile) at the resolved f-number, in focus, with D = f/N and the thin-lens image distance (working f-number N·v/f). \" +\n \"One kernel per spectral node, binned into site-sized cells over a \" + (2 * kernelRadiusSamples + 1) + \" × \" + (2 * kernelRadiusSamples + 1) + \" window\" +\n (diffractionRadiusOption !== null ? \"\" : thirdRingSites > 32 ? \" (capped at 32 sites; the third dark ring at the longest node needs \" + thirdRingSites + \")\" :\n \" (reaching the third dark ring at the longest node)\") + \"; the Airy tail energy outside it (listed per wavelength) is put back by unit-sum renormalization. \" +\n (diffractionObjectSpace ? \"Applied as an object-space convolution: the scene radiance on the site lattice is convolved once per spectral node (calculateIrradianceConvolution) and the provider answers each site query with it, so the site inputs declare no PSF; this equals the per-tap environment PSF quadrature for this still, distortion-free planar scene (request.diffraction.psf). \" :\n \"Applied through the environment PSF quadrature (one scene query per kernel tap), because camera rotation, a lens field mapping or vignetting moves the taps off the site lattice. \") +\n \"No defocus, aberration or pupil clipping; \" + (boxAperture ? \"the pixel aperture is integrated as declared by sensor.pixelAperture.\" : \"the sensor pixel aperture is still point-sampled at the site centre.\"));\n }\n const psf = lensPsf ?? (diffractionObjectSpace ? { kind: \"not-applied\" as const, evidence,\n limitation: \"No environment PSF: lens diffraction is applied upstream by the scene provider as an object-space convolution (request.diffraction).\" } : undefined) ??\n diffractionPsf ?? { kind: \"not-applied\" as const, evidence, limitation: \"No lens PSF (point optics).\" };\n const pupilRecord = pupil ? { kind: \"ideal-uniform-circular-pupil\" as const, radialSampleCount: pupil.radialSamples, angularSampleCount: pupil.angularSamples, evidence,\n limitation: \"Ideal uniform circular pupil; finite ray sampling, no convergence claim.\" } : undefined;\n const chargeSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.chargeSampling, completenessProfileId: IDS.completeness, scientificStatus: \"approximation\" as const,\n photoShotNoiseModel: \"poisson\" as const, darkShotNoiseModel: \"poisson\" as const, additionalComponentPolicies: [], evidence, limitations: [\"Poisson photo and dark shot noise.\"] };\n const channelAt = (x: number, y: number): Channel => ([\"red\", \"green\", \"green\", \"blue\"] as const)[(y % 2) * 2 + (x % 2)]!;\n function siteInput(index: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number] {\n if (!Number.isSafeInteger(index) || index < 0 || index >= nativeWidth * nativeHeight) fail(\"Native site index out of range.\");\n const x = index % nativeWidth, y = Math.floor(index / nativeWidth), channel = channelAt(x, y), site = { x, y }, c = perChannel[channel], r = regimeByChannel[channel];\n const environment = { temporalIntegrationId: IDS.frame + \":native:\" + index,\n sensor: { spatialSampling: { imagingArea, samplingApertureProfile, opticalStackProfile, site, spatialSampleCountX: boxSamples, spatialSampleCountY: boxSamples },\n spectralSampling: spectralSamplingByChannel[channel], colorSamplingProfile, spectralResponseProfile: spectralResponseProfiles[channel],\n responseApplication: { applicationProfile: c.applicationProfile, sourcePlane, operatingConditions }, operatingRangeProfile: c.operatingRangeProfile, localExposure },\n sceneBindings, optics, motion, temporalSampleCount, fieldThroughput, psf, ...(pupilRecord ? { pupil: pupilRecord } : {}), ...(lensFieldMapping ? { lensFieldMapping } : {}) };\n // The charge completeness profile must cover the site's own exposure window (shifted by s·τ under a rolling shutter).\n const window = rollingSchedule ? calculateCaptureExposureWindows({ ...exposureWindow, nativeRaster, samplePointsNative: [{ x: x + 0.5, y: y + 0.5 }] }).value.samples[0]! :\n { startOffsetSecondsFromOpeningReference: 0, endOffsetSecondsFromOpeningReference: shutterSeconds };\n return { environment, operatingTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentProfile: { schemaVersion: \"0.1.0\", profileId: IDS.dark, colorSamplingProfileId: IDS.cfa, channelId: channel, scientificStatus: \"approximation\", evidence,\n uncertainty: { kind: \"not-quantified\", limitation: \"Synthetic dark current for the capture facade.\" }, chargeMeaning: \"pre-compensation-thermally-generated-electrons\",\n siteApplicability: { kind: \"exact-site\", site }, temperatureModel: { kind: \"fixed-reference-temperature\", referenceTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentElectronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND }, darkCurrentCompensationIncluded: false, spatialDarkCurrentNonuniformityModeled: false },\n charge: { completenessProfile: { schemaVersion: \"0.1.0\", profileId: IDS.completeness, colorSamplingProfileId: IDS.cfa, channelId: channel, site, bindingId: IDS.binding,\n timeReference: \"first-opening-boundary-phase\", startOffsetSecondsFromOpeningReference: window.startOffsetSecondsFromOpeningReference,\n endOffsetSecondsFromOpeningReference: window.endOffsetSecondsFromOpeningReference,\n darkCurrentProfileId: IDS.dark, includedAdditionalComponentIds: [], coverageMeaning: \"all-material-stored-electron-contributors-accounted-for\",\n scientificStatus: \"approximation\", evidence, limitation: \"Photo and dark charge only.\" } },\n readout: { samplingProfile: chargeSamplingProfile, capacityProfile: { schemaVersion: \"0.1.0\", profileId: IDS.capacity, colorSamplingProfileId: IDS.cfa, channelId: channel,\n capacityMeaning: \"physical-charge-storage-capacity-electrons\", capacityElectrons, scientificStatus: \"approximation\",\n uncertainty: { kind: \"not-quantified\", limitation: \"Derived from the tier's declared saturation signal.\" }, evidence, siteApplicability: { kind: \"exact-site\", site },\n operatingState: { stateId: IDS.operatingState, evidence }, temperatureApplicability: { kind: \"exact-reference-temperature\", temperatureC: OPERATING_TEMPERATURE_C } },\n operatingStateId: IDS.operatingState, readoutProfile: r.readoutProfile, regimeId: r.regimeId } } as unknown as SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n }\n const readTile = async (request: { captureId: string; frameId: string; x: number; y: number; width: number; height: number }): Promise<NativeEnvironmentRawTile> =>\n ({ ...request, sites: Array.from({ length: request.width }, (_, j) => siteInput(request.y * nativeWidth + request.x + j)) });\n const yieldControl = createHostYield().yieldControl;\n const perSite = queriesPerSite * (diffraction && psf === diffractionPsf ? (2 * diffraction.kernelRadiusSamples + 1) ** 2 : 1);\n let diffractionMs = 0, demosaicMs: number | undefined, encodeMs: number | undefined;\n const rawProvider = diffraction && diffractionObjectSpace ? createDiffractedPlanarProvider({ base: provider, psf: diffractionPsf!.configuration.psf,\n wavelengthsNm: diffraction.profile.axes.wavelengthNm, kernelRadius: diffraction.kernelRadiusSamples, nativeWidth, nativeHeight, outputWidth: width,\n sitePitchMicrometers: pitch, distanceM: subjectDistanceM, metresPerFrameUnit, onConvolution: (ms) => { diffractionMs += ms; },\n // Region (2.6): convolve only the lattice the region's native sites query; the values are the whole render's.\n ...(regionNative ? { window: regionNative } : {}),\n // The environment queries each site at each aperture node minus each split offset (sites, +x right, +y down).\n ...(antiAliasing || boxSamples > 1 ? { queryOffsetsSites: apertureNodeOffsets(boxSamples).flatMap((node) =>\n (antiAliasing ? antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 } }]).map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch }))) } : {}) }) : provider;\n if (antiAliasing && perSite > 100_000) fail(\"sensor.antiAliasing with these options needs \" + perSite + \" scene queries per site; the environment admits at most 100000.\");\n const evaluations = nativeWidth * nativeHeight * perSite;\n // The native task admits at most 100 000 radiance queries per tile.\n const tileWidth = Math.max(1, Math.min(256, Math.floor(100_000 / perSite)));\n const environmentRaw: NativeEnvironmentRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding,\n maximumProviderEvaluations: Math.min(nativeRawMaximumProviderEvaluations(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }),\n Math.max(nativeWidth * nativeHeight, evaluations)) };\n\n // The facade's environment chain at a site next to the optical axis, shared by the ideal reference (2.3) and the display\n // view: expected electrons per unit spectral radiance per channel and node, and the normalized RAW signal per electron.\n function axisChannelResponse(caller: string): { electronsPerRadiance: Record<Channel, Map<number, number>>; wavelengths: number[]; relativePerElectron: Record<Channel, number> } {\n // 1. Electrons per unit spectral radiance at each spectral node, per channel: the facade's own environment chain at a\n // site next to the optical axis, with the ideal optics (no PSF, pupil, distortion, vignetting or motion). The signal\n // is linear in the radiance node values and, for this planar scene, the same at every site (paraxial π/(4N_w²)).\n const cx = Math.floor(nativeWidth / 2) & ~1, cy = Math.floor(nativeHeight / 2) & ~1;\n const channelSites: Record<Channel, number> = { red: cy * nativeWidth + cx, green: cy * nativeWidth + Math.min(cx + 1, nativeWidth - 1), blue: Math.min(cy + 1, nativeHeight - 1) * nativeWidth + Math.min(cx + 1, nativeWidth - 1) };\n const electronsPerRadiance = {} as Record<Channel, Map<number, number>>;\n for (const channel of CHANNELS) {\n if (channelAt(channelSites[channel] % nativeWidth, Math.floor(channelSites[channel] / nativeWidth)) !== channel) fail(caller + \" needs at least a 2 × 2 native raster.\");\n const environment = { ...(siteInput(channelSites[channel]).environment as unknown as Record<string, unknown>) };\n environment.psf = { kind: \"not-applied\", evidence, limitation: \"Ideal reference: no lens PSF.\" };\n environment.fieldThroughput = { kind: \"unity\", evidence, limitation: \"Ideal reference: no vignetting.\" };\n environment.motion = { ...motion, angularVelocityRadPerSec: { pitch: 0, yaw: 0, roll: 0 } };\n environment.temporalSampleCount = 1;\n delete environment.pupil;\n delete environment.lensFieldMapping;\n const electrons = (radiance: (nm: number) => number): number => (calculateEnvironmentSensorPhotoSignal({ ...environment,\n evaluateRadiance: (request: Readonly<SceneRadianceEvaluationRequest>) => ({ ...provider.evaluateRadiance(request), spectralRadianceWattsPerSquareMeterSteradianNanometer: radiance(request.wavelengthNanometers) })\n } as unknown as Parameters<typeof calculateEnvironmentSensorPhotoSignal>[0]).value as unknown as { photo: { value: { photoSignal: { expectedGeneratedElectronCount: number } } } })\n .photo.value.photoSignal.expectedGeneratedElectronCount;\n const nodes = new Set<number>();\n electrons((nm) => { nodes.add(nm); return 1; });\n electronsPerRadiance[channel] = new Map([...nodes].sort((a, b) => a - b).map((node) => [node, electrons((nm) => (nm === node ? 1 : 0))]));\n }\n const wavelengths = [...new Set(CHANNELS.flatMap((c) => [...electronsPerRadiance[c].keys()]))].sort((a, b) => a - b);\n // 2. Electrons → normalized RAW signal: (code − black)/(white − black) = e·d/(G·(W − B)) for the linear readout\n // (conversion gain G e⁻/DN, digital gain d, black B, effective white W of the capture's readout regime).\n const relativePerElectron = {} as Record<Channel, number>;\n for (const channel of CHANNELS) {\n const { readoutProfile, regimeId } = regimeByChannel[channel];\n const regime = resolveSensorReadoutRegime({ profile: readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId }).regime;\n const gain = regime.systemConversionGainElectronsPerCode.value, digitalGain = regime.adc.digitalGain ?? 1, black = regime.adc.blackLevelCode;\n const white = calculateSiteEffectiveSaturationCode({ physicalChargeCapacityElectrons: capacityElectrons, preAdcSaturationElectronEquivalent: regime.preAdcSaturationElectronEquivalent.value,\n systemConversionGainElectronsPerCode: gain, blackLevelCode: black, digitalSaturationCode: regime.adc.digitalSaturationCode, adcMaximumCode: 2 ** regime.adc.bitDepth - 1, digitalGain },\n readoutProfile as Parameters<typeof calculateSiteEffectiveSaturationCode>[1], regimeId);\n relativePerElectron[channel] = digitalGain / (gain * (white - black));\n }\n return { electronsPerRadiance, wavelengths, relativePerElectron };\n }\n // Display view: the renderer that simulate-display-view.ts passes in reads this request's resolved state, so a bundle\n // that only captures does not contain the display view.\n if (displayView) return await renderView!({ ahd, antiAliasing, aspect, assume, assumptions, axisChannelResponse, boxSamples, buildProvider, callerScene, chart, chartReport, chartSize, diffraction, diffractionPsf, fNumber, focalLengthMm, focusDistanceM, height, highlightMode, illuminanceLux, illuminant, illuminantOption, imagingArea, intentOf, metresPerFrameUnit, noiseSeed, outputOptions, parsedView, pitch, preset, provider, regimeByChannel, resolvedIso, sceneOption, scenePreset, shutterSeconds, started, subjectDistanceM, toneCurve, whiteBalanceOption, whiteBalanceState, width, checkAbort, margin, mode, nativeHeight, nativeWidth, sourceSha256, yieldControl, kelvinWhiteBalanceInput });\n // Ideal reference (2.3): the scene without camera effects, at the capture's own exposure, white balance and encoding.\n if (idealReference) {\n const referenceStarted = clockMs();\n if (format !== \"srgb-8\" && format !== \"srgb-16\" && format !== \"png\") fail(\"simulateIdealReference supports output.format srgb-8, srgb-16 and png: a reference has no RAW (dng) and should not carry JPEG compression artefacts.\");\n if (needsAuto) fail(\"simulateIdealReference cannot reproduce output.whiteBalance \\\"auto\\\": the capture measures it from its noisy RAW. Use \\\"scene-illuminant\\\" or a fixed white balance.\");\n const { electronsPerRadiance, wavelengths, relativePerElectron } = axisChannelResponse(\"simulateIdealReference\");\n // 3. Scene radiance per sample: chart materials once (and the fixed-size chart's surround), caller functions per sample.\n const signalOf = (radiance: (nm: number) => number): [number, number, number] => {\n const values = new Map(wavelengths.map((nm) => [nm, radiance(nm)]));\n return CHANNELS.map((c) => { let e = 0; for (const [nm, a] of electronsPerRadiance[c]) e += a * values.get(nm)!; return e * relativePerElectron[c]; }) as [number, number, number];\n };\n const materialCount = chart ? chart.materials.length : callerScene?.kind === \"material-function\" ? callerScene.materials.length : 0;\n const materialSignals = provider.chartMaterialAt ? Array.from({ length: materialCount + (chartSize ? 1 : 0) }, (_, m) => signalOf((nm) => provider.materialRadiance!(m, nm))) : undefined;\n // 4. Pixels: the native sites of the output (or region) pixels, each centre-sampled or box-integrated like the capture.\n const x0 = (region ? region.x : 0) + margin, y0 = (region ? region.y : 0) + margin, n = boxSamples, unit = 2 / width;\n const referenceIntent = intentOf(whiteBalanceState), referenceGains = referenceIntent ? [referenceIntent.channelGains.red, referenceIntent.channelGains.green, referenceIntent.channelGains.blue] : null;\n const development = prepareSensorColorDevelopment(CAMERA_TO_XYZ as unknown as Parameters<typeof prepareSensorColorDevelopment>[0],\n referenceGains, highlightMode);\n const rgb = new Float64Array(outputWidth * outputHeight * 3), counts = { whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 }, sum = [0, 0, 0];\n for (let py = 0; py < outputHeight; py++) {\n for (let px = 0; px < outputWidth; px++) {\n sum[0] = 0; sum[1] = 0; sum[2] = 0;\n for (let l = 0; l < n; l++) for (let k = 0; k < n; k++) {\n const u = (x0 + px + (k + 0.5) / n - nativeWidth / 2) * unit, v = -(y0 + py + (l + 0.5) / n - nativeHeight / 2) * unit;\n const s = materialSignals ? materialSignals[provider.chartMaterialAt!(u, v)]! : signalOf((nm) => provider.radianceAt(u, v, nm));\n sum[0] += s[0]; sum[1] += s[1]; sum[2] += s[2];\n }\n // Normalized RAW values saturate at the white level, as in development.\n const c = sum.map((value) => Math.min(1, Math.max(0, value / (n * n))));\n development.developInto(c[0]!, c[1]!, c[2]!, rgb, (py * outputWidth + px) * 3, counts);\n }\n if ((py & 15) === 15) { await yieldControl(); checkAbort(); }\n }\n let samples: Uint8Array | Uint16Array;\n if (!linearPath) {\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n samples = rendering.bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n const sdrCounts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, samples, y * outputWidth * 3, scratch, sdrCounts);\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n samples = encodeSdrFromLinear(rgb, colorEncoding!, pngBitDepth!, mapping).samples;\n }\n const encodedPng = format === \"png\" ? serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }) : undefined;\n const png = encodedPng && textMetadata ? addPngTextMetadata(encodedPng, textMetadata) : encodedPng;\n if (png) assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n const referenceMs = clockMs() - referenceStarted;\n assume(\"reference.kind\", \"model\", \"ideal-reference\",\n \"An ideal reference, not a capture: the same scene, framing, chart size, output size, region and pixel grid as the capture request, with no camera effects.\");\n assume(\"reference.excludes\", \"model\", [\"lens PSF, diffraction, defocus and pupil sampling\", \"projection and distortion (ideal rectilinear mapping)\", \"vignetting\", \"anti-aliasing filter\",\n \"colour filter mosaic and demosaicing (every pixel has all three channels)\", \"photon, dark and read noise\", \"dark signal\", \"ADC rounding and non-linearity\", \"camera motion and rolling shutter\"],\n \"None of these is applied; each pixel's channels come from the scene radiance at the pixel alone.\");\n assume(\"reference.exposure\", \"model\", { convention: \"exposure-matched\", fNumber, shutterSeconds, iso: resolvedIso, illuminanceLux,\n normalizedSignalPerElectron: { ...relativePerElectron } },\n \"Exposure-matched: each channel is the expected (noise-free) signal the capture's own sensor would record at the resolved exposure (f-number, shutter, ISO, illuminance and lens transmission; the facade's environment chain at the optical axis), \" +\n \"normalized like the RAW development ((code − black)/(white − black) = e·d/(G·(W − B)) for a linear readout), clipped at white, then developed with the capture's white balance, camera → XYZ → sRGB matrices, highlight mode, tone curve and encoding. \" +\n \"So a uniform patch renders at the capture's mean level, and differences from the capture are the camera effects plus noise. Chosen over a fixed reflectance → sRGB mapping because that would differ from the capture by the exposure, which is not a camera artefact.\");\n assume(\"reference.sampling\", \"model\", boxAperture ? { kind: \"box\", samplesPerAxis: n } : { kind: \"point\" },\n boxAperture ? \"Each pixel averages the scene over its square photosite with the same \" + n + \" × \" + n + \" midpoint rule as sensor.pixelAperture \\\"box\\\".\" :\n \"Each pixel samples the scene at its centre, like the capture's default point aperture; use sensor.pixelAperture \\\"box\\\" for photosite-averaged pixels.\");\n return Object.freeze({ kind: \"ideal-reference\" as const, label: \"Ideal reference (no camera effects); not a capture.\", facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples, ...(png ? { png, colorEncoding: colorEncoding! } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds) },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height } } : {}),\n diagnostics: { sampleCount: outputWidth * outputHeight * n * n, timingsMs: { reference: referenceMs, total: Date.now() - started } },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion, evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"calculateEnvironmentSensorPhotoSignal\", \"resolveSensorReadoutRegime\", \"calculateSiteEffectiveSaturationCode\", \"prepareSensorColorDevelopment\",\n ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"]), ...(png ? [\"serializePngImage\"] : [])],\n limitations: [\"Ideal reference of the planar scene at the capture's exposure: not a capture and not a measurement; it shows what the camera effects change, not an absolute colour truth.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a))) });\n }\n\n async function runTask<T extends { run(): Promise<void>; cancel(): void; dispose(): void; readonly state: string }>(task: T): Promise<void> {\n const onAbort = (): void => task.cancel();\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n try { checkAbort(); await task.run(); checkAbort(); } catch (error) { task.dispose(); if (signal?.aborted) fail(\"simulateCapture aborted.\"); throw error; } finally { signal?.removeEventListener(\"abort\", onAbort); }\n }\n const rawStarted = Date.now();\n const plan = calculateNativeRawPlan(environmentRaw.raw);\n const progress = (stage: SimulateCaptureProgress[\"stage\"], total: number) => {\n let completed = 0;\n return (): void => { completed++; onProgress?.({ stage, completedTileCount: completed, totalTileCount: total }); };\n };\n const rawTick = progress(\"raw\", regionNative ? regionNative.height * Math.ceil(regionNative.width / tileWidth) : plan.tileCount);\n const rawCallbacks = { readTile: async (request: Parameters<typeof readTile>[0]): Promise<NativeEnvironmentRawTile> => { const tile = await readTile(request); rawTick(); return tile; },\n evaluateRadiance: rawProvider.evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl };\n const rawTask: NativeEnvironmentRawTask = regionNative ? createNativeEnvironmentRawRegionTask(environmentRaw, regionNative, rawCallbacks) :\n createNativeEnvironmentRawTask(environmentRaw, rawCallbacks);\n await runTask(rawTask);\n let rawOutput = rawTask.takeOutput();\n // Region (2.3): the region's sites, re-described by a plan of the region raster (active area = the region), for development.\n let developmentPlan = plan;\n if (region && regionNative) {\n const raster = { pixelWidth: regionNative.width, pixelHeight: regionNative.height };\n const regionGeometry = { imagingArea: { widthMm: raster.pixelWidth * pitch / 1000, heightMm: raster.pixelHeight * pitch / 1000 }, nativeRaster: raster, orientation: \"landscape\" as const,\n activeCaptureRect: { x: region.x + margin - regionNative.x, y: region.y + margin - regionNative.y, width: region.width, height: region.height },\n outputRaster: { pixelWidth: region.width, pixelHeight: region.height } };\n developmentPlan = calculateNativeRawPlan(buildRawInputFor(intentOf(whiteBalanceState), regionGeometry, { ...captureModeProfile, modes: captureModeProfile.modes.map((m) =>\n ({ ...m, processedImageRaster: { ...m.processedImageRaster, value: raster } })) } as NativeRawInput[\"captureModeProfile\"], { ...bindingProfile, nativeRaster: raster }, raster.pixelWidth * raster.pixelHeight));\n if (Array.from(rawOutput.raw.effectiveSaturationCodes).some((code) => code === 0)) fail(\"output.region needs every CFA phase in its native rectangle.\");\n rawOutput = { ...rawOutput, raw: { ...rawOutput.raw, plan: developmentPlan } };\n }\n const providerEvaluationCount = rawOutput.providerEvaluationCount;\n const rawMs = Date.now() - rawStarted, wbStarted = Date.now();\n let finalRawInput = environmentRaw;\n if (needsAuto) {\n // Grey-world AWB over pre-WB RAW: black-subtracted, white-normalized channel means of each 2×2 CFA block on a coarse grid.\n const raw = rawOutput.raw, step = Math.max(2, 2 * Math.floor(Math.sqrt(width * height / 4096) / 1)), samples = [];\n for (let y = margin - (margin % 2); y + 1 < nativeHeight; y += step) for (let x = margin - (margin % 2); x + 1 < nativeWidth; x += step) {\n const value = (dx: number, dy: number): number => { const i = (y + dy) * nativeWidth + x + dx; return (raw.codes[i]! - raw.blackLevels[i]!) / (raw.effectiveSaturationCodes[dy * 2 + dx]! - raw.blackLevels[i]!); };\n let clipped = false;\n for (const [dx, dy] of [[0, 0], [1, 0], [0, 1], [1, 1]]) if (raw.saturationFlags[(y + dy!) * nativeWidth + x + dx!]! !== 0) clipped = true;\n samples.push({ sampleId: \"block-\" + x + \"-\" + y, red: Math.max(1e-9, value(0, 0)), green: Math.max(1e-9, (value(1, 0) + value(0, 1)) / 2), blue: Math.max(1e-9, value(1, 1)), weight: 1, clipped });\n }\n const policy = body.whiteBalance.awbPolicies[0]!;\n assume(\"output.whiteBalance.auto\", \"model\", { policyId: policy.policyId, samples: samples.length },\n \"Grey-world AWB of the body's \" + policy.policyId + \" policy over 2×2 CFA block means of the pre-WB RAW; the RAW is then rendered again with that intent (the same radiance queries are repeated).\");\n whiteBalanceState = estimateAutoWhiteBalance({ stateId: \"facade-wb-auto\", profile: body.whiteBalance, policyId: policy.policyId,\n sampleSet: { imageStateId: \"facade-pre-wb-raw\", inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples } });\n finalRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding, maximumProviderEvaluations: environmentRaw.maximumProviderEvaluations };\n const wbTick = progress(\"white-balance\", plan.tileCount);\n // A second lean RAW pass with the measured intent. It gives the same RAW as re-running the sensor stage on a\n // retained optical stage, and is faster: retaining the optical stage takes the first pass off the lean executor.\n const wbTask = createNativeEnvironmentRawTask(finalRawInput, {\n readTile: async (request) => { const tile = await readTile(request); wbTick(); return tile; },\n evaluateRadiance: rawProvider.evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl });\n await runTask(wbTask);\n rawOutput = wbTask.takeOutput();\n }\n const wbMs = Date.now() - wbStarted, devStarted = Date.now();\n const colorProfile: ExportSensorColorProfile = { schemaVersion: \"0.1.0\", profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, colorSamplingProfileId: IDS.cfa,\n channelIds: [\"red\", \"green\", \"blue\"], scientificStatus: \"approximation\", referenceIlluminant: \"D65\", normalizedCameraChannelsToXyz: CAMERA_TO_XYZ,\n evidence, limitations: [\"Diagonal camera→XYZ matrix of the idealized colorimetric (Luther–Ives) sensor; exact up to spectral quadrature.\"] };\n const phaseProfiles = builtInDemosaic ? builtInDemosaic.phaseProfiles : bilinearPhaseProfiles();\n const developmentWhiteBalance = whiteBalanceState ? \"apply-resolved-sensor-gains\" as const : \"not-required\" as const;\n\n\n // DNG (2.0): the packed native RAW itself, before development takes ownership of it.\n let dng: NativeRawDng | undefined;\n if (format === \"dng\") {\n const noise = Object.fromEntries(CHANNELS.map((channel) => {\n const resolved = resolveSensorReadoutRegime({ profile: regimeByChannel[channel].readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId: regimeByChannel[channel].regimeId });\n return [channel, { conversionGainElectronsPerCode: resolved.regime.systemConversionGainElectronsPerCode.value / (resolved.regime.adc.digitalGain ?? 1),\n readNoiseRmsElectrons: resolved.combinedReadNoiseRmsElectrons }];\n }));\n const dngStarted = clockMs();\n dng = await serializeNativeRawDng({ raw: rawOutput.raw, colorProfile, noise, ...(dngCapturedAtUtc === undefined ? {} : { capturedAtUtc: dngCapturedAtUtc }),\n ...(textMetadata ? { textMetadata } : {}) });\n encodeMs = clockMs() - dngStarted;\n assumeTextMetadata(TEXT_METADATA_LAYOUT.dng);\n checkAbort();\n assume(\"output.dng\", \"model\", { writer: \"serializeNativeRawDng\", schemaVersion: dng.schemaVersion, whiteLevel: dng.whiteLevel, blackLevels: dng.blackLevels,\n noiseProfile: dng.noiseProfile, unrepresentedSaturationFlagCount: dng.unrepresentedSaturationFlagCount },\n \"Lossless uncompressed 16-bit CFA DNG of exactly the packed native RAW codes: per-phase BlackLevel, WhiteLevel = smallest per-phase effective white, ActiveArea and DefaultCrop from the capture geometry, ColorMatrix1/ForwardMatrix1 from the facade's diagonal camera→XYZ profile (D65), AsShotNeutral from the white-balance intent, BaselineExposure 0, and NoiseProfile from each channel's readout regime (conversion gain ÷ digital gain, combined read noise; Poisson + Gaussian + quantization only). No linear master or developed image is declared; saturation flags below WhiteLevel are not representable and are counted.\");\n }\n\n // Development\n const development: Omit<NativeRawDevelopmentInput, \"raw\"> = { phaseProfiles, colorProfile,\n whiteBalance: developmentWhiteBalance, rendering, highlightMode, ...(mirrorBorder ? { borderHandling: \"mirror\" as const } : {}),\n maximumRetainedPayloadBytes: developmentPlan.outputBytes + outputWidth * outputHeight * 3 * (rendering.bitDepth / 8) };\n let developed: { raw: NativeRawOutput; integerSamples: Uint8Array | Uint16Array; highlight: RawHighlightDiagnostics; diagnostics: SdrRenderingResult[\"diagnostics\"] };\n let gamutMappingDiagnostics: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number } | undefined;\n if (ahd) {\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n }, { yieldControl: () => yieldControl(), checkAbort, onDemosaicMs: (ms) => { demosaicMs = ms; } });\n if (!linearPath) {\n // The native development's SDR kernel, row by row, on the AHD-developed linear sRGB.\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n const codes = rendering.bitDepth === 8 ? new Uint8Array(outputWidth * outputHeight * 3) : new Uint16Array(outputWidth * outputHeight * 3);\n const counts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(linear.rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, codes, y * outputWidth * 3, scratch, counts);\n developed = { raw: rawOutput.raw, integerSamples: codes, highlight: linear.highlight, diagnostics: { renderingNegativeSampleCount: counts.negative,\n renderingAboveReferenceSampleCount: counts.above, toneChangedSampleCount: counts.changed, gamutClippedLowSampleCount: counts.low,\n gamutClippedHighSampleCount: counts.high, captureSaturation: \"consumed-in-raw-development\" } };\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n }\n } else if (!linearPath) {\n const devTask = createNativeRawDevelopmentTask({ ...development, raw: rawOutput.raw }, { yieldControl,\n onProgress: (p) => onProgress?.({ stage: \"development\", completedTileCount: p.completedTileCount, totalTileCount: p.totalTileCount }) });\n await runTask(devTask);\n developed = devTask.takeOutput();\n } else {\n // Wide gamut: the native development operator up to linear sRGB/D65 (unclipped), then XYZ → target primaries.\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n });\n {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) {\n gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n assume(\"output.gamutMapping\", \"model\", { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION, colorSpace: colorEncoding },\n \"prepareRgbGamutMapping: CIELAB L* and hue held, chroma above 90 % of the boundary chroma C_max(L*, h) compressed with a tanh knee so it never reaches C_max (Morovič 2008, §10). In-gamut colours below the knee are unchanged; saturated in-gamut colours above it are desaturated slightly. L* ≥ 100 (above the RAW white) maps to white. CIELAB hue is not perceptually constant for saturated blues, so they can shift toward purple.\");\n }\n assume(\"output.colorEncoding.conversion\", \"model\", { from: \"linear-srgb-d65 (unclipped)\", via: \"CIE XYZ\", to: colorEncoding, gamutHandling: perceptual ? \"cielab-hue-preserving-chroma-compression\" : \"clip-components\",\n transfer: colorEncoding === \"rec2020\" ? \"bt2020-oetf (= BT.709 OETF)\" : \"srgb (W3C CSS Color 4)\" },\n \"Developed with the native development operator (demosaic, per-site white-level clip, WB, highlight mode, diagonal camera→XYZ, XYZ→linear sRGB) but before any sRGB clipping, so colours outside sRGB are kept; converted to \" +\n colorEncoding + \" through XYZ (matrices from primaries and D65, as in W3C CSS Color 4), \" + (perceptual ? \"gamut-mapped perceptually (output.gamutMapping)\" : \"components clipped to [0, 1] in the target gamut\") +\n \", then encoded and rounded to nearest. RAW white maps to display white, as in the sRGB path.\");\n }\n }\n const devMs = Date.now() - devStarted, jpegStarted = Date.now();\n let jpeg: Uint8Array | undefined;\n if (format === \"jpeg\") {\n const samples = developed.integerSamples as Uint8Array;\n const jpegSha = await sha256Hex(Array.from(samples.subarray(0, Math.min(samples.length, 4096))).join(\",\") + \":\" + samples.length + \":\" + sourceSha256);\n const source = { captureId: IDS.capture, imageStateId: \"facade-developed\", artifactId: \"facade-developed-srgb8\", sha256: jpegSha, width: outputWidth, height: outputHeight, encoding: \"encoded-srgb-8-rgb\" as const };\n // The encoder reads every pixel once, in source tiles of at most 256 × 32 aligned to the crop origin.\n const reads = Math.ceil(outputHeight / 32) * Math.ceil(outputWidth / 256), jpegTick = progress(\"jpeg\", reads);\n const jpegTask = createPrintJpegTask({ source, crop: { x: 0, y: 0, width: outputWidth, height: outputHeight }, outputWidth, outputHeight, quantizationStep: jpegStep!,\n maximumEncodedBytes: Math.max(65536, outputWidth * outputHeight * 6), maximumProviderReads: reads,\n // The JPEG records its admission plan, so the raised limit is passed (and recorded) only when the image needs it.\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PRINT_JPEG_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }, {\n readTile: async (request) => {\n jpegTick();\n const out = new Uint8Array(request.width * request.height * 3);\n for (let row = 0; row < request.height; row++) out.set(samples.subarray(((request.y + row) * outputWidth + request.x) * 3, ((request.y + row) * outputWidth + request.x + request.width) * 3), row * request.width * 3);\n return { ...request, samples: out };\n }, yieldControl });\n const jpegEncodeStarted = clockMs();\n await runTask(jpegTask);\n jpeg = jpegTask.takeOutput().bytes;\n if (textMetadata) jpeg = addJpegTextMetadata(jpeg, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.jpeg);\n encodeMs = clockMs() - jpegEncodeStarted;\n assume(\"output.jpeg\", \"model\", { encoder: \"photivra-print-jpeg\", iccProfile: \"photivra-srgb\" }, \"Baseline JPEG from the existing print JPEG encoder with an embedded sRGB ICC profile; the source digest covers a sample prefix, length and scene digest.\");\n }\n const jpegMs = Date.now() - jpegStarted;\n let png: Uint8Array | undefined;\n if (format === \"png\") {\n const pngStarted = clockMs();\n png = serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples: developed.integerSamples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) });\n if (textMetadata) png = addPngTextMetadata(png, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n encodeMs = clockMs() - pngStarted;\n assume(\"output.png\", \"model\", { encoder: \"serializePngImage\", bitDepth: pngBitDepth, colourEncoding: pngColourEncoding(colorEncoding!) },\n \"Deterministic PNG (8/16-bit RGB, in-house zlib) with the colour encoding signalled in the file: the sRGB chunk for sRGB, otherwise a cICP chunk with ITU-T H.273 primaries/transfer code points. No mastering-display (mDCV) or content-light-level (cLLI) metadata is written.\");\n }\n\n const ranOptions = new Set<SimulateCaptureCostOption>([...(pupil ? [\"lens.pupilSampling\" as const] : []), ...(projection !== undefined ? [\"lens.projection\" as const] : []),\n ...(distortion ? [\"lens.distortion\" as const] : []), ...(vignetting ? [\"lens.vignetting\" as const] : []), ...(lensPsf ? [\"lens.psf\" as const] : []),\n ...(diffraction ? [\"lens.diffraction\" as const] : []), ...(antiAliasing ? [\"sensor.antiAliasing\" as const] : []), ...(boxAperture ? [\"sensor.pixelAperture.box\" as const] : []),\n ...(temporalSampleCount > 1 ? [\"sensor.temporalSampleCount\" as const] : []), ...(rotating ? [\"motion.rotation\" as const] : []),\n ...(rollingSchedule ? [\"motion.shutter.rolling\" as const] : []), ...(mirrorBorder ? [\"output.borderHandling.mirror\" as const] : []), ...(region ? [\"output.region\" as const] : []),\n ...(needsAuto ? [\"output.whiteBalance.auto\" as const] : []), ...(ahd ? [\"output.demosaic.ahd\" as const] : []),\n ...(highlightMode === \"reconstruct\" ? [\"output.highlightMode.reconstruct\" as const] : []), ...(wideGamut ? [\"output.colorEncoding.wide-gamut\" as const] : []),\n ...(perceptual ? [\"output.gamutMapping.perceptual\" as const] : []), ...(format === \"jpeg\" || format === \"png\" || format === \"dng\" ? [\"output.format.\" + format as SimulateCaptureCostOption] : [])]);\n return Object.freeze({\n facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples: developed.integerSamples, ...(jpeg ? { jpeg } : {}), ...(png ? { png, colorEncoding: colorEncoding! } : {}), ...(dng ? { dng: dng.bytes } : {}) },\n raw: developed.raw, plan: developmentPlan,\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } } } : {}),\n request: { environmentRaw: finalRawInput, siteInput, development, whiteBalanceState,\n ...(diffraction ? { diffraction: { profile: diffraction, psf: diffractionPsf!, execution: diffractionObjectSpace ? \"object-space-convolution\" as const : \"environment-psf-quadrature\" as const } } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds),\n meteredSceneLuminanceCdPerSquareMeter: meteredLuminance, resolution },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n diagnostics: { providerEvaluationCount, highlight: developed.highlight, rendering: developed.diagnostics, ...(gamutMappingDiagnostics ? { gamutMapping: gamutMappingDiagnostics } : {}),\n timingsMs: { raw: rawMs, whiteBalance: wbMs, development: devMs, jpeg: jpegMs, total: Date.now() - started,\n ...(diffraction && diffractionObjectSpace ? { diffraction: diffractionMs } : {}), ...(demosaicMs === undefined ? {} : { demosaic: demosaicMs }),\n ...(encodeMs === undefined ? {} : { encode: encodeMs }) },\n options: Object.freeze(SIMULATE_CAPTURE_COST_OPTIONS.filter((option) => ranOptions.has(option))) },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion,\n evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"resolveGenericEquipmentExposureCapabilities\", \"meterRelativeExposure\", \"createExposureMeterTargetFromMeteringResult\",\n \"resolve\" + (mode === \"manual\" ? \"Manual\" : mode === \"aperture-priority\" ? \"AperturePriority\" : mode === \"shutter-priority\" ? \"ShutterPriority\" : \"ProgramAuto\") + \"ExposureMode\",\n ...(rollingSchedule ? [\"resolveElectronicRollingShutterExposureSchedule\", \"createRollingShutterCaptureExposureSchedule\"] : []),\n ...(diffraction ? [\"createDiffractionLimitedPsfProfile\", ...(diffractionObjectSpace ? [\"resolveLensPsfConvolutionKernels\", \"calculateIrradianceConvolution\"] : [])] : []),\n ...(antiAliasing ? [\"resolveAntiAliasingSpatialKernel\"] : []), \"resolveGenericIsoSignalChain\", \"createNativeEnvironmentRawTask\", ...(needsAuto ? [\"estimateAutoWhiteBalance\"] : []),\n ...(builtInDemosaic ? [\"createBuiltInBayerDemosaicProfiles\"] : []), ...(ahd ? [\"createAhdDemosaicTask\"] : []),\n ...(ahd ? [\"native RAW development operator (colour, after AHD)\", ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"])] : linearPath ? [\"native RAW development operator (linear, pre-clip)\", \"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"createNativeRawDevelopmentTask\"]),\n ...(jpeg ? [\"createPrintJpegTask\"] : []), ...(png ? [\"serializePngImage\"] : []), ...(dng ? [\"resolveSensorReadoutRegime\", \"serializeNativeRawDng\"] : [])],\n limitations: [\"Educational approximation: synthetic tier sensor values, idealized colorimetric sensor, planar Lambertian scene and point optics; not a calibrated camera emulation.\",\n \"Not offered by the facade: atmospheric haze and polarizers (the scene-radiance provider contract declares no volumetric transport or polarization), flash, video, HDR brackets and processing operators; compose those APIs directly.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a)))\n });\n}\n\n/** Chart preset ids accepted by `simulateCapture({ scene: { preset } })`. */\nexport const SIMULATE_CAPTURE_CHART_PRESETS = CHART_SCENE_PRESETS;\n"]}