!function(){function t(r){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(r)}function r(){"use strict";r=function(){return n};var e,n={},o=Object.prototype,i=o.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{f({},"")}catch(e){f=function(t,r,e){return t[r]=e}}function h(t,r,n,o){var i=r&&r.prototype instanceof y?r:y,a=Object.create(i.prototype);return f(a,"_invoke",function(t,r,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=p(t,r,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(t,n,new O(o||[])),!0),a}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var l={};function y(){}function v(){}function d(){}var g={};f(g,u,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(j([])));b&&b!==o&&i.call(b,u)&&(g=b);var w=d.prototype=y.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function _(r,e){function n(o,a,u,c){var s=p(r[o],r,a);if("throw"!==s.type){var f=s.arg,h=f.value;return h&&"object"==t(h)&&i.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):e.resolve(h).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,c)}))}c(s.arg)}var o;f(this,"_invoke",(function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}),!0)}function E(t,r){var n=r.method,o=t.i[n];if(o===e)return r.delegate=null,"throw"===n&&t.i.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=p(o,t.i,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,l;var a=i.arg;return a?a.done?(r[t.r]=a.value,r.next=t.n,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,l):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}function k(t){this.tryEntries.push(t)}function S(t){var r=t[4]||{};r.type="normal",r.arg=e,t[4]=r}function O(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function j(r){if(null!=r){var n=r[u];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function t(){for(;++o<r.length;)if(i.call(r,o))return t.value=r[o],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(t(r)+" is not iterable")}return v.prototype=d,f(w,"constructor",d),f(d,"constructor",v),v.displayName=f(d,s,"GeneratorFunction"),n.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,s,"GeneratorFunction")),t.prototype=Object.create(w),t},n.awrap=function(t){return{__await:t}},x(_.prototype),f(_.prototype,c,(function(){return this})),n.AsyncIterator=_,n.async=function(t,r,e,o,i){void 0===i&&(i=Promise);var a=new _(h(t,r,e,o),i);return n.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),f(w,s,"Generator"),f(w,u,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},n.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e){a.type="throw",a.arg=t,r.next=e}for(var o=r.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=e,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),S(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;S(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={i:j(t),r:r,n:n},"next"===this.method&&(this.arg=e),l}},n}function e(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function n(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function u(t){e(a,o,i,u,c,"next",t)}function c(t){e(a,o,i,u,c,"throw",t)}u(void 0)}))}}!function(t,e,o){var i,a=function(){var t=n(r().mark((function t(n){var i,a;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((i=n.querySelector(".ginput_recaptchav3 .gfield_recaptcha_response"))&&!i.value.length){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,e.execute(o.site_key,{action:"submit"});case 5:(a=t.sent).length&&"string"==typeof a&&(i.value=a);case 7:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),u=function(){var t=n(r().mark((function t(n){var i,a;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((i=n.querySelector(".ginput_recaptchav3 .gfield_recaptcha_response"))&&!i.value.length){t.next=3;break}return t.abrupt("return");case 3:return t.prev=3,t.next=6,e.enterprise.execute(o.site_key,{action:"submit"});case 6:(a=t.sent).length&&"string"==typeof a&&(i.value=a),t.next=13;break;case 10:return t.prev=10,t.t0=t.catch(3),t.abrupt("return");case 13:case 14:case"end":return t.stop()}}),t,null,[[3,10]])})));return function(r){return t.apply(this,arguments)}}();maybeDisableBadge=function(){"enterprise"===o.connection_type?e.enterprise.ready((function(){hideBadge()})):e.ready((function(){hideBadge()}))},hideBadge=function(){if(o.disable_badge){var t=document.querySelector(".grecaptcha-badge");t&&(t.style.visibility="hidden")}},i=!1,document.addEventListener("gform/postRender",(function(e){i||(i=!0,t.utils.addAsyncFilter("gform/ajax/pre_ajax_validation",function(){var t=n(r().mark((function t(e){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("enterprise"!==o.connection_type){t.next=5;break}return t.next=3,u(e.form);case 3:t.next=7;break;case 5:return t.next=7,a(e.form);case 7:return t.abrupt("return",e);case 8:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}()),t.utils.addAsyncFilter("gform/submission/pre_submission",function(){var e=n(r().mark((function e(n){return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n.submissionType!==t.submission.SUBMISSION_TYPE_SUBMIT&&n.submissionType!==t.submission.SUBMISSION_TYPE_NEXT||n.abort){r.next=9;break}if("enterprise"!==o.connection_type){r.next=7;break}return r.next=5,u(n.form);case 5:r.next=9;break;case 7:return r.next=9,a(n.form);case 9:return r.abrupt("return",n);case 10:case"end":return r.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()))})),maybeDisableBadge()}(window.gform||{},grecaptcha,gforms_recaptcha_recaptcha_strings)}();
(()=>{"use strict";const t="pg",e="fe",s="ql_id",i="fc",r="dt",n={[t]:1,[e]:!0,[s]:0,[i]:"",[r]:""},o="wp-block-kadence-query-pagination",l="wp-block-kadence-query-result-count",a="kb-query-loaded",h="kb-query-filter-update",u="kb-query-filter-trigger";class c{queryBlock;root;constructor(t){this.queryBlock=t,this.root=t.root,this.queryBlock.infiniteScroll||(this.attachListeners(),window.addEventListener(a,this.attachListeners.bind(this))),window.addEventListener(a,this.setUrlParams.bind(this))}setUrlParams(e){if(!0!==e&&e.qlID&&e.qlID!=this.queryBlock.rootID)return;const s=new URL(window.location.href);1<this.queryBlock.queryResults.page&&(s.searchParams.set(t,this.queryBlock.queryResults.page),history.pushState(null,"",window.location.pathname+"?"+s.searchParams.toString())),1==this.queryBlock.queryResults.page&&(s.searchParams.delete(t),s.searchParams.toString()?history.pushState(null,"",window.location.pathname+"?"+s.searchParams.toString()):history.pushState(null,"",window.location.pathname))}replaceHtml(t){0!==Object.keys(t).length?Object.entries(t).forEach(t=>{const[e,s]=t;this.root.querySelector("."+o+e).innerHTML=s}):this.root.querySelectorAll("."+o).forEach(function(t){t.innerHTML=""})}attachListeners(t=!0){if(!0!==t&&t.qlID&&t.qlID!=this.queryBlock.rootID)return;const e=this;var s=this.root.querySelectorAll(".page-numbers");for(let t=0;t<s.length;t++)s[t].addEventListener("click",this.paginate.bind(e))}paginate(e){if(e.preventDefault(),"page"in e.target.dataset){this.queryBlock.queryArgs[t]=Number(e.target.dataset.page.replace("/","")),this.queryBlock.newLoad("pagination");const s=e.target.closest("."+o),i=s&&s.dataset.scrollTarget?s.dataset.scrollTarget:"card";if("none"!==i){let t=this.queryBlock.queryCardContainer;"block"===i&&(t=this.queryBlock.root),t.scrollIntoView({block:"start",behavior:"smooth"})}}}}class d{queryBlock;root;constructor(t){this.queryBlock=t,this.root=t.root,this.setFilterShown(),window.addEventListener(a,this.setFilterShown.bind(this))}replaceHtml(t){0!==Object.keys(t).length?Object.entries(t).forEach(t=>{const[e,s]=t;this.root.querySelector("."+l+e).innerHTML=s}):this.root.querySelectorAll("."+l).forEach(function(t){t.innerHTML=""})}setFilterShown(t=!0){if(!0!==t&&t.qlID&&t.qlID!=this.queryBlock.rootID)return;const e=this,s=e.queryBlock.components.filters.getFirstFilter(!0);e.root.querySelectorAll("."+l).forEach(function(t){let i=!1;"showFilter"in t.dataset&&t.dataset.showFilter&&(i=!0),i&&e.queryBlock.queryResults&&s&&(t.querySelector(".show-filter").innerHTML=" in "+s)})}attachListeners(){}}class p{queryBlock;root;constructor(t){this.queryBlock=t,this.root=t.root.querySelector(".wp-block-kadence-query-noresults"),window.addEventListener(a,this.setVisibility.bind(this))}setVisibility(t=!0){!0!==t&&t.qlID&&t.qlID!=this.queryBlock.rootID||this.root&&(1>this.queryBlock.queryResults.postCount?this.root.classList.add("active"):this.root.classList.remove("active"))}}class y{queryBlock;root;uniqueID;hash;isUnique=!0;lastUpdated;type;timer;isRTL;constructor(t,e){if(this.constructor==y)throw new Error("Abstract classes can't be instantiated.");this.queryBlock=t,this.root=e,this.uniqueID=this.root.dataset.uniqueid,this.hash=this.root.dataset.hash,this.lastUpdated=Date.now(),this.isRTL=document.body&&document.body.classList.contains("rtl")}getValue(t=!1){throw new Error("Method 'getValue()' must be implemented.")}reset(){throw new Error("Method 'reset()' must be implemented.")}setValue(){throw new Error("Method 'setValue()' must be implemented.")}prefill(){if(this.hash){const t=window.location.search,e=new URLSearchParams(t);e.has(this.hash)?this.setValue(e.get(this.hash)):"buttons"==this.type&&this.setValue("")}}triggerUpdated(t){t&&t.target&&(this.queryBlock.components.filters.lastSelectedValue=t.target.value),this.lastUpdated=Date.now();var e=new Event(h,{bubbles:!0});e.qlID=this.queryBlock.rootID,this.root.dispatchEvent(e)}triggerReset(){var t=new Event(u,{bubbles:!0});t.qlID=this.queryBlock.rootID,this.root.dispatchEvent(t)}debouncedTriggerUpdated(t){const e=this;clearTimeout(e.timer),e.timer=setTimeout(()=>{e.triggerUpdated()},t)}}class f extends y{input;constructor(t,e){return super(t,e),this.input=this.root.querySelector(".kb-filter"),this.type="dropdown",this.attachListeners(),this.prefill(),this}getValue(t=!1){return this.input&&"undefined"!=this.input.value&&""!=this.input.value?t?this.input.value:{[this.hash]:this.input.value}:t?"":{[this.hash]:""}}reset(){this.input&&(this.input.value="")}setValue(t){this.input&&(this.input.value=t)}attachListeners(){this.input&&this.input.addEventListener("change",this.triggerUpdated.bind(this))}}class g extends y{inputWrap;constructor(t,e){return super(t,e),this.inputWrap=this.root.querySelector(".kadence-filter-wrap"),this.type="buttons",this.attachListeners(),this.prefill(),this}getValue(t=!1){const e=this,s=this.inputWrap.querySelectorAll("button[aria-pressed]");if(s.length>0){var i="";return s.forEach(function(t){const s=t.dataset.value?t.dataset.value:"";s&&(i=i?i+e.queryBlock.splitCharacter+s:s)}),t?i:{[this.hash]:i}}return t?"":{[this.hash]:""}}reset(){const t=this.inputWrap.querySelectorAll("button");t.length>0&&t.forEach(function(t){t.removeAttribute("aria-pressed"),t.classList.remove("pressed")})}setValue(t){const e=t?t.split(this.queryBlock.splitCharacter):[],s=this.inputWrap.querySelectorAll("button");s.length>0&&s.forEach(function(s){const i=s.dataset.value?s.dataset.value:"";(e.includes(i)||""==t&&""==i)&&(s.setAttribute("aria-pressed","true"),s.classList.add("pressed"))})}triggerButtonPress(t){t.preventDefault();const e=t.target,s=e.classList.contains("pressed");this.reset(),s?this.setValue(""):(e.setAttribute("aria-pressed",!0),e.classList.add("pressed")),this.triggerUpdated()}attachListeners(){const t=this,e=this.inputWrap.querySelectorAll("button");e.length>0&&e.forEach(function(e){e.addEventListener("click",t.triggerButtonPress.bind(t))})}}class q extends y{inputWrap;constructor(t,e){return super(t,e),this.inputWrap=this.root.querySelector(".kadence-filter-wrap"),this.type="checkbox",this.attachListeners(),this.prefill(),this}getValue(t=!1){const e=this,s=this.inputWrap.querySelectorAll('input[type="checkbox"]:checked');if(s.length>0){var i="";return s.forEach(function(t){t.value&&(i=i?i+e.queryBlock.splitCharacter+t.value:t.value)}),t?i:{[this.hash]:i}}return t?"":{[this.hash]:""}}reset(){const t=this.inputWrap.querySelectorAll('input[type="checkbox"]');t.length>0&&t.forEach(function(t){t.checked=!1})}setValue(t){const e=this,s=t?t.split(e.queryBlock.splitCharacter):[],i=this.inputWrap.querySelectorAll('input[type="checkbox"]');i.length>0&&i.forEach(function(t){s.includes(t.value)&&(t.checked=!0),t.value==e.queryBlock?.components?.filters?.lastSelectedValue&&t.focus()})}attachListeners(){const t=this,e=this.inputWrap.querySelectorAll('input[type="checkbox"]');e.length>0&&e.forEach(function(e){e.addEventListener("change",t.triggerUpdated.bind(t))})}}class v extends y{input;constructor(t,e){return super(t,e),this.input=this.root.querySelector(".kb-filter-date"),this.type="date",this.attachListeners(),this.prefill(),this}getValue(t=!1){return this.input&&"undefined"!=this.input.value&&""!=this.input.value?t?this.input.value:{[this.hash]:this.input.value}:t?"":{[this.hash]:""}}reset(){this.input.value=""}setValue(t){this.input.value=t}attachListeners(){this.input&&this.input.addEventListener("change",this.triggerUpdated.bind(this))}}class b extends y{fromSlider;toSlider;fromInput;toInput;fromDisplay;toDisplay;constructor(t,e){return super(t,e),this.type="range",this.fromSlider=this.root.querySelector(".fromSlider"),this.toSlider=this.root.querySelector(".toSlider"),this.fromInput=this.root.querySelector(".fromInput"),this.toInput=this.root.querySelector(".toInput"),this.fromDisplay=this.root.querySelector(".from-display"),this.toDisplay=this.root.querySelector(".to-display"),this.fillSlider(this.fromSlider,this.toSlider,this.toSlider),this.setToggleAccessible(this.toSlider),this.attachListeners(),this.prefill(),this}getValue(t=!1){if(this.toInput&&"undefined"!=this.toInput.value&&""!=this.toInput.value||this.fromInput&&"undefined"!=this.fromInput.value&&""!=this.fromInput.value){const e=this.fromInput.value+this.queryBlock.splitCharacter+this.toInput.value;return t?e:{[this.hash]:e}}return t?"":{[this.hash]:""}}reset(){this.fromSlider.value=this.fromSlider.min,this.toSlider.value=this.toSlider.max,this.fromInput.value=this.fromInput.min,this.toInput.value=this.toInput.max,this.fillSlider(this.fromSlider,this.toSlider,this.toSlider),this.setToggleAccessible(this.toSlider)}setValue(t){const[e,s]=t.split(this.queryBlock.splitCharacter);e&&(this.fromSlider.value=e,this.fromInput.value=e),s&&(this.toSlider.value=s,this.toInput.value=s),this.fillSlider(this.fromSlider,this.toSlider,this.toSlider),this.setToggleAccessible(this.toSlider)}attachListeners(){const t=this;this.fromSlider.addEventListener("input",this.controlFromSlider.bind(t)),this.toSlider.addEventListener("input",this.controlToSlider.bind(t)),this.fromInput.addEventListener("blur",this.controlFromInput.bind(t)),this.toInput.addEventListener("blur",this.controlToInput.bind(t))}controlFromInput(){if(""===this.fromInput.value)return;const[t,e]=this.getParsed(this.fromInput,this.toInput);t>e?(this.fromSlider.value=e,this.fromInput.value=e):this.fromSlider.value=t,this.fillSlider(this.fromSlider,this.toSlider,this.toSlider),this.debouncedTriggerUpdated(1e3)}controlToInput(){if(""===this.toInput.value)return;const[t,e]=this.getParsed(this.fromInput,this.toInput);this.setToggleAccessible(this.toSlider),t<=e?this.toSlider.value=e:(this.toInput.value=t,this.toSlider.value=t),this.fillSlider(this.fromSlider,this.toSlider,this.toSlider),this.debouncedTriggerUpdated(1e3)}controlFromSlider(){const[t,e]=this.getParsed(this.fromSlider,this.toSlider);t>e?(this.fromSlider.value=e,this.fromInput.value=e):this.fromInput.value=t,this.fillSlider(this.fromSlider,this.toSlider,this.toSlider),this.debouncedTriggerUpdated(1e3)}controlToSlider(){const[t,e]=this.getParsed(this.fromSlider,this.toSlider);this.setToggleAccessible(this.toSlider),t<=e?(this.toSlider.value=e,this.toInput.value=e):(this.toInput.value=t,this.toSlider.value=t),this.fillSlider(this.fromSlider,this.toSlider,this.toSlider),this.debouncedTriggerUpdated(1e3)}getParsed(t,e){return[parseInt(t.value,10),Math.ceil(parseFloat(e.value))]}fillSlider(t,e,s){const i=e.max-e.min,r=t.value-e.min,n=e.value-e.min;var o="to right";this.isRTL&&(o="to left");const l=s.getAttribute("data-sliderColor"),a=s.getAttribute("data-sliderHighlightColor");s.style.background=`linear-gradient(\n            ${o},\n            ${l} 0%,\n            ${l} ${r/i*100}%,\n            ${a} ${r/i*100}%,\n            ${a} ${n/i*100}%,\n            ${l} ${n/i*100}%,\n            ${l} 100%\n)`;const h=`calc(${r/i*100}% -(20px * ${r/i}) - 1px)`,u=`calc(${n/i*100}% -(20px * ${n/i}) - 1px)`;this.isRTL?(this.fromDisplay.style.right=h,this.toDisplay.style.right=u):(this.fromDisplay.style.left=h,this.toDisplay.style.left=u),this.fromDisplay.innerHTML=t.value,this.toDisplay.innerHTML=e.value}setToggleAccessible(t){Number(t.value)<=0?this.toSlider.style.zIndex=2:this.toSlider.style.zIndex=0}}class m extends y{inputWrap;constructor(t,e){return super(t,e),this.inputWrap=this.root.querySelector(".kadence-filter-wrap"),this.type="rating",this.attachListeners(),this.prefill(),this}getValue(t=!1){const e=this;if(this.inputWrap){const i=this.inputWrap.querySelectorAll("span[aria-pressed]");if(i.length>0){var s="";return i.forEach(function(t){const i=t.dataset.value?t.dataset.value:"";i&&(s=s?s+e.queryBlock.splitCharacter+i:i)}),t?s:{[this.hash]:s}}}return t?"":{[this.hash]:""}}reset(){const t=this.inputWrap.querySelectorAll("span");t.length>0&&t.forEach(function(t){t.removeAttribute("aria-pressed"),t.classList.remove("pressed")})}setValue(t){const e=t||[],s=this.inputWrap.querySelectorAll("span");s.length>0&&s.forEach(function(t){const s=t.dataset.value?t.dataset.value:"";e.includes(s)&&(t.setAttribute("aria-pressed","true"),t.classList.add("pressed")),t.classList.contains("kbp-ql-rating-single")&&t.dataset.value<e&&t.classList.add("hover")})}triggerButtonPress(t){t.preventDefault();const e=t.target,s=e.classList.contains("pressed");if(this.reset(),s)this.setValue("");else{e.setAttribute("aria-pressed",!0),e.classList.add("pressed");const t=e.classList.contains("kbp-ql-rating-single"),s=this.inputWrap.querySelectorAll("span");t&&s.forEach(function(t){t.dataset.value===e.dataset.value?t.classList.add("pressed"):t.dataset.value<e.dataset.value&&t.classList.add("hover")})}this.triggerUpdated()}hoverHighlight(t){const e=t.target;this.inputWrap.querySelectorAll("span").forEach(function(t){t.dataset.value<e.dataset.value&&t.classList.add("hover")})}hoverOffHighlight(t){const e=this.inputWrap.querySelectorAll("span"),s=this.getValue(!0);e.forEach(function(t){(""!==s&&s<t.dataset.value||""===s)&&t.classList.remove("hover")})}attachListeners(){const t=this;if(this.inputWrap){const e=this.inputWrap.querySelectorAll("span");e.length>0&&void 0===window.kbp_listeners_attached&&(window.kbp_listeners_attached=!0,e.forEach(function(e){e.addEventListener("click",t.triggerButtonPress.bind(t)),e.classList.contains("kbp-ql-rating-single")&&(e.addEventListener("mouseover",t.hoverHighlight.bind(t)),e.addEventListener("mouseout",t.hoverOffHighlight.bind(t)))}))}}}class S extends y{button;constructor(t,e){return super(t,e),this.button=this.root.querySelector(".kb-query-filter-reset-button"),this.type="reset",this.attachListeners(),this}getValue(t=!1){return t?"":{}}reset(){return{}}setValue(t){return null}prefill(){return null}attachListeners(){this.button&&this.button.addEventListener("click",this.triggerReset.bind(this))}}class k extends y{constructor(t,e){super(t,e),this.input=this.root.querySelector(".kb-filter-search"),this.button=this.root.querySelector(".kb-filter-search-btn"),this.isUnique=!1,this.type="search",this.autoSearchEnabled="true"===this.root.dataset.autoSearch,this.debounceMs=parseInt(this.root.dataset.debounceMs)||500,this.minChars=parseInt(this.root.dataset.minChars)||3,this.debounceTimeout=null,this.abortController=null,this.lastSearchValue="",this.handleInput=this.handleInput.bind(this),this.handleButtonClick=this.handleButtonClick.bind(this),this.handleBeforeUnload=this.handleBeforeUnload.bind(this),this.attachListeners(),this.prefill(),window.addEventListener("beforeunload",this.handleBeforeUnload),document.addEventListener("visibilitychange",this.handleBeforeUnload)}getValue(t=!1){const e=this.queryBlock.rootID+"_search",s=this.input?.value||"";return t?s:{[e]:s}}reset(){this.cancelPendingSearch(),this.lastSearchValue="",this.input.value=""}setValue(t){this.input.value=t}prefill(){const t=this.queryBlock.rootID+"_search",e=new URLSearchParams(window.location.search);e.has(t)&&this.setValue(e.get(t))}handleInput(t){const e=t.target.value.trim();if("keydown"===t.type&&("Enter"===t.key||13===t.keyCode))return t.preventDefault(),this.cancelPendingSearch(),this.lastSearchValue=e,void this.triggerSearch();this.autoSearchEnabled&&"keydown"!==t.type&&(this.cancelPendingSearch(),(0===e.length?""!==this.lastSearchValue:e.length>=this.minChars&&e!==this.lastSearchValue)&&(this.debounceTimeout=setTimeout(()=>{this.lastSearchValue=e,this.executeAutoSearch()},this.debounceMs)))}executeAutoSearch(){this.abortController=new AbortController,this.triggerUpdatedWithAbort(this.abortController.signal)}triggerSearch(){this.cancelPendingSearch(),this.triggerUpdated()}cancelPendingSearch(){this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null),this.abortController&&(this.abortController.abort(),this.abortController=null)}triggerUpdatedWithAbort(t){this.lastUpdated=Date.now();const e=new Event(h,{bubbles:!0});e.qlID=this.queryBlock.rootID,e.abortSignal=t,this.root.dispatchEvent(e)}handleButtonClick(t){t.preventDefault(),this.lastSearchValue=this.input.value.trim(),this.triggerSearch()}handleBeforeUnload(){this.cancelPendingSearch()}attachListeners(){this.input&&(this.autoSearchEnabled&&this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.handleInput)),this.button&&this.button.addEventListener("click",this.handleButtonClick)}destroy(){this.cancelPendingSearch(),this.input&&(this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleInput),this.input.removeEventListener("blur",this.triggerUpdated.bind(this))),this.button&&this.button.removeEventListener("click",this.handleButtonClick),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("visibilitychange",this.handleBeforeUnload)}}class w extends y{input;constructor(t,e){return super(t,e),this.input=this.root.querySelector(".kb-sort"),this.isUnique=!1,this.type="sort",this.attachListeners(),this.prefill(),this}getValue(t=!1){const e=this.queryBlock.rootID+"_sort";return this.input&&"undefined"!=this.input.value&&""!=this.input.value?t?this.input.value:{[e]:this.input.value}:t?"":{[e]:""}}reset(){this.input.value=""}setValue(t){this.input.value=t}prefill(){const t=this.queryBlock.rootID+"_sort";if(t){const e=window.location.search,s=new URLSearchParams(e);s.has(t)&&this.setValue(s.get(t))}}attachListeners(){this.input&&this.input.addEventListener("change",this.triggerUpdated.bind(this))}}class L extends q{constructor(t,e){return super(t,e),this.type="woo-attribute",this}}class I{queryBlock;root;filters={};filterValues={};previousFilterValues={};lastSelectedFilterValue="";constructor(t){const e=this;this.queryBlock=t,this.root=t.root,this.initializeFilters(),this.compileFilterValuesAndSetQueryArgs(),window.addEventListener(h,this.runFilters.bind(e)),window.addEventListener(u,this.resetFilters.bind(e)),window.addEventListener("kb-query-filter-trigger",this.runFilters.bind(e))}replaceHtml(t){0!==Object.keys(t).length&&(Object.entries(t).forEach(t=>{const[e,s]=t;[...this.root.querySelectorAll("[data-uniqueid='"+e+"'] .filter-refresh-container")].forEach(t=>{t.innerHTML=s})}),this.initializeFilters())}initializeFilters(){const t=this;this.root.querySelectorAll(".kadence-query-filter").forEach(function(e){if("uniqueid"in e.dataset){const s=e.dataset.uniqueid;e.classList.contains("wp-block-kadence-query-filter-date")?t.filters[s]=new v(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter")?t.filters[s]=new f(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter-reset")?t.filters[s]=new S(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-sort")?t.filters[s]=new w(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter-search")?t.filters[s]=new k(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter-checkbox")?t.filters[s]=new q(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter-woo-attribute")?t.filters[s]=new L(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter-buttons")?t.filters[s]=new g(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter-range")?t.filters[s]=new b(t.queryBlock,e):e.classList.contains("wp-block-kadence-query-filter-rating")&&(t.filters[s]=new m(t.queryBlock,e))}})}setUrlParams(){const t=new URL(location.protocol+"//"+location.host+location.pathname),e=Object.keys(this.filterValues);for(let s=0;s<e.length;s++){const i=e[s],r=this.filterValues[i];r&&t.searchParams.set(i,r)}t.searchParams.toString()?history.pushState(null,"",window.location.pathname+"?"+t.searchParams.toString()):history.pushState(null,"",window.location.pathname)}compileFilterValuesAndSetQueryArgs(){this.previousFilterValues=this.filterValues,this.filterValues={};const t=Object.keys(this.filters);var e={},s={};for(let i=0;i<t.length;i++){const r=t[i],n=this.filters[r];if(n.isUnique)if(n?.hash)s[n.hash]=void 0===s[n.hash]?[]:s[n.hash],s[n.hash].push(n);else{const t=n.getValue();this.filterValues={...this.filterValues,...t}}else e[n.type]=void 0===e[n.type]?[]:e[n.type],e[n.type].push(n)}if(this.setFilterValuesFromGroupedFilters(e),this.setFilterValuesFromGroupedFilters(s),JSON.stringify(this.filterValues)!==JSON.stringify(this.previousFilterValues)){const t=Object.keys(this.filterValues);for(let e=0;e<t.length;e++){const s=t[e],i=this.filterValues[s];i?this.queryBlock.queryArgs[s]=i:delete this.queryBlock.queryArgs[s]}}}setFilterValuesFromGroupedFilters(t){const e=Object.keys(t);for(let r=0;r<e.length;r++){const n=t[e[r]];var s=null,i=0;n.forEach(function(t){i<t.lastUpdated&&(i=t.lastUpdated,s=t)});const o=s.getValue();n.forEach(function(t){t!==s&&t.setValue(Object.values(o)[0])});const l=o;this.filterValues={...this.filterValues,...l}}}runFilters(e=!0){if((!0===e||!e.qlID||e.qlID==this.queryBlock.rootID)&&(this.queryBlock.queryArgs[t]=n[t],this.compileFilterValuesAndSetQueryArgs(),JSON.stringify(this.filterValues)!==JSON.stringify(this.previousFilterValues))){this.setUrlParams();const t=!0!==e&&e.abortSignal?e.abortSignal:null;this.queryBlock.newLoad("filters",t)}}resetFilters(t=!0){if(!0!==t&&t.qlID&&t.qlID!=this.queryBlock.rootID)return;const e=Object.keys(this.filters);for(let t=0;t<e.length;t++){const s=e[t];this.filters[s].reset()}this.runFilters()}getFirstFilter(t=!1){const e=["search"],s=Object.keys(this.filters);for(let i=0;i<s.length;i++){const r=s[i],n=this.filters[r];let o="";if(o=t?n.getValue(!0):n.getValue(),o&&e.includes(n.type))return o}return""}}class E{components={};queryArgs={};_state;queryResults={};root;queryCardContainer;rootID;infiniteScroll;maxNumPages=1;splitCharacter=",";constructor(t,e={}){var s,i;const r=this;this.root="string"==typeof t?document.querySelector(t):t,this.queryCardContainer=this.root.querySelector(".wp-block-kadence-query-card"),this.maxNumPages=null!==(s=this.queryCardContainer?.dataset?.maxNumPages)&&void 0!==s?s:1,this.rootID=this.root.dataset.id,this.infiniteScroll=!!this.root.dataset.infiniteScroll,this.splitCharacter=null!==(i=window.kbpData?.queryBlockSplitCharacter)&&void 0!==i?i:",",this._state=1,this.queryArgs=this.setupQueryArgs(),this.components.pagination=new c(r),this.components.noResults=new p(r),this.components.filters=new I(r),this.components.resultCount=new d(r),this.initInfiniteScroll();var n=new Event("kb-query-mounted",{bubbles:!0});n.qlID=this.rootID,this.root.dispatchEvent(n),this._state=3}setupQueryArgs(){var e,s=this.root.dataset.id,i=null!==(e=new URLSearchParams(window.location.search).get(t))&&void 0!==e?e:1;return{...n,ql_id:s,pg:i}}newLoad(t="pagination",e=null){const s=this;var i=this.queryCardContainer.querySelector(".kb-query-grid-wrap");this.state=4,this.markLoading(),this.query(e).then(function(e){if(e){s.infiniteScroll&&"filters"!==t?i.insertAdjacentHTML("beforeend",e.posts.join("")):i.innerHTML=e.posts.join(""),s.infiniteScroll||s.components.pagination.replaceHtml(e.pagination),s.components.resultCount.replaceHtml(e.resultCount),s.components.filters.replaceHtml(e.filters),s.maxNumPages=e.maxNumPages;var r=new Event(a,{bubbles:!0});r.qlID=s.rootID,s.root.dispatchEvent(r)}s.state=3,s.markLoading(!0)},function(t){"AbortError"!==t.name&&(s.state=3,console.log("error",t))})}markLoading(t=!1){var e=this.root,s=e.querySelectorAll(".kb-query-item");t?e.classList.remove("loading"):e.classList.add("loading");for(let e=0;e<s.length;e++){const i=s[e];setTimeout(()=>{t?i.classList.remove("loading"):i.classList.add("loading")},100*(e+1))}}async query(t=null){this.startQuery();const e=this.root,s=this.queryArgs.ql_id,i={method:"GET",headers:{"X-WP-Nonce":kbp_query_loop_rest_endpoint.nonce}};t&&(i.signal=t);const r=e.querySelector("input[name='"+s+"_wp_query_hash']"),n=e.querySelector("input[name='"+s+"_wp_query_vars']");r&&n&&(i.method="POST",i.body=JSON.stringify({[this.queryArgs.ql_id+"_wp_query_hash"]:r.value,[this.queryArgs.ql_id+"_wp_query_vars"]:n.value}));try{const t=this.queryArgs,r=e.querySelector("input[name='"+s+"_query_exclude_post_id']"),n=e.querySelector("input[name='"+s+"_pll_slug']"),o=e.querySelector("input[name='"+s+"_random_seed']");r&&(t[this.queryArgs.ql_id+"_query_exclude_post_id"]=r.value),n&&(t.lang=n.value),o&&(t[this.queryArgs.ql_id+"_random_seed"]=o.value);const l=new URLSearchParams(t),a=kbp_query_loop_rest_endpoint.url+(kbp_query_loop_rest_endpoint.url.split("?")[1]?"&":"?")+l,h=await fetch(a,i);if(200==h.status){const t=await h.json();return this.queryResults=t,t}}catch(t){if("AbortError"===t.name)throw t;throw console.error("Query error:",t),t}finally{this.endQuery()}}startQuery(){}endQuery(){}initInfiniteScroll(){const t=this;if(this.infiniteScroll&&this.queryCardContainer){const e=document.createElement("div");e.classList.add("infinite-scroll-trigger"),this.queryCardContainer.insertAdjacentElement("beforeend",e);const s={threshold:1};new IntersectionObserver(this.infiniteScrollCallback.bind(t),s).observe(e)}}infiniteScrollCallback([{isIntersecting:e,target:s}]){e&&3==this.state&&this.queryArgs[t]<this.maxNumPages&&(this.queryArgs[t]++,this.newLoad())}get state(){return this._state}set state(t){this._state=t;var e=new Event("kb-query-state");e.val=t,e.qlID=this.rootID,this.root.dispatchEvent(e)}}window.KBQuery=E;const B=()=>{window.KBQueryBlocks=[];var t=document.querySelectorAll(".kadence-query-init");for(let s=0;s<t.length;s++){var e=t[s];const i=new E(e);window.KBQueryBlocks.push(i)}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()})();