(function(){"use strict";var lt={1609:(function(e){e.exports=window.React}),2877:(function(e,t,n){e.exports=n(6562)}),6562:(function(e,t,n){/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var s=n(1609);function o(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var a=typeof Object.is=="function"?Object.is:o,r=s.useState,i=s.useEffect,c=s.useLayoutEffect,g=s.useDebugValue;function d(h,p){var I=p(),f=r({inst:{value:I,getSnapshot:p}}),L=f[0].inst,q=f[1];return c(function(){L.value=I,L.getSnapshot=p,u(L)&&q({inst:L})},[h,I,p]),i(function(){return u(L)&&q({inst:L}),h(function(){u(L)&&q({inst:L})})},[h]),g(I),I}function u(h){var p=h.getSnapshot;h=h.value;try{var I=p();return!a(h,I)}catch{return!0}}function v(h,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?v:d;t.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:l}),6889:(function(e,t,n){/** @license React v17.0.2
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */n(8995);var s=n(1609),o=60103;if(t.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var a=Symbol.for;o=a("react.element"),t.Fragment=a("react.fragment")}var r=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i=Object.prototype.hasOwnProperty,c={key:!0,ref:!0,__self:!0,__source:!0};function g(d,u,v){var l,h={},p=null,I=null;v!==void 0&&(p=""+v),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(I=u.ref);for(l in u)i.call(u,l)&&!c.hasOwnProperty(l)&&(h[l]=u[l]);if(d&&d.defaultProps)for(l in u=d.defaultProps,u)h[l]===void 0&&(h[l]=u[l]);return{$$typeof:o,type:d,key:p,ref:I,props:h,_owner:r.current}}t.jsx=g,t.jsxs=g}),8995:(function(e){/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function a(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var i={},c=0;c<10;c++)i["_"+String.fromCharCode(c)]=c;var g=Object.getOwnPropertyNames(i).map(function(u){return i[u]});if(g.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(u){d[u]=u}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}e.exports=a()?Object.assign:function(r,i){for(var c,g=o(r),d,u=1;u<arguments.length;u++){c=Object(arguments[u]);for(var v in c)n.call(c,v)&&(g[v]=c[v]);if(t){d=t(c);for(var l=0;l<d.length;l++)s.call(c,d[l])&&(g[d[l]]=c[d[l]])}}return g}}),9691:(function(e,t,n){e.exports=n(6889)})},Pe={};function A(e){var t=Pe[e];if(t!==void 0)return t.exports;var n=Pe[e]={exports:{}};return lt[e](n,n.exports,A),n.exports}(function(){A.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return A.d(t,{a:t}),t}})(),(function(){A.d=function(e,t){for(var n in t)A.o(t,n)&&!A.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){A.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var an={},O=A(9691),D=window.wp.i18n,ft=window.wp.blocks,dt=window.wp.serverSideRender,pt=A.n(dt),K=window.wp.components,_t=(e=>(e[e.Search=1]="Search",e[e.Settings=2]="Settings",e[e.Results=3]="Results",e))(_t||{}),ht=({instance:e,shortcodeType:t})=>{let n="wd_asp";const s=parseInt(t.toString());return s===2?n="wpdreams_asp_settings":s===3&&(n="wpdreams_ajaxsearchpro_results"),`[${n} id=${e}]`},w=A(1609),vt=A(2877);const Fe=0,Ve=1,Me=2,ke=3;var We=Object.prototype.hasOwnProperty;function pe(e,t){var n,s;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((s=e.length)===t.length)for(;s--&&pe(e[s],t[s]););return s===-1}if(!n||typeof e=="object"){s=0;for(n in e)if(We.call(e,n)&&++s&&!We.call(t,n)||!(n in t)||!pe(e[n],t[n]))return!1;return Object.keys(t).length===s}}return e!==e&&t!==t}const k=new WeakMap,H=()=>{},R=H(),oe=Object,_=e=>e===R,P=e=>typeof e=="function",W=(e,t)=>({...e,...t}),qe=e=>P(e.then),_e={},ae={},he="undefined",te=typeof window!=he,ve=typeof document!=he,mt=te&&"Deno"in window,wt=()=>te&&typeof window.requestAnimationFrame!=he,Ue=(e,t)=>{const n=k.get(e);return[()=>!_(t)&&e.get(t)||_e,s=>{if(!_(t)){const o=e.get(t);t in ae||(ae[t]=o),n[5](t,W(o,s),o||_e)}},n[6],()=>!_(t)&&t in ae?ae[t]:!_(t)&&e.get(t)||_e]};let me=!0;const gt=()=>me,[we,ge]=te&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[H,H],bt=()=>{const e=ve&&document.visibilityState;return _(e)||e!=="hidden"},St=e=>(ve&&document.addEventListener("visibilitychange",e),we("focus",e),()=>{ve&&document.removeEventListener("visibilitychange",e),ge("focus",e)}),Et=e=>{const t=()=>{me=!0,e()},n=()=>{me=!1};return we("online",t),we("offline",n),()=>{ge("online",t),ge("offline",n)}},Ot={isOnline:gt,isVisible:bt},xt={initFocus:St,initReconnect:Et},Be=!w.useId,ne=!te||mt,Rt=e=>wt()?window.requestAnimationFrame(e):setTimeout(e,1),ie=ne?w.useEffect:w.useLayoutEffect,be=typeof navigator<"u"&&navigator.connection,$e=!ne&&be&&(["slow-2g","2g"].includes(be.effectiveType)||be.saveData),ce=new WeakMap,yt=e=>oe.prototype.toString.call(e),Se=(e,t)=>e===`[object ${t}]`;let jt=0;const Ee=e=>{const t=typeof e,n=yt(e),s=Se(n,"Date"),o=Se(n,"RegExp"),a=Se(n,"Object");let r,i;if(oe(e)===e&&!s&&!o){if(r=ce.get(e),r)return r;if(r=++jt+"~",ce.set(e,r),Array.isArray(e)){for(r="@",i=0;i<e.length;i++)r+=Ee(e[i])+",";ce.set(e,r)}if(a){r="#";const c=oe.keys(e).sort();for(;!_(i=c.pop());)_(e[i])||(r+=i+":"+Ee(e[i])+",");ce.set(e,r)}}else r=s?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return r},Oe=e=>{if(P(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Ee(e):"",[e,t]};let Ct=0;const xe=()=>++Ct;async function He(...e){const[t,n,s,o]=e,a=W({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let r=a.populateCache;const i=a.rollbackOnError;let c=a.optimisticData;const g=v=>typeof i=="function"?i(v):i!==!1,d=a.throwOnError;if(P(n)){const v=n,l=[],h=t.keys();for(const p of h)!/^\$(inf|sub)\$/.test(p)&&v(t.get(p)._k)&&l.push(p);return Promise.all(l.map(u))}return u(n);async function u(v){const[l]=Oe(v);if(!l)return;const[h,p]=Ue(t,l),[I,f,L,q]=k.get(t),z=()=>{const C=I[l];return(P(a.revalidate)?a.revalidate(h().data,v):a.revalidate!==!1)&&(delete L[l],delete q[l],C&&C[0])?C[0](Me).then(()=>h().data):h().data};if(e.length<3)return z();let j=s,U,V=!1;const E=xe();f[l]=[E,0];const Y=!_(c),M=h(),Q=M.data,le=M._c,J=_(le)?Q:le;if(Y&&(c=P(c)?c(J,Q):c,p({data:c,_c:J})),P(j))try{j=j(J)}catch(C){U=C,V=!0}if(j&&qe(j))if(j=await j.catch(C=>{U=C,V=!0}),E!==f[l][0]){if(V)throw U;return j}else V&&Y&&g(U)&&(r=!0,p({data:J,_c:R}));if(r&&!V)if(P(r)){const C=r(j,J);p({data:C,error:R,_c:R})}else p({data:j,error:R,_c:R});if(f[l][1]=xe(),Promise.resolve(z()).then(()=>{p({_c:R})}),V){if(d)throw U;return}return j}}const ze=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Je=(e,t)=>{if(!k.has(e)){const n=W(xt,t),s=Object.create(null),o=He.bind(R,e);let a=H;const r=Object.create(null),i=(d,u)=>{const v=r[d]||[];return r[d]=v,v.push(u),()=>v.splice(v.indexOf(u),1)},c=(d,u,v)=>{e.set(d,u);const l=r[d];if(l)for(const h of l)h(u,v)},g=()=>{if(!k.has(e)&&(k.set(e,[s,Object.create(null),Object.create(null),Object.create(null),o,c,i]),!ne)){const d=n.initFocus(setTimeout.bind(R,ze.bind(R,s,Fe))),u=n.initReconnect(setTimeout.bind(R,ze.bind(R,s,Ve)));a=()=>{d&&d(),u&&u(),k.delete(e)}}};return g(),[e,o,g,a]}return[e,k.get(e)[4]]},Tt=(e,t,n,s,o)=>{const a=n.errorRetryCount,r=o.retryCount,i=~~((Math.random()+.5)*(1<<(r<8?r:8)))*n.errorRetryInterval;!_(a)&&r>a||setTimeout(s,i,o)},Dt=pe,[Re,It]=Je(new Map),Ge=W({onLoadingSlow:H,onSuccess:H,onError:H,onErrorRetry:Tt,onDiscarded:H,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:$e?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:$e?5e3:3e3,compare:Dt,isPaused:()=>!1,cache:Re,mutate:It,fallback:{}},Ot),Ke=(e,t)=>{const n=W(e,t);if(t){const{use:s,fallback:o}=e,{use:a,fallback:r}=t;s&&a&&(n.use=s.concat(a)),o&&r&&(n.fallback=W(o,r))}return n},ye=(0,w.createContext)({}),Lt=e=>{const{value:t}=e,n=(0,w.useContext)(ye),s=P(t),o=(0,w.useMemo)(()=>s?t(n):t,[s,n,t]),a=(0,w.useMemo)(()=>s?o:Ke(n,o),[s,n,o]),r=o&&o.provider,i=(0,w.useRef)(R);r&&!i.current&&(i.current=Je(r(a.cache||Re),o));const c=i.current;return c&&(a.cache=c[0],a.mutate=c[1]),ie(()=>{if(c)return c[2]&&c[2](),c[3]},[]),(0,w.createElement)(ye.Provider,W(e,{value:a}))},At="$inf$",Ye=te&&window.__SWR_DEVTOOLS_USE__,Nt=Ye?window.__SWR_DEVTOOLS_USE__:[],Pt=()=>{Ye&&(window.__SWR_DEVTOOLS_REACT__=w)},Qe=e=>P(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Ft=()=>{const e=(0,w.useContext)(ye);return(0,w.useMemo)(()=>W(Ge,e),[e])},un=(e,t)=>{const[n,s]=serialize(e),[,,,o]=SWRGlobalState.get(cache);if(o[n])return o[n];const a=t(s);return o[n]=a,a},Vt=e=>(t,n,s)=>e(t,n&&((...a)=>{const[r]=Oe(t),[,,,i]=k.get(Re);if(r.startsWith(At))return n(...a);const c=i[r];return _(c)?n(...a):(delete i[r],c)}),s),Mt=Nt.concat(Vt),kt=e=>function(...n){const s=Ft(),[o,a,r]=Qe(n),i=Ke(s,r);let c=e;const{use:g}=i,d=(g||[]).concat(Mt);for(let u=d.length;u--;)c=d[u](c);return c(o,a||i.fetcher||null,i)},Wt=(e,t,n)=>{const s=t[e]||(t[e]=[]);return s.push(n),()=>{const o=s.indexOf(n);o>=0&&(s[o]=s[s.length-1],s.pop())}},ln=(e,t)=>(...n)=>{const[s,o,a]=Qe(n),r=(a.use||[]).concat(t);return e(s,o,{...a,use:r})};Pt();const qt=void 0,je=null,Xe=e=>e===qt,Ut=e=>typeof e=="function",ue=new WeakMap,Bt=e=>je.prototype.toString.call(e),Ce=(e,t)=>e===`[object ${t}]`;let $t=0;const Te=e=>{const t=typeof e,n=Bt(e),s=Ce(n,"Date"),o=Ce(n,"RegExp"),a=Ce(n,"Object");let r,i;if(je(e)===e&&!s&&!o){if(r=ue.get(e),r)return r;if(r=++$t+"~",ue.set(e,r),Array.isArray(e)){for(r="@",i=0;i<e.length;i++)r+=Te(e[i])+",";ue.set(e,r)}if(a){r="#";const c=je.keys(e).sort();for(;!Xe(i=c.pop());)Xe(e[i])||(r+=i+":"+Te(e[i])+",");ue.set(e,r)}}else r=s?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return r},Ht=e=>{if(Ut(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Te(e):"",[e,t]},dn=e=>Ht(e)[0],De=w.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),Ie={dedupe:!0},Ze=Promise.resolve(R),zt=(e,t,n)=>{const{cache:s,compare:o,suspense:a,fallbackData:r,revalidateOnMount:i,revalidateIfStale:c,refreshInterval:g,refreshWhenHidden:d,refreshWhenOffline:u,keepPreviousData:v}=n,[l,h,p,I]=k.get(s),[f,L]=Oe(e),q=(0,w.useRef)(!1),z=(0,w.useRef)(!1),j=(0,w.useRef)(f),U=(0,w.useRef)(t),V=(0,w.useRef)(n),E=()=>V.current,Y=()=>E().isVisible()&&E().isOnline(),[M,Q,le,J]=Ue(s,f),C=(0,w.useRef)({}).current,re=_(r)?_(n.fallback)?R:n.fallback[f]:r,tt=(m,S)=>{for(const x in C){const b=x;if(b==="data"){if(!o(m[b],S[b])&&(!_(m[b])||!o(de,S[b])))return!1}else if(S[b]!==m[b])return!1}return!0},nt=(0,w.useMemo)(()=>{const m=!f||!t?!1:_(i)?E().isPaused()||a?!1:c!==!1:i,S=T=>{const B=W(T);return delete B._k,m?{isValidating:!0,isLoading:!0,...B}:B},x=M(),b=J(),F=S(x),ee=x===b?F:S(b);let y=F;return[()=>{const T=S(M());return tt(T,y)?(y.data=T.data,y.isLoading=T.isLoading,y.isValidating=T.isValidating,y.error=T.error,y):(y=T,T)},()=>ee]},[s,f]),X=(0,vt.useSyncExternalStore)((0,w.useCallback)(m=>le(f,(S,x)=>{tt(x,S)||m()}),[s,f]),nt[0],nt[1]),rt=!q.current,nn=l[f]&&l[f].length>0,Z=X.data,G=_(Z)?re&&qe(re)?De(re):re:Z,fe=X.error,Le=(0,w.useRef)(G),de=v?_(Z)?_(Le.current)?G:Le.current:Z:G,st=nn&&!_(fe)?!1:rt&&!_(i)?i:E().isPaused()?!1:a?_(G)?!1:c:_(G)||c,ot=!!(f&&t&&rt&&st),rn=_(X.isValidating)?ot:X.isValidating,sn=_(X.isLoading)?ot:X.isLoading,se=(0,w.useCallback)(async m=>{const S=U.current;if(!f||!S||z.current||E().isPaused())return!1;let x,b,F=!0;const ee=m||{},y=!p[f]||!ee.dedupe,T=()=>Be?!z.current&&f===j.current&&q.current:f===j.current,B={isValidating:!1,isLoading:!1},it=()=>{Q(B)},ct=()=>{const N=p[f];N&&N[1]===b&&delete p[f]},ut={isValidating:!0};_(M().data)&&(ut.isLoading=!0);try{if(y&&(Q(ut),n.loadingTimeout&&_(M().data)&&setTimeout(()=>{F&&T()&&E().onLoadingSlow(f,n)},n.loadingTimeout),p[f]=[S(L),xe()]),[x,b]=p[f],x=await x,y&&setTimeout(ct,n.dedupingInterval),!p[f]||p[f][1]!==b)return y&&T()&&E().onDiscarded(f),!1;B.error=R;const N=h[f];if(!_(N)&&(b<=N[0]||b<=N[1]||N[1]===0))return it(),y&&T()&&E().onDiscarded(f),!1;const $=M().data;B.data=o($,x)?$:x,y&&T()&&E().onSuccess(x,f,n)}catch(N){ct();const $=E(),{shouldRetryOnError:Ae}=$;$.isPaused()||(B.error=N,y&&T()&&($.onError(N,f,$),(Ae===!0||P(Ae)&&Ae(N))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||Y())&&$.onErrorRetry(N,f,$,on=>{const Ne=l[f];Ne&&Ne[0]&&Ne[0](ke,on)},{retryCount:(ee.retryCount||0)+1,dedupe:!0})))}return F=!1,it(),!0},[f,s]),at=(0,w.useCallback)((...m)=>He(s,j.current,...m),[]);if(ie(()=>{U.current=t,V.current=n,_(Z)||(Le.current=Z)}),ie(()=>{if(!f)return;const m=se.bind(R,Ie);let S=0;E().revalidateOnFocus&&(S=Date.now()+E().focusThrottleInterval);const b=Wt(f,l,(F,ee={})=>{if(F==Fe){const y=Date.now();E().revalidateOnFocus&&y>S&&Y()&&(S=y+E().focusThrottleInterval,m())}else if(F==Ve)E().revalidateOnReconnect&&Y()&&m();else{if(F==Me)return se();if(F==ke)return se(ee)}});return z.current=!1,j.current=f,q.current=!0,Q({_k:L}),st&&(p[f]||(_(G)||ne?m():Rt(m))),()=>{z.current=!0,b()}},[f]),ie(()=>{let m;function S(){const b=P(g)?g(M().data):g;b&&m!==-1&&(m=setTimeout(x,b))}function x(){!M().error&&(d||E().isVisible())&&(u||E().isOnline())?se(Ie).then(S):S()}return S(),()=>{m&&(clearTimeout(m),m=-1)}},[g,d,u,f]),(0,w.useDebugValue)(de),a){const m=f&&_(G);if(!Be&&ne&&m)throw new Error("Fallback data is required when using Suspense in SSR.");m&&(U.current=t,V.current=n,z.current=!1);const S=I[f],x=!_(S)&&m?at(S):Ze;if(De(x),!_(fe)&&m)throw fe;const b=m?se(Ie):Ze;!_(de)&&m&&(b.status="fulfilled",b.value=!0),De(b)}return{mutate:at,get data(){return C.data=!0,de},get error(){return C.error=!0,fe},get isValidating(){return C.isValidating=!0,rn},get isLoading(){return C.isLoading=!0,sn}}},pn=oe.defineProperty(Lt,"defaultValue",{value:Ge}),Jt=kt(zt);var Gt=window.wp.apiFetch,Kt=A.n(Gt),et=()=>{const e=r=>Kt()({path:r}).then(i=>i),t="/ajax-search-pro/options/search_instance/list",{data:n,isLoading:s,mutate:o,error:a}=Jt(t,e,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return a?{data:void 0,error:a,isLoading:s,mutate:o}:{data:n||[],error:void 0,isLoading:s,mutate:o}};const Yt={title:(0,D.__)("Ajax Search Pro","ajax-search-pro"),icon:(0,O.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"512",height:"512",viewBox:"0 0 512 512",children:(0,O.jsx)("path",{d:"M460.355 421.59l-106.51-106.512c20.04-27.553 31.884-61.437 31.884-98.037C385.73 124.935 310.792 50 218.685 50c-92.106 0-167.04 74.934-167.04 167.04 0 92.107 74.935 167.042 167.04 167.042 34.912 0 67.352-10.773 94.184-29.158L419.945 462l40.41-40.41zM100.63 217.04c0-65.095 52.96-118.055 118.056-118.055 65.098 0 118.057 52.96 118.057 118.056 0 65.097-52.96 118.057-118.057 118.057-65.096 0-118.055-52.96-118.055-118.056z"})}),category:"widgets",keywords:[(0,D.__)("search","ajax-search-pro"),(0,D.__)("ajax","ajax-search-pro")],attributes:{instance:{type:"number",default:1},scType:{type:"number",default:1}},edit:({attributes:e,setAttributes:t,isSelected:n,...s})=>{let{instance:o,scType:a}=e;a=Math.round(Math.max(1,Math.min(3,a)));const r=l=>{t({scType:parseInt(l)})},i=l=>{t({instance:parseInt(l)})},{data:c,error:g,isLoading:d}=et();if(d||c===void 0)return(0,D.__)("Loading search instances...","ajax-search-pro");const u=c.map(l=>parseInt(l.id));if(o=u.includes(o)?o:u[0],t({scType:a,instance:o}),!n&&a===1)return(0,O.jsx)(pt(),{block:"ajax-search-pro/block-asp-main",attributes:e});const v=[{label:"None",value:"0"}].concat(c.map(l=>({label:l.name,value:String(l.id)})));return(0,O.jsxs)("div",{className:s.className,children:[(0,O.jsx)(K.SelectControl,{label:(0,D.__)("Ajax Search Pro:","ajax-search-pro"),labelPosition:"side",value:a.toString(),options:[{value:"1",label:(0,D.__)("Search bar","ajax-search-pro")},{value:"2",label:(0,D.__)("Search settings","ajax-search-pro")},{value:"3",label:(0,D.__)("Search results","ajax-search-pro")}],onChange:r}),(0,O.jsx)(K.SelectControl,{label:(0,D.__)("Search ID:","ajax-search-pro"),labelPosition:"side",value:o.toString(),options:v,onChange:i})]})},save:({attributes:e})=>{const{instance:t,scType:n}=e;return(0,O.jsx)(ht,{instance:t,shortcodeType:n})}};(0,ft.registerBlockType)("ajax-search-pro/block-asp-main",Yt);var Qt=window.wp.hooks,Xt=window.wp.blockEditor;const Zt=["core/query","generateblocks/query","blocksy/query"],en=(0,O.jsxs)(O.Fragment,{children:[(0,D.__)("Selecting the search instance above will enable live search and filter for the query loop block for that search bar.","ajax-search-pro"),(0,O.jsx)(K.ExternalLink,{href:"https://documentation.ajaxsearchpro.com/behavior/results_page_live_loader",children:(0,D.__)("Learn more.","ajax-search-pro")})]});function tn(e){return t=>{const{name:n,attributes:s,setAttributes:o}=t;if(!Zt.includes(n))return(0,O.jsx)(e,{...t});const{asp_override_id:a,className:r}=s,{data:i,error:c,isLoading:g}=et();if(g||i===void 0)return(0,O.jsx)(O.Fragment,{children:(0,D.__)("Loading...","ajax-search-pro")});const d=[{label:"None",value:"0"}].concat(i.map(u=>({label:u.name,value:String(u.id)})));return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(e,{...t}),(0,O.jsx)(Xt.InspectorControls,{children:(0,O.jsx)(K.PanelBody,{title:(0,D.__)("Ajax Search Pro","ajax-search-pro"),children:(0,O.jsx)(K.PanelRow,{children:(0,O.jsx)(K.SelectControl,{label:(0,D.__)("Live search target","ajax-search-pro"),options:d,help:en,defaultValue:a,onChange:u=>{const v=(r||"").split(" ").filter(l=>!l.includes("asp_es_"));u!=="0"&&v.push("asp_es_"+u),o({asp_override_id:parseInt(u),className:v.join(" ")})}})})})})]})}}(0,Qt.addFilter)("editor.BlockEdit","ajax-search-pro/add-query-loop-controls",tn)})();
