{"version":3,"sources":["sofa-fit.js","../../node_modules/js-tools/svg.js"],"names":["_typeof","o","Symbol","iterator","constructor","prototype","_createForOfIteratorHelper","r","e","t","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","a","u","call","next","return","_toConsumableArray","_arrayWithoutHoles","_iterableToArray","_nonIterableSpread","_arrayLikeToArray","toString","slice","name","from","test","_classCallCheck","_defineProperties","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","i","_toPrimitive","toPrimitive","String","Number","SVG_DEFAULT_PATH","SVG_DEFAULT_PREFIX","Svg","this","imagePath","imageClassPrefix","setImagePath","path","setImageClassPrefix","prefix","render","icon","prepare","replace","SofaFit","svg","selection","frames","user","selectedFrame","homeDims","tooBig","diffs","count","max","noLanding","extra","height","depth","setUpOverlay","getElements","watchLandingCheckbox","watchSubmitClick","watchSubmit","_document$querySelect","dimensionsElement","document","querySelector","sofaDims","JSON","parse","dataset","dims","resultsButton","step","submitInputBtns","querySelectorAll","_this","openSofaFitButton","addEventListener","Overlay","modifiers","callback","init","_this2","overlayEl","target","noLandingCheckbox","event","forEach","input","disabled","currentTarget","checked","_this3","submitInputBtn","inputs","nextPopup","validInputs","every","isNaN","parseInt","isValidLandingStep","inputValues","map","dimensions","fromEntries","concat","processDimensions","calculateResults","insertTableValues","initEditDimensions","invalidInputs","_this4","existingDimIndex","obj","index","undefined","width","push","size","label","checkDimensionsFit","stepType","fitResult","checkDoorFit","checkHallwayFit","checkStairsLandingFit","_this5","result","getAttribute","data","keys","item","widthDiff","heightDiff","depthDiff","Math","apply","filter","innerHTML","activateRadioState","classList","add","radio","willFit","remove","_step","_this6","_iterator","preventDefault","overlayURL","id","fieldName","err","_this7","$","on","val","frameKey","AndrewMartin","customise","updateCombinationQty","replaceUrl","updateUrl","form","ajax","window","location","href","type","formData","serialize","success","refreshAfterAjax","close","fail","doorTable","hallwayTable","stairsTable","textContent","doorDims","sofaHeight","sofaWidth","sofaDepth","doorWidth","doorHeight","bestWidthDimension","min","Infinity","hallwayDims","hallwayWidth","smallestDimension","landingDims","adjustedHeight","adjustedDepth","landingWidth","landingDepth","landingHeight","sofaFit"],"mappings":"AAAA,SAASA,QAAQC,GAAgC,OAAOD,QAAU,mBAAqBE,QAAU,iBAAmBA,OAAOC,SAAW,SAAUF,GAAK,cAAcA,CAAG,EAAI,SAAUA,GAAK,OAAOA,GAAK,mBAAqBC,QAAUD,EAAEG,cAAgBF,QAAUD,IAAMC,OAAOG,UAAY,gBAAkBJ,CAAG,EAAGD,QAAQC,EAAI,CAC7T,SAASK,2BAA2BC,EAAGC,GAAK,IAAIC,EAAI,oBAAsBP,QAAUK,EAAEL,OAAOC,WAAaI,EAAE,cAAe,IAAKE,EAAG,CAAE,GAAIC,MAAMC,QAAQJ,KAAOE,EAAIG,4BAA4BL,KAAOC,GAAKD,GAAK,iBAAmBA,EAAEM,OAAQ,CAAEJ,IAAMF,EAAIE,GAAI,IAAIK,EAAK,EAAGC,EAAI,WAAc,EAAG,MAAO,CAAEC,EAAGD,EAAGE,EAAG,WAAe,OAAOH,GAAMP,EAAEM,OAAS,CAAEK,MAAM,GAAO,CAAEA,MAAM,EAAIC,MAAOZ,EAAEO,KAAS,EAAGN,EAAG,SAAWD,GAAK,MAAMA,CAAG,EAAGa,EAAGL,EAAK,CAAE,MAAM,IAAIM,UAAU,wIAA0I,CAAE,IAAIpB,EAAGqB,GAAI,EAAIC,GAAI,EAAI,MAAO,CAAEP,EAAG,WAAeP,EAAIA,EAAEe,KAAKjB,EAAI,EAAGU,EAAG,WAAe,IAAIV,EAAIE,EAAEgB,OAAQ,OAAOH,EAAIf,EAAEW,KAAMX,CAAG,EAAGC,EAAG,SAAWD,GAAKgB,GAAI,EAAItB,EAAIM,CAAG,EAAGa,EAAG,WAAe,IAAME,GAAK,MAAQb,EAAEiB,QAAUjB,EAAEiB,QAAU,CAAE,QAAU,GAAIH,EAAG,MAAMtB,CAAG,CAAE,EAAK,CACr1B,SAAS0B,mBA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nF,IAAA,EAAA6I,EAAAE,GACA9D,EAAAE,KAAAnF,IAAA,EAAA4I,EAAAI,GAGA,MAAA,CACAhE,UAAAA,EAAA,EAAAA,EAAA,EACAE,UAAAA,EAAA,EAAAA,EAAA,EACAD,WAAAA,EAAA,EAAAA,EAAA,EAEA,IAAA,CAjlBA,GAqlBAyB,aAAAA,cAAA,CAAA,EAGAA,aAAAuC,QAAA,IAAA3J","file":"../../javascript/sofa-fit.js","sourcesContent":["/**\n * SofaFit - A tool to check if sofa dimensions will fit through doorways, hallways, and stairs/landings\n * @module SofaFit\n */\n\nif (typeof SVG_DEFAULT_PATH == \"undefined\") {\n    var SVG_DEFAULT_PATH = '/images/svg-symbols.svg';\n}\nif (typeof SVG_DEFAULT_PREFIX == \"undefined\") {\n    var SVG_DEFAULT_PREFIX = 'icon';\n}\nfunction Svg() {\n\n    this.imagePath = SVG_DEFAULT_PATH;\n\n    this.imageClassPrefix = SVG_DEFAULT_PREFIX;\n\n    this.setImagePath = function(path) {\n        if (path) {\n            this.imagePath = path;\n        }\n    }\n\n    this.setImageClassPrefix = function(prefix) {\n        if (prefix) {\n            this.imageClassPrefix = prefix;\n        }\n    }\n\n    this.render = function(icon) {\n        return '<svg role=\"img\" class=\"' + this.imageClassPrefix + '-' + this.prepare(icon) + '\">' +\n                        '<use xlink:href=\"' + this.imagePath + '#icon-' + this.prepare(icon) + '\"></use>' +\n                    '</svg>'\n    }\n\n    this.prepare = function(icon) {\n        return icon.replace('icon-', '');\n    }\n}\n\n\n/**\n * SofaFit - A tool to check if a sofa will fit through doors, hallways, and stairs\n * @class\n */\nclass SofaFit {\n  /**\n   * Create a new SofaFit instance\n   */\n  constructor() {\n    this.svg = new Svg();\n    this.selection = { frames: {} };\n    this.user = { selectedFrame: false };\n    this.homeDims = [];\n    this.tooBig = {};\n    this.diffs = [];\n    this.count = 0;\n    this.max = 0;\n    this.noLanding = false;\n\n    // Padding factors for stairs/landing measurements\n    this.extra = {\n      height: 1.09,\n      depth: 1.19\n    };\n\n    // Initialize overlay when the script loads\n    this.setUpOverlay();\n  }\n\n  /**\n   * Initialize the SofaFit tool with all event listeners\n   */\n  init() {\n    this.getElements();\n    this.watchLandingCheckbox();\n    this.watchSubmitClick();\n    this.watchSubmit();\n  }\n\n  /**\n   * Get necessary DOM elements and parse sofa dimensions\n   */\n  getElements() {\n    const dimensionsElement = document.querySelector('.js-get-dimensions');\n    if (dimensionsElement) {\n      this.sofaDims = JSON.parse(dimensionsElement.dataset.dims);\n    }\n    this.resultsButton = document.querySelector('.js-get-results');\n    this.step = document.querySelector('.pdp-popup')?.dataset.step;\n    this.submitInputBtns = document.querySelectorAll('.js-submit-input');\n  }\n\n  /**\n   * Setup the overlay system that displays the measurement steps\n   */\n  setUpOverlay() {\n    const openSofaFitButton = document.querySelector('.js-open-sofa-fit');\n\n    if (!openSofaFitButton) return;\n\n    openSofaFitButton.addEventListener('click', () => {\n      Overlay.render('#doors', {\n        modifiers: ['sidebar', 'sofa-fit'],\n        callback: () => {\n          this.init();\n        }\n      });\n    });\n  }\n\n  /**\n   * Sets up the \"I don't have a landing\" checkbox behaviour\n   */\n  watchLandingCheckbox() {\n    const overlayEl = Overlay.target;\n    const noLandingCheckbox = overlayEl.querySelector('input[type=\"checkbox\"]');\n\n    if (!noLandingCheckbox) return;\n\n    noLandingCheckbox.addEventListener('click', (event) => {\n      const inputs = Array.from(\n        overlayEl.querySelectorAll('input[type=\"text\"]')\n      );\n\n      inputs.forEach(input => {\n        input.disabled = event.currentTarget.checked;\n      });\n\n      this.noLanding = event.currentTarget.checked;\n    });\n  }\n\n  /**\n   * Set up click handling for \"next step\" buttons\n   */\n  watchSubmitClick() {\n    if (!this.submitInputBtns) return;\n\n    this.submitInputBtns.forEach(submitInputBtn => {\n      submitInputBtn.addEventListener('click', () => {\n        const overlayEl = Overlay.target;\n        const inputs = Array.from(\n          overlayEl.querySelectorAll('input[type=\"text\"]')\n        );\n        const step = overlayEl.querySelector('.pdp-popup').dataset.step;\n        const nextPopup = overlayEl.querySelector('.pdp-popup').dataset.nextPopup;\n\n        // Verify all inputs are valid numbers\n        const validInputs = inputs.every(\n          input => !isNaN(parseInt(input.value))\n        );\n\n        // Special case for stairs with \"no landing\" checked\n        const isValidLandingStep = step === 'stairs' && this.noLanding;\n\n        if (validInputs || isValidLandingStep) {\n          // Create an object from the input values\n          const inputValues = inputs.map(input => [\n            input.name,\n            parseInt(input.value)\n          ]);\n          \n          const dimensions = Object.fromEntries([...inputValues, ['step', step]]);\n          \n          // Process and store the dimensions\n          this.processDimensions(dimensions);\n\n          // If we're at the final step, calculate results\n          if (this.count === 2) {\n            this.calculateResults();\n          }\n\n          // Move to the next step\n          Overlay.render(`#${nextPopup}`, {\n            modifiers: ['sidebar', 'sofa-fit'],\n            callback: () => {\n              this.init();\n\n              if (Overlay.target.querySelector('.js-get-dimensions')) {\n                this.insertTableValues();\n                this.initEditDimensions();\n              }\n            }\n          });\n\n          // Only increment the counter for valid inputs or valid landing step\n          if (validInputs || isValidLandingStep) {\n            this.count++;\n          }\n        } else {\n          this.invalidInputs();\n        }\n      });\n    });\n  }\n\n  /**\n   * Process and store dimensions from the form\n   * @param {Object} dimensions - The dimensions object with values from inputs\n   */\n  processDimensions(dimensions) {\n    // Check if we're editing an existing step\n    let existingDimIndex = -1;\n    \n    this.homeDims.forEach((obj, index) => {\n      if (obj.step === dimensions.step) {\n        existingDimIndex = index;\n      }\n    });\n\n    // For the stairs/landing step with \"no landing\" checked,\n    // ensure that we don't store NaN values\n    if (dimensions.step === 'stairs' && this.noLanding) {\n      // If user selected \"no landing\", we don't need exact dimensions\n      // so we can safely set them to empty values\n      if (dimensions.width === undefined || isNaN(dimensions.width)) dimensions.width = '';\n      if (dimensions.depth === undefined || isNaN(dimensions.depth)) dimensions.depth = '';\n      if (dimensions.height === undefined || isNaN(dimensions.height)) dimensions.height = '';\n    }\n\n    if (existingDimIndex >= 0) {\n      // Update existing dimensions\n      this.homeDims[existingDimIndex] = dimensions;\n    } else {\n      // Add new dimensions\n      this.homeDims.push(dimensions);\n    }\n\n    // Clear existing calculation results for this step\n    this.sofaDims.forEach(size => {\n      size.diffs = {};\n      this.tooBig[size.label] = this.tooBig[size.label] || {};\n\n      // Check if dimensions fit based on the current step\n      this.checkDimensionsFit(size, dimensions);\n    });\n  }\n\n  /**\n   * Check if a sofa's dimensions fit through the current step (door, hallway, or stairs)\n   * @param {Object} size - The sofa dimensions\n   * @param {Object} dimensions - The user's home dimensions\n   */\n  checkDimensionsFit(size, dimensions) {\n    const stepType = dimensions.step;\n    \n    let fitResult = true; // Default: it fits\n\n    if (stepType === 'doors') {\n      fitResult = this.checkDoorFit(size, dimensions);\n    } else if (stepType === 'hallway') {\n      fitResult = this.checkHallwayFit(size, dimensions);\n    } else if (stepType === 'stairs' && !this.noLanding) {\n      fitResult = this.checkStairsLandingFit(size, dimensions);\n    }\n\n    // If it doesn't fit, store the results\n    if (fitResult !== true) {\n      this.tooBig[size.label][dimensions.step] = fitResult;\n    }\n  }\n\n  /**\n   * Calculate the final results for display\n   */\n  calculateResults() {\n    const results = document.querySelectorAll('.js-popup-results');\n    \n    results.forEach(result => {\n      const label = result.getAttribute('data-label');\n      const diffs = [];\n\n      if (this.tooBig[label]) {\n        const data = this.tooBig[label];\n\n        // Collect all dimension differences\n        Object.keys(data).forEach(key => {\n          const item = data[key];\n          \n          if (item.widthDiff) diffs.push(item.widthDiff);\n          if (item.heightDiff) diffs.push(item.heightDiff);\n          if (item.depthDiff) diffs.push(item.depthDiff);\n        });\n\n        if (diffs.length) {\n          // Find the maximum difference\n          const max = Math.max(...diffs.filter(item => !isNaN(Number(item))));\n\n          if (max > 0) {\n            result.innerHTML = `will not fit and is ${max}cm over`;\n            this.activateRadioState(\n              document.querySelector(`.js-popup-radio[data-label=\"${label}\"]`),\n              false\n            );\n          } else {\n            result.innerHTML = `will fit`;\n            this.activateRadioState(\n              document.querySelector(`.js-popup-radio[data-label=\"${label}\"]`),\n              true\n            );\n          }\n        } else {\n          result.innerHTML = `will fit`;\n          this.activateRadioState(\n            document.querySelector(`.js-popup-radio[data-label=\"${label}\"]`),\n            true\n          );\n        }\n      } else {\n        result.innerHTML = `will fit`;\n        this.activateRadioState(\n          document.querySelector(`.js-popup-radio[data-label=\"${label}\"]`),\n          true\n        );\n      }\n    });\n  }\n\n  /**\n   * Mark inputs as invalid\n   */\n  invalidInputs() {\n    const overlayEl = Overlay.target;\n    const inputs = Array.from(\n      overlayEl.querySelectorAll('input[type=\"text\"]')\n    );\n\n    inputs.forEach(input => {\n      input.classList.add('invalid');\n    });\n  }\n\n  /**\n   * Update the visual state of radio buttons\n   * @param {HTMLElement} radio - The radio button element\n   * @param {boolean} willFit - Whether the sofa will fit\n   */\n  activateRadioState(radio, willFit) {\n    if (!radio) return;\n    \n    // Remove existing state classes\n    radio.classList.remove('custom-radio__icon--tick', 'custom-radio__icon--cross');\n    \n    // Add appropriate class based on fit status\n    radio.classList.add(willFit ? 'custom-radio__icon--tick' : 'custom-radio__icon--cross');\n  }\n\n  /**\n   * Initialize the edit dimension buttons\n   */\n  initEditDimensions() {\n    const editButtons = Overlay.target.querySelectorAll('.js-edit-dimensions');\n\n    for (const button of editButtons) {\n      button.addEventListener('click', event => {\n        event.preventDefault();\n\n        const overlayURL = event.currentTarget.id;\n        this.count = parseInt(event.currentTarget.dataset.count);\n        \n        // Reset calculation variables for recalculation\n        this.diffs = [];\n        this.tooBig = {};\n\n        Overlay.render(`#${overlayURL}`, {\n          modifiers: ['sidebar', 'sofa-fit'],\n          callback: () => {\n            this.init();\n\n            // If editing stairs/landing, restore checkbox state\n            if (overlayURL === 'stairs' && this.noLanding) {\n              const noLandingCheckbox = Overlay.target.querySelector('input[type=\"checkbox\"]');\n              if (noLandingCheckbox) {\n                noLandingCheckbox.checked = true;\n                \n                // Disable the input fields\n                const inputs = Array.from(\n                  Overlay.target.querySelectorAll('input[type=\"text\"]')\n                );\n                inputs.forEach(input => {\n                  input.disabled = true;\n                });\n              }\n            }\n            \n            // Pre-fill input values from saved data\n            if (this.homeDims[this.count]) {\n              const inputs = Array.from(\n                Overlay.target.querySelectorAll('input[type=\"text\"]')\n              );\n              \n              inputs.forEach(input => {\n                const fieldName = input.getAttribute('name');\n                if (this.homeDims[this.count][fieldName] !== undefined) {\n                  // Only set the value if it's a valid number, otherwise leave it blank\n                  const value = this.homeDims[this.count][fieldName];\n                  input.value = !isNaN(value) ? value : '';\n                }\n              });\n            }\n\n            if (Overlay.target.querySelector('.js-get-dimensions')) {\n              this.insertTableValues();\n              this.initEditDimensions();\n            }\n          }\n        });\n      });\n    }\n  }\n\n  /**\n   * Handle form submission to update the sofa selection\n   */\n  watchSubmit() {\n    $('.js-radio-form').on('submit', event => {\n      event.preventDefault();\n\n      const selectedFrame = $('.js-sofa-fit-frame:checked').val();\n      const frameKey = `frames[${selectedFrame}]`;\n\n      AndrewMartin.customise.updateCombinationQty(selectedFrame, 1, true);\n      \n      if (this.user.selectedFrame) {\n        AndrewMartin.customise.replaceUrl(frameKey, 1);\n      } else {\n        AndrewMartin.customise.updateUrl(frameKey, 1);\n      }\n      \n      const form = $(event.currentTarget);\n\n      $.ajax(window.location.href, {\n        type: 'post',\n        data: {\n          formData: form.serialize()\n        },\n        success: data => {\n          this.user.selectedFrame = true;\n          AndrewMartin.customise.refreshAfterAjax(data);\n          Overlay.close();\n        },\n        fail: () => {\n          Overlay.close();\n        }\n      });\n    });\n  }\n\n  /**\n   * Insert the dimension values into the summary table\n   */\n  insertTableValues() {\n    const overlayEl = Overlay.target;\n    const doorTable = overlayEl.querySelector('.js-wmsf-door');\n    const hallwayTable = overlayEl.querySelector('.js-wmsf-hallway');\n    const stairsTable = overlayEl.querySelector('.js-wmsf-stairs');\n\n    if (this.homeDims[0]) {\n      doorTable.textContent = `${this.homeDims[0].width} (W) x ${this.homeDims[0].height} (H) cm`;\n    }\n    \n    if (this.homeDims[1]) {\n      hallwayTable.textContent = `${this.homeDims[1].width} (W) cm`;\n    }\n    \n    if (this.homeDims[2]) {\n      if (!this.noLanding) {\n        stairsTable.textContent = `${this.homeDims[2].width} (W) x ${this.homeDims[2].depth} (D) x ${this.homeDims[2].height} (H) cm`;\n      } else {\n        stairsTable.textContent = `I don't have a landing`;\n      }\n    }\n  }\n\n  /**\n   * Check if furniture fits through a door in any orientation\n   * @param {Object} size - The sofa dimensions\n   * @param {Object} doorDims - The door dimensions\n   * @returns {boolean|Object} - true if it fits, or an object with the difference\n   */\n  checkDoorFit(size, doorDims) {\n    // A piece fits through a door if its smallest two dimensions can pass through\n    // For a door opening, we need two dimensions of the sofa to be <= door dimensions\n    \n    // Make sure we have all dimensions\n    const sofaHeight = size.height || 0;\n    const sofaWidth = size.width || 0;\n    const sofaDepth = size.depth || 0;\n    const doorWidth = doorDims.width || 0;\n    const doorHeight = doorDims.height || 0;\n    \n    // Check all possible orientations - we need TWO dimensions to fit through door\n    \n    // Orientation 1: sofa on its side (height through door width, width OR depth through door height)\n    if (sofaHeight <= doorWidth && (sofaWidth <= doorHeight || sofaDepth <= doorHeight)) {\n      return true;\n    }\n    \n    // Orientation 2: sofa upright (width through door width, height OR depth through door height)\n    if (sofaWidth <= doorWidth && (sofaHeight <= doorHeight || sofaDepth <= doorHeight)) {\n      return true;\n    }\n    \n    // Orientation 3: sofa flat (depth through door width, height OR width through door height)\n    if (sofaDepth <= doorWidth && (sofaHeight <= doorHeight || sofaWidth <= doorHeight)) {\n      return true;\n    }\n    \n    // If we get here, furniture won't fit, so calculate smallest amount over\n    \n    // Find the smallest dimension that needs to go through door width\n    const bestWidthDimension = Math.min(\n      sofaHeight, \n      sofaWidth, \n      sofaDepth\n    );\n    \n    // How much over the door width is the smallest dimension?\n    let widthDiff = Math.max(0, bestWidthDimension - doorWidth);\n    \n    // If the smallest dimension fits through door width, no width diff\n    if (bestWidthDimension <= doorWidth) {\n      widthDiff = 0;\n    }\n    \n    // For each possible orientation, check the other two dimensions against door height\n    let heightDiff = Infinity;\n    \n    // If height could go through door width, check if width OR depth fit through height\n    if (sofaHeight <= doorWidth) {\n      heightDiff = Math.min(\n        heightDiff,\n        Math.max(0, Math.min(sofaWidth, sofaDepth) - doorHeight)\n      );\n    }\n    \n    // If width could go through door width, check if height OR depth fit through height\n    if (sofaWidth <= doorWidth) {\n      heightDiff = Math.min(\n        heightDiff,\n        Math.max(0, Math.min(sofaHeight, sofaDepth) - doorHeight)\n      );\n    }\n    \n    // If depth could go through door width, check if height OR width fit through height\n    if (sofaDepth <= doorWidth) {\n      heightDiff = Math.min(\n        heightDiff,\n        Math.max(0, Math.min(sofaHeight, sofaWidth) - doorHeight)\n      );\n    }\n    \n    // If we couldn't find any valid orientation where at least one dimension fits\n    // through door width, height diff remains Infinity - set it to 0 in that case\n    if (heightDiff === Infinity) {\n      heightDiff = 0;\n    }\n    \n    // Use only non-zero diff if possible\n    const effectiveDiff = (widthDiff > 0) ? widthDiff : (heightDiff > 0 ? heightDiff : 0);\n    \n    return { widthDiff: effectiveDiff };\n  }\n\n  /**\n   * Check if furniture fits through a hallway\n   * @param {Object} size - The sofa dimensions\n   * @param {Object} hallwayDims - The hallway dimensions\n   * @returns {boolean|Object} - true if it fits, or an object with the difference\n   */\n  checkHallwayFit(size, hallwayDims) {\n    // For a hallway, we only have width measurement\n    // The sofa needs to have its smallest dimension less than the hallway width\n    const sofaHeight = size.height || 0;\n    const sofaWidth = size.width || 0;\n    const sofaDepth = size.depth || 0;\n    const hallwayWidth = hallwayDims.width || 0;\n    \n    // Find the smallest dimension of the sofa\n    const smallestDimension = Math.min(sofaHeight, sofaWidth, sofaDepth);\n    \n    // If the smallest dimension fits through the hallway width, it can be maneuvered\n    if (smallestDimension <= hallwayWidth) {\n      return true;\n    }\n    \n    // If it doesn't fit, return how much over it is\n    return { widthDiff: smallestDimension - hallwayWidth };\n  }\n\n  /**\n   * Check if furniture fits through stairs/landing\n   * @param {Object} size - The sofa dimensions\n   * @param {Object} landingDims - The landing dimensions\n   * @returns {boolean|Object} - true if it fits, or an object with the differences\n   */\n  checkStairsLandingFit(size, landingDims) {\n    // For stairs/landing, we check if the sofa can be maneuvered in the 3D space\n    const sofaHeight = size.height || 0;\n    const sofaWidth = size.width || 0;\n    const sofaDepth = size.depth || 0;\n    \n    // Apply the extra padding factors for stairs/landing\n    const adjustedHeight = sofaHeight * this.extra.height;\n    const adjustedDepth = sofaDepth * this.extra.depth;\n    \n    const landingWidth = landingDims.width || 0;\n    const landingDepth = landingDims.depth || 0;\n    const landingHeight = landingDims.height || 0;\n    \n    // Check various orientations for the landing\n    // 1. Width fits through width, depth through depth, height through height\n    if (sofaWidth <= landingWidth && adjustedDepth <= landingDepth && adjustedHeight <= landingHeight) {\n      return true;\n    }\n    \n    // 2. Height fits through width, width through depth, depth through height\n    if (sofaHeight <= landingWidth && sofaWidth <= landingDepth && adjustedDepth <= landingHeight) {\n      return true;\n    }\n    \n    // 3. Depth fits through width, height through depth, width through height\n    if (sofaDepth <= landingWidth && sofaHeight <= landingDepth && sofaWidth <= landingHeight) {\n      return true;\n    }\n    \n    // Calculate differences for each dimension\n    const widthDiff = Math.max(0, sofaWidth - landingWidth);\n    const depthDiff = Math.max(0, adjustedDepth - landingDepth);\n    const heightDiff = Math.max(0, adjustedHeight - landingHeight);\n    \n    // Return the dimensions that are over\n    return { \n      widthDiff: widthDiff > 0 ? widthDiff : 0,\n      depthDiff: depthDiff > 0 ? depthDiff : 0,\n      heightDiff: heightDiff > 0 ? heightDiff : 0\n    };\n  }\n}\n\n// Initialize the global namespace if not already existing\nvar AndrewMartin = AndrewMartin || {};\n\n// Create a new instance and set up the overlay\nAndrewMartin.sofaFit = new SofaFit();\n","if (typeof SVG_DEFAULT_PATH == \"undefined\") {\n    var SVG_DEFAULT_PATH = '/images/svg-symbols.svg';\n}\nif (typeof SVG_DEFAULT_PREFIX == \"undefined\") {\n    var SVG_DEFAULT_PREFIX = 'icon';\n}\nfunction Svg() {\n\n    this.imagePath = SVG_DEFAULT_PATH;\n\n    this.imageClassPrefix = SVG_DEFAULT_PREFIX;\n\n    this.setImagePath = function(path) {\n        if (path) {\n            this.imagePath = path;\n        }\n    }\n\n    this.setImageClassPrefix = function(prefix) {\n        if (prefix) {\n            this.imageClassPrefix = prefix;\n        }\n    }\n\n    this.render = function(icon) {\n        return '<svg role=\"img\" class=\"' + this.imageClassPrefix + '-' + this.prepare(icon) + '\">' +\n                        '<use xlink:href=\"' + this.imagePath + '#icon-' + this.prepare(icon) + '\"></use>' +\n                    '</svg>'\n    }\n\n    this.prepare = function(icon) {\n        return icon.replace('icon-', '');\n    }\n}\n"],"sourceRoot":"../../../../resources/javascript"}