(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pvm_MapboxAddressInput"],{"26a6":function(t,e,n){"use strict";n.r(e);var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:"pvm-search-control-container "+t.containerClass,style:t.containerStyle},[n("form",{staticClass:"pvm-search-control-form",attrs:{id:"search-form",autocomplete:"off"},on:{submit:function(e){return e.preventDefault(),t.handleSearchFormSubmit(e)}}},[n("input",{class:"pvm-search-control-input "+t.inputClass,style:t.inputStyle,attrs:{id:t.inputID,placeholder:this.$props.placeholder||"Search the map",tabindex:"0"},domProps:{value:t.addressEntered},on:{keyup:t.didType}})]),""!=t.addressEntered&&null!=t.addressEntered?n("button",{class:"pvm-search-control-button "+t.buttonClass,on:{click:t.handleFormX}},[n("font-awesome-icon",{attrs:{icon:"times"}})],1):t._e(),n("button",{class:"pvm-search-control-button "+t.buttonClass,attrs:{name:"pvm-search-control-button",tabindex:"-1"},on:{click:t.handleSearchFormSubmit}},[n("font-awesome-icon",{attrs:{icon:"search"}})],1),t._t("address-candidates-slot")],2)},i=[],o=(n("d81d"),n("d3b7"),n("25f0"),n("85b1")),a=n("bc3a"),d=n.n(a),r=n("a78e"),c={name:"MapAddressInput",props:["position","widthFromConfig","placeholder","static"],data:function(){var t={containerStyle:{width:"305px"},inputStyle:{width:"250px"},inputID:Object(r["a"])(),addressEntered:null};return t},computed:{map:function(){return this.$store.state.map.map},inputWidth:function(){return""===this.addressEntered||null===this.addressEntered?this.$props.widthFromConfig-55:this.$props.widthFromConfig-108},inputClass:function(){return this.isMobileOrTablet?"pvm-input-mobile":"pvm-input-non-mobile"},containerClass:function(){return this.isMobileOrTablet?"pvm-container-mobile":"pvm-container-non-mobile"},buttonClass:function(){return this.isMobileOrTablet?"pvm-button-mobile":"pvm-button-non-mobile"},addressAutocompleteEnabled:function(){return!!this.$config.addressInput&&!0===this.$config.addressInput.autocompleteEnabled},isMobileOrTablet:function(){return this.$store.state.isMobileOrTablet}},watch:{addressEntered:function(t){this.handleWindowResize()}},created:function(){window.addEventListener("resize",this.handleWindowResize),this.handleWindowResize(),this.$config.defaultAddress&&(this.addressEntered=this.$config.defaultAddress)},methods:{didType:Object(o["a"])((function(t){var e=t.target.value;if(this.$data.addressEntered=e,this.addressAutocompleteEnabled){if("ArrowDown"===t.key)return void document.getElementById("address-candidate-list-0").focus();this.getCandidates(e),"Enter"!==t.key&&this.$store.commit("setShouldShowAddressCandidateList",!0)}}),300),getCandidates:function(t){d.a.get("https://cqvfg1pm72.execute-api.us-east-1.amazonaws.com/dev/first-api-test/",{params:{address:t}}).then(this.didGetCandidates).catch(this.didGetCandidatesError)},didGetCandidates:function(t){var e=t.data.matches,n=e.map((function(t){return t.address}));this.$store.commit("setCandidates",n)},didGetCandidatesError:function(t){console.log("error getting candidates",t),this.$store.commit("setCandidates",[])},handleFormX:function(){console.log("handleFormX is running"),this.$data.addressEntered="",this.$store.commit("setShouldShowAddressCandidateList",!1),this.$store.commit("setCandidates",[])},handleSearchFormSubmit:function(){var t;console.log("MapAddressInput handleSearchFormSubmit is running"),t=this.addressAutocompleteEnabled?this.$data.addressEntered:document.querySelector("#"+this.$data.inputID.toString()).value,this.$emit("handle-search-form-submit",t)},handleWindowResize:function(){var t=this.addressEntered;window.innerWidth>=850?(this.containerStyle.width=this.$props.widthFromConfig+"px",this.inputStyle.width=""===t||null===t?this.$props.widthFromConfig-55+"px":this.$props.widthFromConfig-108+"px"):window.innerWidth>=750&&!this.$props.static?(this.containerStyle.width=this.$props.widthFromConfig-100+"px",this.inputStyle.width=""===t||null===t?this.$props.widthFromConfig-155+"px":this.$props.widthFromConfig-208+"px"):(this.containerStyle.width="280px",this.inputStyle.width=""===t||null===t?"225px":"172px")}}},l=c,h=(n("4aa6"),n("2877")),u=Object(h["a"])(l,s,i,!1,null,"9a474162",null);e["default"]=u.exports},"3d32":function(t,e,n){},"4aa6":function(t,e,n){"use strict";var s=n("3d32"),i=n.n(s);i.a}}]);
//# sourceMappingURL=pvm_MapboxAddressInput.63601d5d.js.map