Heray-Was-Here
Server : Apache
System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User : daemon ( 1)
PHP Version : 8.1.10
Disable Function : NONE
Directory :  /bitnami/wordpress/wp-content/plugins/fluentformpro/public/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /bitnami/wordpress/wp-content/plugins/fluentformpro/public/js/dynamicAutocomplete.js
(()=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function n(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}!function(){"use strict";var t=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.input=e,this.config=this.parseConfig(),this.container=e.parentElement.querySelector(".ff-autocomplete-suggestions"),this.currentFocus=-1,this.abortController=null,this.debounceTimer=null,this.init()},n=[{key:"parseConfig",value:function(){try{var t=JSON.parse(this.input.getAttribute("data-autocomplete-config")||"{}");return void 0!==t.minChars&&(t.minChars=parseInt(t.minChars,10)||1),void 0!==t.maxSuggestions&&(t.maxSuggestions=parseInt(t.maxSuggestions,10)||10),t}catch(t){return{}}}},{key:"init",value:function(){var t=this;this.input.addEventListener("input",this.handleInput.bind(this)),this.input.addEventListener("keydown",this.handleKeydown.bind(this)),this.input.addEventListener("blur",this.handleBlur.bind(this)),this.container&&this.container.addEventListener("click",this.handleSuggestionClick.bind(this)),document.addEventListener("click",this.handleOutsideClick.bind(this));var e=this.input.closest("form");e&&e.addEventListener("reset",function(){return t.closeSuggestions()})}},{key:"handleInput",value:function(){var t=this,e=this.input.value.trim();clearTimeout(this.debounceTimer),this.abortController&&this.abortController.abort();var n=parseInt(this.config.minChars,10)||1;!e||e.length<n?this.closeSuggestions():this.debounceTimer=setTimeout(function(){t.fetchSuggestions(e)},300)}},{key:"fetchSuggestions",value:function(t){var e=this;this.container&&(this.container.innerHTML='<div class="ff-autocomplete-loading">Loading...</div>',this.container.style.display="block",this.abortController=new AbortController,fetch(this.config.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({action:"fluentform-get-dynamic-autocomplete-options",form_id:this.config.formId,field_name:this.config.fieldName,search:t,max_suggestions:parseInt(this.config.maxSuggestions,10)||10,nonce:this.config.nonce}),signal:this.abortController.signal}).then(function(t){return t.json()}).then(function(t){var n;if(t.success&&null!==(n=t.data)&&void 0!==n&&null!==(n=n.options)&&void 0!==n&&n.length){var i=parseInt(e.config.maxSuggestions,10)||10,o=t.data.options.slice(0,i);e.renderSuggestions(o)}else e.showNoResults()}).catch(function(t){"AbortError"!==t.name&&e.showError()}))}},{key:"handleBlur",value:function(){var t=this;setTimeout(function(){return t.closeSuggestions()},150)}},{key:"renderSuggestions",value:function(t){var e=document.createElement("ul");e.className="ff-autocomplete-list",e.setAttribute("role","listbox"),t.forEach(function(t,n){var i=document.createElement("li");i.className="ff-autocomplete-item",i.setAttribute("role","option"),i.dataset.value=t.value,i.dataset.index=n,i.textContent=t.label,e.appendChild(i)}),this.container.innerHTML="",this.container.appendChild(e),this.container.style.display="block",this.currentFocus=-1}},{key:"handleKeydown",value:function(t){var e,n=null===(e=this.container)||void 0===e?void 0:e.querySelectorAll(".ff-autocomplete-item");if(n&&n.length)switch(t.key){case"ArrowDown":t.preventDefault(),this.currentFocus=(this.currentFocus+1)%n.length,this.setActive(n);break;case"ArrowUp":t.preventDefault(),this.currentFocus=(this.currentFocus-1+n.length)%n.length,this.setActive(n);break;case"Enter":this.currentFocus>-1&&(t.preventDefault(),n[this.currentFocus].click());break;case"Escape":this.closeSuggestions()}}},{key:"setActive",value:function(t){t.forEach(function(t){return t.classList.remove("ff-autocomplete-active")});var e=t[this.currentFocus];if(e){e.classList.add("ff-autocomplete-active");var n=this.container.querySelector(".ff-autocomplete-list");if(n){var i=e.offsetTop,o=i+e.offsetHeight;i<n.scrollTop?n.scrollTop=i:o>n.scrollTop+n.offsetHeight&&(n.scrollTop=o-n.offsetHeight)}}}},{key:"handleSuggestionClick",value:function(t){var e=t.target.closest(".ff-autocomplete-item");e&&(this.input.value=e.dataset.value,this.input.dispatchEvent(new Event("change",{bubbles:!0})),this.closeSuggestions(),this.input.focus())}},{key:"handleOutsideClick",value:function(t){t.target.closest(".ff-dynamic-autocomplete")||t.target.closest(".ff-autocomplete-suggestions")||this.closeSuggestions()}},{key:"showNoResults",value:function(){this.container.innerHTML='<div class="ff-autocomplete-no-results">No suggestions found</div>',this.container.style.display="block"}},{key:"showError",value:function(){this.container.innerHTML='<div class="ff-autocomplete-error">Error loading suggestions</div>',this.container.style.display="block"}},{key:"closeSuggestions",value:function(){this.container&&(this.container.style.display="none",this.container.innerHTML="",this.currentFocus=-1)}}],n&&e(t.prototype,n),i&&e(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i}();document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".ff-dynamic-autocomplete").forEach(function(e){e.dataset.autocompleteInitialized||(new t(e),e.dataset.autocompleteInitialized="true")})}),document.addEventListener("reInitExtras",function(e){var n;null===(n=e.target)||void 0===n||null===(n=n.querySelectorAll(".ff-dynamic-autocomplete"))||void 0===n||n.forEach(function(e){e.dataset.autocompleteInitialized||(new t(e),e.dataset.autocompleteInitialized="true")})})}()})();

Hry