1(()=>{"use strict";var t=window.jQuery,e=function(){function e(t){this.requestSeq=0,this.opts=t,this.bindAddressFields(),this.scheduleUpdate()}return Object.defineProperty(e.prototype,"$form",{get:function(){return t("#gform_".concat(this.opts.formId))},enumerable:!1,configurable:!0}),e.prototype.addressInputSelector=function(t){return"#field_".concat(this.opts.formId,"_").concat(t," input, #field_").concat(this.opts.formId,"_").concat(t," select")},e.prototype.bindAddressFields=function(){var t=this,e=[this.addressInputSelector(this.opts.originFieldId),this.addressInputSelector(this.opts.destinationFieldId)].join(", ");this.$form.on("change",e,(function(){return t.scheduleUpdate()})),window.gform.addAction("gpaa_fields_filled",(function(e,i,o,n){o!==t.opts.formId||n!==t.opts.originFieldId&&n!==t.opts.destinationFieldId||t.scheduleUpdate()}))},e.prototype.scheduleUpdate=function(){var t=this;this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((function(){return t.update()}),500)},e.prototype.getRequestData=function(){var e=this,i={action:"gpaa_compute_route",nonce:window.GP_ADDRESS_AUTOCOMPLETE_CONSTANTS.compute_route_nonce,form_id:String(this.opts.formId),field_id:String(this.opts.fieldId)};return[this.opts.originFieldId,this.opts.destinationFieldId].forEach((function(o){t(e.addressInputSelector(o)).each((function(t,e){var n,s=e,r=null===(n=s.name)||void 0===n?void 0:n.match(new RegExp("^input_".concat(o,"\\.(\\d+)$")));r&&(i["input_".concat(o,"_").concat(r[1])]=s.value)}))})),i},e.prototype.update=function(){var e=this,i=++this.requestSeq;t.post(window.GP_ADDRESS_AUTOCOMPLETE_CONSTANTS.ajaxurl,this.getRequestData()).done((function(t){var o,n;i===e.requestSeq&&(t.success?e.setResult(t.data):e.clear((null===(o=t.data)||void 0===o?void 0:o.incomplete)?"":null===(n=t.data)||void 0===n?void 0:n.message))})).fail((function(){i===e.requestSeq&&e.clear()}))},e.prototype.$input=function(t){return this.$form.find('input[name="input_'.concat(this.opts.fieldId,".").concat(t,'"]'))},e.prototype.$content=function(){return t("#field_".concat(this.opts.formId,"_").concat(this.opts.fieldId," .gpaa_travel_estimate_content"))},e.prototype.renderContent=function(t){var e=this.$content();if(!t||null===t.distance&&null===t.time)e.val(this.opts.emptyPlaceholder);else{var i=this.opts.template.split("{distance}").join(null===t.distance?"":"".concat(t.distance," ").concat(this.opts.unitLabels.distance)).split("{time}").join(null===t.time?"":"".concat(t.time," ").concat(this.opts.unitLabels.time));e.val(i)}},e.prototype.setValue=function(t,e){var i=this.$input(t);String(i.val())!==e&&i.val(e).trigger("change")},e.prototype.setResult=function(t){null!==t.distance&&this.setValue("1",String(t.distance)),null!==t.time&&this.setValue("2",String(t.time)),this.$form.find('input[name="gpaa_route_'.concat(this.opts.fieldId,'"]')).val(t.polyline),this.renderContent(t),this.setError(""),window.gform.doAction("gpaa_travel_estimate_updated",t,this.opts.formId,this.opts.fieldId)},e.prototype.clear=function(t){var e=this;void 0===t&&(t=""),Object.keys(this.opts.activeInputs).forEach((function(t){return e.setValue(t,"")})),this.$form.find('input[name="gpaa_route_'.concat(this.opts.fieldId,'"]')).val(""),this.renderContent(null),this.setError(t),window.gform.doAction("gpaa_travel_estimate_updated",null,this.opts.formId,this.opts.fieldId)},e.prototype.setError=function(e){var i=t("#field_".concat(this.opts.formId,"_").concat(this.opts.fieldId," .ginput_container_travel_estimate")),o=i.find(".gpaa_travel_estimate_error");o.text()!==e&&(o.remove(),e&&i.append(t('<div class="gpaa_travel_estimate_error"></div>').text(e)))},e}();window.GP_Address_Autocomplete_Travel_Estimate=e})()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.