{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/packs/cookie_hp_estimator.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","purchasePrices","document","querySelectorAll","monthlyRents","extraWorks","getInput","array","cookieName","forEach","element","addEventListener","event","days","Date","setTime","getTime","cookie","concat","toUTCString","setCookie"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,qBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,kBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAArB,EAAAU,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAzB,EAAA6B,EAAA,SAAA1B,GACA,IAAAS,EAAAT,KAAAqB,WACA,WAA2B,OAAArB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAiB,EAAAC,GAAsD,OAAAjB,OAAAkB,UAAAC,eAAA1B,KAAAuB,EAAAC,IAGtD/B,EAAAkC,EAAA,UAIAlC,IAAAmC,EAAA,qBCjFA,IAAMC,EAAiBC,SAASC,iBAAiB,mCAC3CC,EAAeF,SAASC,iBAAiB,iCACzCE,EAAaH,SAASC,iBAAiB,gCAevCG,EAAW,SAACC,EAAOC,GACvBD,EAAME,QAAQ,SAACC,GACbA,EAAQC,iBAAiB,WAAY,SAAAC,GACnC,GAAoB,GAAjBF,EAAQxB,MAAY,CACrB,IAAMA,EAAQwB,EAAQxB,OAXZ,SAACV,EAAMU,EAAO2B,GAC9B,IAAItC,EAAI,IAAIuC,KACZvC,EAAEwC,QAAQxC,EAAEyC,UAAY,MAAcH,GACtCX,SAASe,OAAT,GAAAC,OAAqB1C,EAArB,KAAA0C,OAA6BhC,EAA7B,oBAAAgC,OAAqD3C,EAAE4C,eASjDC,CAAUZ,EAAWtB,EAAO,SAOpCoB,EAASL,EAxBiB,kBAyB1BK,EAASF,EAxBe,gBAyBxBE,EAASD,EAxBc","file":"js/cookie_hp_estimator-b9d9b83028657efe160f.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n","// where to pick the input from\nconst purchasePrices = document.querySelectorAll('#purchase-price-input-estimator');\nconst monthlyRents = document.querySelectorAll('#monthly-rent-input-estimator');\nconst extraWorks = document.querySelectorAll('#extra-works-input-estimator');\n\n// cookie names\nconst purchasePriceName = 'purchase_price';\nconst monthlyRentName = 'monthly_rent';\nconst extraWorksName = 'extra_works';\n\n// set up the cookie\nconst setCookie = (name, value, days) => {\n let d = new Date;\n d.setTime(d.getTime() + 24*60*60*1000*days);\n document.cookie = `${name}=${value};path=/;expires=${d.toUTCString()}`;\n}\n\n// get the input from the user and create the cookie\nconst getInput = (array, cookieName) => {\n array.forEach((element) => {\n element.addEventListener('focusout', event => {\n if(element.value != 0) {\n const value = element.value;\n setCookie(cookieName,value, 1);\n }\n });\n });\n};\n\n// fire the function for the 3 fields\ngetInput(purchasePrices,purchasePriceName);\ngetInput(monthlyRents,monthlyRentName);\ngetInput(extraWorks,extraWorksName);\n\n\n"],"sourceRoot":""}