{"version":3,"names":[],"mappings":"","sources":["bundle-btu-calculator.js"],"sourcesContent":["(()=>{var P=Object.create;var y=Object.defineProperty,A=Object.defineProperties,z=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols,O=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var I=(o,e,t)=>e in o?y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,k=(o,e)=>{for(var t in e||(e={}))M.call(e,t)&&I(o,t,e[t]);if(C)for(var t of C(e))_.call(e,t)&&I(o,t,e[t]);return o},L=(o,e)=>A(o,H(e));var B=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var U=(o,e,t,n)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let a of R(e))!M.call(o,a)&&a!==t&&y(o,a,{get:()=>e[a],enumerable:!(n=z(e,a))||n.enumerable});return o};var F=(o,e,t)=>(t=o!=null?P(O(o)):{},U(e||!o||!o.__esModule?y(t,\"default\",{value:o,enumerable:!0}):t,o));var S=(o,e,t)=>new Promise((n,a)=>{var i=l=>{try{c(t.next(l))}catch(r){a(r)}},s=l=>{try{c(t.throw(l))}catch(r){a(r)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);c((t=t.apply(o,e)).next())});var E=B((T,x)=>{(function(o){\"use strict\";var e=function(){},t=o.requestAnimationFrame||o.webkitRequestAnimationFrame||o.mozRequestAnimationFrame||o.msRequestAnimationFrame||function(r){return setTimeout(r,16)};function n(){var r=this;r.reads=[],r.writes=[],r.raf=t.bind(o),e(\"initialized\",r)}n.prototype={constructor:n,runTasks:function(r){e(\"run tasks\");for(var d;d=r.shift();)d()},measure:function(r,d){e(\"measure\");var m=d?r.bind(d):r;return this.reads.push(m),a(this),m},mutate:function(r,d){e(\"mutate\");var m=d?r.bind(d):r;return this.writes.push(m),a(this),m},clear:function(r){return e(\"clear\",r),s(this.reads,r)||s(this.writes,r)},extend:function(r){if(e(\"extend\",r),typeof r!=\"object\")throw new Error(\"expected object\");var d=Object.create(this);return c(d,r),d.fastdom=this,d.initialize&&d.initialize(),d},catch:null};function a(r){r.scheduled||(r.scheduled=!0,r.raf(i.bind(null,r)),e(\"flush scheduled\"))}function i(r){e(\"flush\");var d=r.writes,m=r.reads,g;try{e(\"flushing reads\",m.length),r.runTasks(m),e(\"flushing writes\",d.length),r.runTasks(d)}catch(N){g=N}if(r.scheduled=!1,(m.length||d.length)&&a(r),g)if(e(\"task errored\",g.message),r.catch)r.catch(g);else throw g}function s(r,d){var m=r.indexOf(d);return!!~m&&!!r.splice(m,1)}function c(r,d){for(var m in d)d.hasOwnProperty(m)&&(r[m]=d[m])}var l=o.fastdom=o.fastdom||new n;typeof define==\"function\"?define(function(){return l}):typeof x==\"object\"&&(x.exports=l)})(typeof window!=\"undefined\"?window:typeof T!=\"undefined\"?T:globalThis)});var v=class{constructor(){this.wattsPerBtu=3.41214;this.feetPerMeter=3.28084;this.btuFloorModifier=.925;this.btuCeilingModifier=1.1;this.measurementUnit=Object.freeze({feet:1,meters:2})}calculate(e,t){if(t!==this.measurementUnit.feet&&t!==this.measurementUnit.meters)throw\"Invalid measurement unit.\";let a=this.calculateRoomDimensions(e,t)*e.roomTypeModifier*e.windowTypeModifier*e.roomExposureModifier,i=a*this.btuFloorModifier,s=a*this.btuCeilingModifier;return{btuFrom:Math.round(i),btuTo:Math.round(s),wattFrom:Math.round(i/this.wattsPerBtu),wattTo:Math.round(s/this.wattsPerBtu)}}calculateRoomDimensions(e,t){let n=t===this.measurementUnit.feet?1:this.feetPerMeter;return e.length*n*(e.width*n)*(e.height*n)}};var h=class{static trackException(e){f.deferTask(()=>{typeof appInsights!=\"undefined\"&&appInsights.trackException(e)})}static trackEvent(e,t){f.deferTask(()=>{typeof appInsights!=\"undefined\"&&appInsights.trackEvent(e,t)})}};window.Logger=h;var w=F(E());var f=class o{constructor(){this.detectTouch(),this.detectKeyboard()}detectTouch(){window.addEventListener(\"touchstart\",e=>{document.getElementsByTagName(\"html\")[0].classList.add(\"user-has-touched\")})}static isTouch(){return document.documentElement.classList.contains(\"touch\")}detectKeyboard(){let e=document.getElementsByTagName(\"html\")[0],t=\"using-keyboard\";document.addEventListener(\"keydown\",()=>{w.default.mutate(()=>{e.classList.add(t)})}),document.addEventListener(\"mousedown\",()=>{w.default.mutate(()=>{e.classList.remove(t)})}),document.addEventListener(\"touchstart\",()=>{w.default.mutate(()=>{e.classList.remove(t)})})}static isUsingKeyboard(){return document.getElementsByTagName(\"html\")[0].classList.contains(\"using-keyboard\")}static hasUserTouched(){return document.getElementsByTagName(\"html\")[0].classList.contains(\"user-has-touched\")}static createEventForDispatch(e){let t;return typeof Event==\"function\"?t=new Event(e):(t=document.createEvent(\"Event\"),t.initEvent(e,!0,!0)),t}static createCustomEventForDispatch(e,t={}){let n;return window.CustomEvent&&typeof window.CustomEvent==\"function\"?n=new CustomEvent(e,{detail:t}):(n=document.createEvent(\"CustomEvent\"),n.initCustomEvent(e,!0,!0,t)),n}static getOffset(e){var t=e.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,a=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+a,left:t.left+n}}static debounce(e,t){let n=null;t=t||300;let a=function(){let i=this,s=arguments;clearTimeout(n),n=setTimeout(function(){e.apply(i,s)},t)};return a.cancel=function(){clearTimeout(n)},a}static getKeypressed(e){let t=e.key;if(t!==void 0)return t;let n=e.keyCode;if(n!==void 0)return n}static hash(e){let t=0;if(e.length)for(let n=0;n{s+=i;let l=o.easeInOutQuad(s,n,a,t);window.scrollTo(0,l),st(),a.onerror=()=>n(),a.src=e,a.style.opacity=\"0.0001\",a.style.position=\"fixed\",a.style.pointerEvents=\"none\",a.style.top=\"0px\",a.style.left=navigator.userAgent.toLowerCase().indexOf(\"firefox\")>-1?\"0px\":\"calc(100% - 1px)\",a.style.zIndex=\"100\",document.body.appendChild(a);var i='';document.getElementsByTagName(\"head\")[0].insertAdjacentHTML(\"beforeend\",i)}})}static empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)}static fadeOut(e,t){e.style.opacity=1,function n(){(e.style.opacity-=.1)<0?(e.style.display=\"none\",t()):requestAnimationFrame(n)}()}static fadeIn(e,t=\"block\",n){e.style.opacity=0,e.style.display=t||\"block\",function a(){var i=parseFloat(e.style.opacity);(i+=.1)>1?n():(e.style.opacity=i,requestAnimationFrame(a))}()}static pagination(e,t,n){let a=Math.ceil(e/t);return{currentPage:Math.ceil(n/t+1),totalPages:a}}static truncateText(e,t,n=\"...\"){let a=e.trim();if(e.length>a.length){let i=e.substr(0,t);i=i.substr(0,Math.min(i.length,i.lastIndexOf(\" \"))),a=i+n}return a}static isHidden(e){return e?e.offsetParent===null:!0}static getBrowser(){var e=navigator.userAgent,t,n=e.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i)||[];return/trident/i.test(n[1])?(t=/\\brv[ :]+(\\d+)/g.exec(e)||[],{name:\"IE\",version:t[1]||\"\"}):n[1]===\"Chrome\"&&(t=e.match(/\\bOPR|Edge\\/(\\d+)/),t!=null)?{name:\"Opera\",version:t[1]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,\"-?\"],(t=e.match(/version\\/(\\d+)/i))!=null&&n.splice(1,1,t[1]),{name:n[0],version:n[1]})}static isIOS(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}static isWholeElementInViewport(e){let t=e.offsetTop,n=e.offsetLeft,a=e.offsetWidth,i=e.offsetHeight;for(;e.offsetParent;)e=e.offsetParent,t+=e.offsetTop,n+=e.offsetLeft;return t>=window.pageYOffset&&n>=window.pageXOffset&&t+i<=window.pageYOffset+window.innerHeight&&n+a<=window.pageXOffset+window.innerWidth}static clamp(e,t,n){return e>n?n:e/g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\")}static getPageTemplate(){let e=document.body.getAttribute(\"data-page-template\");return e||null}static fetchWithTimeout(a){return S(this,arguments,function*(e,t={},n=5e3){let i=new AbortController,{signal:s}=i,c=fetch(e,L(k({},t),{signal:s})),l=setTimeout(()=>i.abort(),n);try{let r=yield c;return clearTimeout(l),r}catch(r){throw clearTimeout(l),r}})}static objectsAreTheSame(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return h.trackException(n),!1}}static deferTask(e,t=250){requestIdleCallback(()=>{e()},{timeout:t})}static getElementIndex(e){return!e||!e.parentNode?-1:Array.prototype.slice.call(e.parentNode.children).indexOf(e)}static roundToTwoDecimals(e){return Math.round((e+Number.EPSILON)*100)/100}static searchDataLayer(e){for(let t=0;t{u.html.addClass(o?\"touch\":\"no-touch\")})},preInit:function(){u.detectTouch(),u.standalone(),u.userNav(),u.detectNoHover(),u.detectDefaultFontSize(),u.detectInteractionMediaQuerySupport(),u.detectGridSupport(),u.instantPageLinks(),u.openLiveChat(),u.disableFooterNewsletterInput(),u.init()},init:function(){u.smoothScroll(),u.forms.init(),u.cms.init()},debugFontWeight:function(){for(var o=document.querySelectorAll(\"*\"),e=0;e{$(this).addClass(t)})},function(){!u.modernizrIsTouch()&&window.matchMedia(n).matches&&p.default.mutate(()=>{$(this).removeClass(t)})}),e.find(\"a\").on(\"click\",function(){var a=$(this).parent();if(u.modernizrIsTouch()&&window.matchMedia(n).matches)return p.default.mutate(()=>{a.toggleClass(t)}),!1}),$(window).on(\"resize\",function(){p.default.mutate(()=>{e.removeClass(t)})}))},smoothScroll:function(){$('a[href*=\"#\"]:not(.scrollDone):not(.js-tooltip-trigger):not(.js-ignore-scroll):not(.js-print):not(.js-skip-link)').each(function(){var o=$(this);o.on(\"click\",function(){if(location.pathname.replace(/^\\//,\"\")==this.pathname.replace(/^\\//,\"\")&&location.hostname==this.hostname){var e=$(this.hash);if(e=e.length<=1&&e||$(\"[name=\"+this.hash.slice(1)+\"]\"),e.length){var t=e.offset().top;return $(window).scrollTop!=t&&$(\"html, body\").animate({scrollTop:t},u.transitionSpeed*2),!1}}}),o.addClass(\"scrollDone\")})},forms:{init:function(){u.forms.adapters(),u.forms.disabled(),u.forms.submit(),u.forms.autocomplete.init(),u.forms.maxlength(),u.forms.rating(),u.forms.showIf(),u.forms.captcha(),u.forms.scrollToFormMessages()},adapters:function(){$.validator.unobtrusive.adapters.addBool(\"mandatory\",\"required\"),$.validator.addMethod(\"filesize\",function(o,e,t){for(var n=parseInt(e.getAttribute(\"data-max-upload-size\")),a=!0,i=0,s=0;sn&&(a=!1),this.optional(e)||a},function(o,e){var t=parseInt(e.getAttribute(\"data-max-upload-size\")),n=(t/(1024*1024)).toFixed(2);return\"Total file size must be less than \"+n+\"MB\"}),$.validator.unobtrusive.adapters.add(\"requiredif\",[\"dependentproperty\",\"dependentvalue\",\"pattern\"],function(o){o.rules.requiredif=o.params,o.message&&(o.messages.requiredif=o.message)}),$.validator.addMethod(\"requiredif\",function(o,e,t){var n=t.dependentproperty;e.closest(\".js-address-lookup\")&&(n=\"AddressViewModel.\"+t.dependentproperty);var a=$(e).closest(\"form\").find('[name=\"'+n+'\"]').val();if(a==t.dependentvalue){var i=new RegExp(t.pattern.replaceAll(\"^(?i)\",\"^\"),\"i\");return $(e).attr(\"name\").toLowerCase().indexOf(\"postcode\")>-1?i=new RegExp(t.pattern.replaceAll(\"^(?i)\",\"^\"),\"i\"):i=new RegExp(t.pattern),i.test(o)}return!0})},disabled:function(){$(\"a.disabled, button.disabled, input.disabled\").off(\"click.site.disabled\").on(\"click.site.disabled\",function(){return!1})},submit:function(){$(\"form:not(.formDone)\").each(function(){var o=$(this),e=$(window);o.on(\"submit\",function(){o.removeData(\"validator\"),o.removeData(\"unobtrusiveValidation\"),$.validator.setDefaults({ignore:\":hidden:not(select)\"}),$.validator.unobtrusive.parse(o),u.forms.addFilesizeRule()}),o.addClass(\"formDone\")}),$('form[data-autosubmit=\"true\"]:not(.formAutoDone)').each(function(){var o=$(this);o.find('[data-autosubmit=\"true\"]').on(\"change\",function(){o.submit()}),o.addClass(\"formAutoDone\")})},autocomplete:{init:function(){u.forms.autocomplete.simple(),u.forms.autocomplete.products()},simple:function(){$(\"div#autocomplete\").length<1&&$(\"body\").append('
'),$(\"input[data-autocomplete]:not(.autocompleteDone,.addressLookup)\").each(function(){var o=$(this),e=o.attr(\"data-autocomplete\");o.autocomplete({minLength:2,source:e,appendTo:\"#autocomplete\",open:function(){u.win.width()<1420&&$(\"#autocomplete .ui-menu\").width(340)},select:function(t,n){window.location.href=n.item.Url},create:function(){$(this).data(\"ui-autocomplete\")._renderItem=function(t,n){return $(\"
  • \").append(\"\"+n.DisplayName+\"\").appendTo(t)}}}).attr(\"autocomplete\",\"off\"),u.win.resize(function(){o.autocomplete(\"close\")}),o.addClass(\"autocompleteDone\")})},products:function(){$(\"div#autocompleteProducts\").length<1&&$(\"body\").append('
    '),$(\"input[data-autocomplete-products]:not(.autocompleteProductsDone)\").each(function(){var o=$(this),e=o.attr(\"data-autocomplete-products\");o.autocomplete({minLength:3,source:e,position:{at:\"left-120px top+100%\"},appendTo:\"#autocompleteProducts\",select:function(t,n){return location.href=n.item.Url,!1}}).attr(\"autocomplete\",\"off\").data(\"ui-autocomplete\")._renderItem=function(t,n){t.addClass(\"autocomplete-products\");var a=$(n.Template).html();return Mustache.parse(a),$(Mustache.render(a,n)).data(\"item.autocomplete\",n).appendTo(t)},u.win.resize(function(){o.autocomplete(\"close\")}),o.addClass(\"autocompleteProductsDone\")})}},maxlength:function(){$(\"input[data-maxlength]:not(.maxlengthDone), textarea[data-maxlength]:not(.maxlengthDone)\").each(function(){var o=$(this),e=o.parent().find(\".count\"),t=parseInt(o.attr(\"data-maxlength\"),10);o.on(\"keyup click blur\",function(){var n=t-o.val().length;n<=0&&(o.val(o.val().substr(0,t)),n=0),e.text(n)}).blur(),o.addClass(\"maxlengthDone\")})},addFilesizeRule:function(){$(\"[data-max-upload-size]\").length&&$(\"[data-max-upload-size]\").rules(\"add\",{filesize:!0})},rating:function(){$(\".formRadiosRating:not(.ratingDone)\").each(function(){var o=$(this),e=o.find('input[type=\"radio\"]'),t=e.filter(\":checked\").val();function n(a){typeof a==\"undefined\"&&(a=0),a=parseInt(a,10),(isNaN(a)||a<1||a>5)&&(a=0),e.each(function(){var i=$(this),s=i.closest(\"label\");s.removeClass(\"hover\"),i.val()<=a&&s.addClass(\"hover\")})}n(t),e.closest(\"label\").hover(function(){var a=$(this).find('input[type=\"radio\"]');n(a.val())},function(){n(t)}),e.on(\"change\",function(){t=parseInt($(this).val(),10)}),o.addClass(\"ratingDone\")})},showIf:function(){$(\".formChecks[data-show-if] input[data-show-if]:checkbox:not(.showIfDone)\").each(function(){var e=$(this),t=e.attr(\"data-reverse\")==\"true\",n=e.attr(\"data-show-if\").split(\",\");function a(){if(!e.is(\":checked\")&&t)for(var i=0;i'),o.addClass(\"cmsTableDone\")})}},detectNoHover:function(){matchMedia(\"(hover: none)\").matches&&p.default.mutate(()=>{u.html.addClass(\"matchmedia-no-hover\")})},detectDefaultFontSize:function(){var o=document.getElementsByTagName(\"html\")[0],e=Number(window.getComputedStyle(o).getPropertyValue(\"font-size\").match(/\\d+/)[0]);e>16&&(o.classList.add(\"has-scaled-up-text\"),e>23&&o.classList.add(\"has-scaled-up-text-large\"))},detectInteractionMediaQuerySupport:function(){!matchMedia(\"(hover)\").matches&&!matchMedia(\"(hover: none)\").matches&&p.default.mutate(()=>{u.html.addClass(\"interaction-media-query-not-supported\")})},detectGridSupport:function(){var o=document.createElement(\"div\"),e=typeof o.style.grid==\"string\";e||p.default.mutate(()=>{u.html.addClass(\"grid-not-supported\")})},getKeyPressed:function(o){if(o.key!==void 0)return o.key;if(o.keyIdentifier!==void 0)return o.keyIdentifier;if(o.keyCode!==void 0)return o.keyCode},debounce:function(o,e,t){var n;return function(){var a=this,i=arguments,s=function(){n=null,t||o.apply(a,i)},c=t&&!n;clearTimeout(n),n=setTimeout(s,e),c&&o.apply(a,i)}},instantPageLinks:function(){let o=document.querySelectorAll(\".js-instant-page-links a\");f.scopedLoop(o,(e,t,n)=>{p.default.mutate(()=>{e.setAttribute(\"data-instant\",\"\")})},this)},openLiveChat:function(){for(var o=document.querySelectorAll(\".js-open-live-chat\"),e=0;e{o.removeAttribute(\"disabled\")},500))}},D=u;var b=class{constructor(){this.btuFormElement=document.getElementById(\"btu-calc_form\");this.btuFormElement&&(this.btuCalculatorService=new v,this.errorMessageElement=document.querySelector(\".js-btu-calc-error\"),this.btuFormElement.addEventListener(\"submit\",e=>this.handleSubmitEvent(e)),this.handleUnitChange(),this.onlyAllowNumbers())}handleSubmitEvent(e){if(e.preventDefault(),!$(this.btuFormElement).valid()){this.toggleError(!0);return}this.toggleError(!1);let t={},a=f.serialize(this.btuFormElement).split(\"&\");for(let m=0;m{let s=\"0 \"+n.closest(\".mCalculator__form__radios__item\").querySelector(\"label\").textContent.toLowerCase();t.updateUnitHints(n.value),t.setUnitPlaceholder(document.getElementById(\"btu-calc_length\"),s),t.setUnitPlaceholder(document.getElementById(\"btu-calc_width\"),s),t.setUnitPlaceholder(document.getElementById(\"btu-calc_height\"),s)})},this)}setUnitPlaceholder(e,t){e.value=\"\",e.setAttribute(\"placeholder\",t)}updateUnitHints(e){let t=document.querySelectorAll(\"span[data-btu-calc-measurement-unit-display]\");f.scopedLoop(t,function(n,a,i){n.innerHTML=e},this)}onlyAllowNumbers(){let e=this.btuFormElement.querySelectorAll(\".formText--number\");f.scopedLoop(e,function(t,n,a){t.addEventListener(\"keydown\",i=>{a.allowQuantityKeyPress(i,t)||i.preventDefault()})},this)}allowQuantityKeyPress(e,t){let n=e.key;return n?n===\".\"&&t.value.indexOf(\".\")>-1?(e.preventDefault,!1):f.isNumber(n)||n===\"Backspace\"||n===\"Delete\"||n===\"Tab\"||n===\"Enter\"||n===\".\"?!0:(e.preventDefault?e.preventDefault():e.returnValue=!1,!1):!0}toggleError(e){e?(this.errorMessageElement.style.display=\"block\",f.scrollTo(f.getOffset(this.errorMessageElement).top,100)):this.errorMessageElement.style.display=\"none\"}};new b;})();\n"],"file":"bundle-btu-calculator-90f7c08d17.js"}