{
  "schemaVersion": 1,
  "slug": "curtain-length-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "700a31d1ae0112852939c00c4ca340f5ee5af27072c8e690b05eb2876906794a",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/curtain-length-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "rodTop = windowTop + rodHeight; panelLength = rodTop − hemHeight",
    "vars": [
      [
        "S",
        "Sill height from floor"
      ],
      [
        "r",
        "Rod height above window top"
      ],
      [
        "T",
        "Window top height from floor"
      ]
    ],
    "note": "Rod top = window top + rod rise. Hem targets: sill S, 4 in below S−4, apron S−8, floor 0.5 in above floor, break 1 in below floor, puddle 4 in below floor. Panel length = rod top − target height; cm = in × 2.54."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const rodTop=windowTop+rodHeight;if(windowTop<sillHeight)return {__error:'inputError'};const H={sill:sillHeight,belowSill:sillHeight-4,apron:sillHeight-8,floor:0.5,break:-1,puddle:-4};const len=rodTop-(H[style]??sillHeight);return {rodTop,panelLength:len,panelLengthCm:len*2.54};",
    "inputs": [
      {
        "name": "windowTop",
        "type": "number",
        "default": 84,
        "min": 12,
        "max": 200,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "sillHeight",
        "type": "number",
        "default": 36,
        "min": 6,
        "max": 150,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "rodHeight",
        "type": "number",
        "default": 4,
        "min": 0,
        "max": 36,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "style",
        "type": "select",
        "default": "floor",
        "options": [
          {
            "value": "sill"
          },
          {
            "value": "belowSill"
          },
          {
            "value": "apron"
          },
          {
            "value": "floor"
          },
          {
            "value": "break"
          },
          {
            "value": "puddle"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "rodTop",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "panelLength",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "panelLengthCm",
        "precision": 1,
        "unit": "cm"
      }
    ],
    "interpret": null
  }
}
