import{getContext as e,getElement as t,store as n,withSyncEvent as o}from"@wordpress/interactivity";const s=/^(?:s|es|ed|ing|er|ers|ion|ions|ation|ations|ment|ments|ity|ies|able)$/u,r=/^(?:ion|ions|ing|ed|es|er|ers|or|ors|ation|ations|ive|ity)$/u,a=["ations","ation","ments","ment","ions","ion","ing","ers","ed","er","es","y"],i=e=>e.normalize("NFKC").toLowerCase().replace(/\s+/gu," ").trim(),l=e=>e.normalize("NFKC").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim(),c=e=>e.length>4&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,u=e=>{const{stopWords:t,optionalWords:n,synonyms:o,platformWords:u}=e,h=e=>e.normalize("NFKC").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(e=>""!==e&&(e.length>1||/\d/u.test(e))&&!t.has(e)).map(c),p=(e,t,n)=>{let o=0;for(const s of h(t))e.set(s,(e.get(s)??0)+n),o+=n;for(const o of t.normalize("NFKC").toLowerCase().match(/[\p{L}\p{N}]+(?:[-.][\p{L}\p{N}]+)+/gu)??[]){const t=c(o.replace(/[-.]/gu,""));e.set(t,(e.get(t)??0)+n)}return o},d=e=>{const t=new Map;for(const n of e.families)for(const e of new Set(h(n.name)))t.set(e,(t.get(e)??0)+1);const n=(e,n)=>[...new Set(h(e))].filter(e=>(t.get(e)??0)>2===n),o=new Map(e.families.map(e=>[e.id,e.name])),s=e.families.map(e=>{const t=e.name.split("/").map(e=>n(e,!1)).filter(e=>e.length>0),s=n(e.name,!0).sort().join(" ");return{id:e.id,family:""===s?"":`${e.parent}:${s}`,names:t,parent:[...new Set(h(o.get(e.parent)??""))]}}),r=new Map;for(const e of s)r.set(e.family,(r.get(e.family)??0)+1);return s.filter(e=>""!==e.family&&e.names.length>0&&(r.get(e.family)??0)>=4)},m=(e,t,n=12)=>{let o=0,s=e.length;for(;o{if(Math.abs(e.length-t.length)>n)return n+1;let o=[],s=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){const a=[r];let i=r;for(let n=1;n<=t.length;n++){const l=e[r-1]===t[n-1]?0:1;let c=Math.min((s[n]??0)+1,(a[n-1]??0)+1,(s[n-1]??0)+l);r>1&&n>1&&e[r-1]===t[n-2]&&e[r-2]===t[n-1]&&(c=Math.min(c,(o[n-2]??0)+1)),a[n]=c,i=Math.min(i,c)}if(i>n)return n+1;o=s,s=a}return s[t.length]??n+1},f=(e,t)=>{if(t.length<5||/\d/u.test(t))return[];const n=t.length>=9?2:1,o=[];for(const s of e.vocabulary){if(s[0]!==t[0]||Math.abs(s.length-t.length)>n)continue;const e=g(t,s,n);e<=n&&o.push([s,e])}const s=Math.min(...o.map(([,e])=>e));return o.filter(([,e])=>e===s).map(([e])=>e)},w=(e,t)=>{const n=f(e,t);return n.length?n:f(e,`${t}s`)},y=(e,t)=>{const n=[[]];for(let s=1;s<=t.length;s++){n[s]=null;for(let r=Math.max(0,s-30);r<=s-2;r++){const a=n[r],i=c(t.slice(r,s)),l=a?.[a.length-1],u=e=>[e,...o[e]??[]],h=void 0===l||u(l).some(t=>u(i).some(n=>e.pairs.has(`${t} ${n}`)));a&&h&&a.length<3&&e.frequency.has(i)&&(!n[s]||a.length+1<(n[s]?.length??1/0))&&(n[s]=[...a,i])}}const s=n[t.length]??null;return s&&s.length>1?s:null},v=(e,t)=>{const n=e.frequency.get(t)??0;return Math.log(1+(e.docs.length-n+.5)/(n+.5))},k=(e,t)=>e.rerank?e.rerank.get(t)??(e.scores.has(t)?0:null):((e,t)=>{const n=e.get(t);if(!n)return null;const[o,s]=n;return null!==o&&null!==s?.85*o+(1-.85)*s:o??s})(e.scores,t),b=e=>new Map([...e].sort((e,t)=>t[1]-e[1]).map(([e],t)=>[e,t+1])),M=(e,t)=>{const n=e=>t.words.has(e)||e.length>=3&&t.tokens.some(t=>t.startsWith(e));return e.families.filter(e=>e.names.some(e=>e.every(n)||t.words.has(c(e.join("")))))},S=(e,t)=>Boolean(e)&&t.some(t=>t.names.some(t=>t.every(t=>e?.has(t)))),q=(e,t,n)=>(e.items.get(t)?.terms??[]).some(e=>n.some(t=>t.id===e))||S(e.titleWords.get(t),n)||S(e.chapterWords.get(t),n),x=(e,n)=>{const o=[],s=(e,t)=>{const n=o[o.length-1];n&&n.hit===t?n.text+=e:""!==e&&o.push({text:e,hit:t})};for(const o of e.split(/([\p{L}\p{N}]+)/u)){const e=o.normalize("NFKC").toLowerCase();s(o,/^[\p{L}\p{N}]+$/u.test(o)&&!t.has(e)&&(n.highlight.has(c(e))||""!==n.prefix&&e.startsWith(n.prefix)))}return o};return{buildIndex:e=>{const t=new Map(e.families.map(e=>[e.id,e.name])),n=new Map(e.items.map(e=>[e.id,e.title])),o=[];for(const n of e.items){const e=new Map,s=p(e,n.title,3)+p(e,n.terms.map(e=>t.get(e)??"").join(" "),2)+p(e,n.excerpt,1.5)+p(e,n.kind,1);o.push({id:n.id,root:n.id,chapter:!1,terms:e,length:s})}for(const t of e.chapters){if(!n.has(t.root))continue;const e=new Map,s=p(e,t.title,3)+p(e,n.get(t.root)??"",1);o.push({id:t.id,root:t.root,chapter:!0,terms:e,length:s})}const s=new Set;for(const t of[...e.items.flatMap(e=>[e.title,e.excerpt]),...e.chapters.map(e=>e.title),...e.families.map(e=>e.name)])h(t).forEach((e,t,n)=>{const o=n[t+1];void 0!==o&&s.add(`${e} ${o}`)});const r=new Map;for(const e of o)for(const t of e.terms.keys())r.set(t,(r.get(t)??0)+1);return{docs:o,frequency:r,averageLength:o.reduce((e,t)=>e+t.length,0)/Math.max(1,o.length),vocabulary:[...r.keys()].sort(),order:new Map(e.items.map((e,t)=>[e.id,t])),items:new Map(e.items.map(e=>[e.id,e])),titleWords:new Map(e.items.map(e=>[e.id,new Set(h(e.title))])),titles:[...e.items.map(e=>[e.title,e.id]),...e.chapters.filter(e=>l(e.title).includes(" ")).map(e=>[e.title,e.root])].reduce((e,[t,n])=>e.set(l(t),[...new Set([...e.get(l(t))??[],n])]),new Map),pairs:s,chapterIds:e.chapters.reduce((e,t)=>e.set(t.root,[...e.get(t.root)??[],t.id]),new Map),chapterWords:e.chapters.reduce((e,t)=>e.set(t.root,new Set([...e.get(t.root)??[],...h(t.title)])),new Map),families:d(e)}},rank:(e,t,p,d)=>{const g=((e,t)=>{const i=((e,t)=>{const n=[];for(let o=0;o((e,t)=>t.length<4||e.frequency.has(t)||m(e.vocabulary,t,1).length||w(e,t).length?[t]:y(e,t)??y(e,`${t}s`)??[t])(e,t))),l=!/[\s\p{P}]$/u.test(t),u=[],p=new Set,d=new Set,g=new Set;let f="";for(const e of h(t))n.has(e)||d.add(e);return i.forEach((t,c)=>{if(g.has(t))return;if(g.add(t),n.has(t))return void u.push({terms:new Map([[t,.2]]),weight:0,known:!0,optional:!0});const h=new Map([[t,1]]),y=c===i.length-1,k=e.frequency.has(t);p.add(t),d.add(t);for(const e of o[t]??[])h.set(e,1),p.add(e),d.add(e);if(e.frequency.has(`${t}s`)&&(h.set(`${t}s`,1),d.add(`${t}s`)),y&&l&&t.length>=2){const n=m(e.vocabulary,t);f=t;for(const e of n)h.has(e)||h.set(e,.7);!k&&t.length>=3&&1===n.length&&p.add(n[0]??t)}else if(t.length>=4){for(const n of m(e.vocabulary,t,40))!h.has(n)&&s.test(n.slice(t.length))&&(h.set(n,.5),d.add(n));if(t.endsWith("e")&&t.length>4){const n=t.slice(0,-1);for(const t of m(e.vocabulary,n,40))!h.has(t)&&r.test(t.slice(n.length))&&(h.set(t,.5),d.add(t))}for(const n of((e,t)=>{const n=new Set;for(const o of a){const s=t.endsWith(o)?t.slice(0,-o.length):"";for(const o of s.length>=3?[s,`${s}e`]:[])o!==t&&e.frequency.has(o)&&n.add(o)}return[...n]})(e,t))h.has(n)||(h.set(n,.5),d.add(n))}if(!k&&1===h.size)for(const n of w(e,t))h.set(n,.8),p.add(n),d.add(n);const b=[...h.keys()].filter(t=>e.frequency.has(t)),M=b.filter(e=>1===h.get(e)),S=k&&M.length?M:b,q=S.length?Math.max(...S.map(t=>v(e,t)*(h.get(t)??1))):v(e,t);u.push({terms:h,weight:q,known:b.length>0,optional:!1})}),{groups:u,words:p,tokens:i,highlight:d,prefix:f}})(e,t);if(""===i(t))return{hits:[],query:g,semantic:!1,close:!0};const f=new Map,x=new Set,I=new Map,$=new Map;for(const[t,{score:n,rare:o,groups:s}]of((e,t)=>{const n=new Map;return e.docs.forEach((o,s)=>{let r=0,a=!1;const i=new Set;t.groups.forEach((t,n)=>{for(const[s,l]of t.terms){const c=o.terms.get(s);if(!c)continue;const u=v(e,s),h=1.2*(.25+.75*o.length/e.averageLength);r+=l*u*c*2.2/(c+h),a||=!t.optional&&u>=1,i.add(n)}}),r>0&&n.set(s,{score:r,rare:a,groups:i})}),n})(e,g)){const r=e.docs[t];if(r&&(f.set(r.root,Math.max(f.get(r.root)??0,r.chapter?.7*n:n)),o&&x.add(r.root),$.set(r.root,new Set([...$.get(r.root)??[],...s])),r.chapter)){const e=I.get(r.root)??new Map;e.set(r.id,n),I.set(r.root,e)}}const L=new Map,T=new Map;if(p)for(const t of e.docs){const e=k(p,t.id);if(null===e)continue;const n=t.chapter?e-.02:e;if(L.set(t.root,Math.max(L.get(t.root)??-1,n)),t.chapter){const e=T.get(t.root)??new Map;e.set(t.id,n),T.set(t.root,e)}}const E=Math.max(-1,...L.values()),N=g.groups.every(e=>e.optional);if(N&&!(p?.rerank&&E>=.5)&&!e.titles.has(l(t)))return{hits:[],query:g,semantic:Boolean(p),close:!0};const C=g.groups.filter(e=>!e.known).length,P=g.groups.length>=3&&C/g.groups.length>=.66,W=g.groups.some(e=>e.weight>=1),_=g.groups.reduce((e,t)=>e+t.weight,0),A=p?.rerank?Math.max(.15,E-.4,E<.5?.5*E:0):Math.max(d,E-.08),U=new Map;for(const[e,t]of L)t>=A&&U.set(e,t);const j=Math.max(0,...f.values()),R=P||N?[]:[...f].filter(([e,t])=>t>=.35*j&&(e=>!W||x.has(e))(e)).map(([e])=>e),O=b(new Map(R.map(e=>[e,f.get(e)??0]))),B=b(U),K=M(e,g),Q=Boolean(p?.rerank)&&E>=.5,z=p?.rerank&&E<.5?.005:1,D=p?.rerank,F=new Set(K.flatMap(e=>e.names.flat())),H=g.groups.map((e,t)=>e.optional||[...e.terms.keys()].some(e=>F.has(e)||u.has(e))?-1:t).filter(e=>e>=0),J=new Set([...R.filter(t=>!p||U.has(t)||K.length>0&&q(e,t,K)&&(e=>!H.length||!Q||!L.has(e)||(L.get(e)??0)>=.15||H.some(t=>$.get(e)?.has(t)))(t)||(e=>_>0?[...$.get(e)??[]].reduce((e,t)=>e+(g.groups[t]?.weight??0),0)/_:1)(t)>=.5&&!(Q&&L.has(t))&&(t=>!D||!L.has(t)||D.has(t)||(e.chapterIds.get(t)??[]).some(e=>D.has(e)))(t)),...U.keys()]),V=new Map;for(const t of J){if(!e.order.has(t))continue;const n=O.get(t),o=p&&!L.has(t)?n:B.get(t),s=p?(n?.3/(60+n):0)+(o?z/(60+o):0):f.get(t)??0;s>0&&V.set(t,s)}const X=(e.titles.get(l(t))??[]).filter(t=>e.order.has(t)),G=((e,t,n)=>{const o=M(e,t);if(!o.length){const o=new Set(e.families.map(e=>e.id)),s=t=>!(e.items.get(t)?.terms??[]).some(e=>o.has(e))&&!S(e.titleWords.get(t),e.families),r=t.groups.filter(e=>!e.optional);if(r.length<=4&&r.some(e=>!e.known))return n.filter(s);const a=new Set(t.groups.flatMap(e=>[...e.terms.keys()]));return e.families.some(e=>e.parent.length>0&&e.parent.every(e=>a.has(e)))?[...n.filter(s),...n.filter(e=>!s(e))]:n}const s=new Set(o.map(e=>e.id)),r=new Set(o.map(e=>e.family)),a=e.families.filter(e=>r.has(e.family)&&!s.has(e.id)),i=new Set(a.map(e=>e.id)),l=(t,n)=>(e.items.get(t)?.terms??[]).some(e=>n.has(e)),c=t=>l(t,s)||q(e,t,o)&&!l(t,i);return[...n.filter(c),...n.filter(t=>!c(t)&&!(t=>l(t,i)||S(e.titleWords.get(t),a))(t))]})(e,g,[...V].sort((t,n)=>n[1]-t[1]||(e.order.get(t[0])??0)-(e.order.get(n[0])??0)).map(([e])=>e));return{hits:[...new Set([...X,...G])].slice(0,10).map(e=>{const t=I.get(e)??new Map,n=T.get(e)??new Map,o=Math.max(0,...t.values()),s=Math.max(-1,...n.values()),r=new Map;for(const[e,n]of t)n>=.6*o&&r.set(e,n/Math.max(o,1e-9));for(const[e,t]of n)t>=Math.max(A,s-.03)&&r.set(e,Math.max(r.get(e)??0,1+t));return{id:e,chapters:[...r].sort((e,t)=>t[1]-e[1]).slice(0,2).map(([e])=>e)}}),query:g,semantic:Boolean(p),close:!p?.rerank||E>=.5}},highlight:x,snippet:(e,t)=>{const n=x(e,t);let o=0;for(const e of n){if(e.hit)break;o+=e.text.length}if(o>=e.length||o<=72)return n;const s=e.lastIndexOf(" ",o-48);return x(`…${e.slice(s+1)}`,t)}}},h=e=>{if(!Array.isArray(e))return null;const t=e=>"number"==typeof e&&Number.isFinite(e)?e:null,n=[t(e[0]),t(e[1])];return null===n[0]&&null===n[1]?null:n},p=e=>{const t=e&&"object"==typeof e&&!0===Reflect.get(e,"reranked")?Reflect.get(e,"rerank"):null;if(!t||"object"!=typeof t)return null;const n=new Map;for(const[e,o]of Object.entries(t)){const t=Number(e);Number.isInteger(t)&&"number"==typeof o&&Number.isFinite(o)&&n.set(t,o)}return n.size?n:null},d=()=>(window.rtBlocksSearchShortcuts??={entries:[],bound:!1},window.rtBlocksSearchShortcuts),m=e=>{if(e.defaultPrevented)return;const t=e.composedPath()[0]??e.target??void 0,n=!("/"!==e.key||e.metaKey||e.ctrlKey||e.altKey||(e=>e instanceof HTMLElement&&(e.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(e.tagName)))(t));if(!n||d().entries.some(e=>e.isOpen()))return;const o=d().entries.find(e=>"page"===e.role);o&&(e.preventDefault(),o.open("shortcut"))},g=(e,...t)=>{let n=0;return e.replace(/%s/gu,e=>{const o=t[n++];return void 0===o?e:String(o)})},f=new Set(["wordpress","wp","migration","migrate","alternative","competitor","compare","comparison","move","moving","switch","replace","leaving","leave","cms"]);(s=>{const r=u(s.engine),a=(e=>{const t=new Map;let n=null,o=!1;const s=async(n,o,s)=>{window.setTimeout(()=>s.abort(),2e3);try{const r=new URL(n);r.searchParams.set("scope",e),r.searchParams.set("q",o),r.searchParams.set("rerank","1"),r.searchParams.set("top","40");const a=await fetch(r.toString(),{signal:s.signal,credentials:"omit",mode:"cors"}),i=a.ok?await a.json():null,l=(e=>{const t=e&&"object"==typeof e?Reflect.get(e,"scores"):null;if(!t||"object"!=typeof t)return null;const n=new Map;for(const[e,o]of Object.entries(t)){const t=h(o),s=Number(e);t&&Number.isInteger(s)&&n.set(s,t)}return n})(i);if(!l)return null;const c={scores:l,rerank:p(i)};return i&&"object"==typeof i&&!1===Reflect.get(i,"reranked")||((e,n)=>{if(t.size>=60){const e=t.keys().next().value;void 0!==e&&t.delete(e)}t.set(e,n)})(o,c),c}catch{return null}};return{cachedScores:e=>t.get(e)??null,fetchScores:(e,o,r=!0)=>{const a=t.get(o);if(a)return Promise.resolve(a);if(!r)return s(e,o,new AbortController);if(n?.query===o)return n.scores;n?.controller.abort();const i=new AbortController,l=s(e,o,i).finally(()=>{n?.controller===i&&(n=null)});return n={query:o,controller:i,scores:l},l},warmUp:e=>{if(o||!URL.canParse(e))return;o=!0;const t=document.createElement("link");t.rel="preconnect",t.href=new URL(e).origin,t.crossOrigin="anonymous",document.head.appendChild(t)}}})(s.scope),l=(f=s.eventPrefix,(e,t)=>{const n=(()=>{const e=Reflect.get(window,"gtm4wp_datalayer_name"),t="string"==typeof e&&""!==e?e:"dataLayer",n=Reflect.get(window,t);if(Array.isArray(n))return n;const o=[];return Reflect.set(window,t,o),o})();n.push({[f]:null}),n.push({event:`${f}_${e}`,[f]:t})}),c=`has-${s.cssPrefix}-open`;var f;let w=null,y=null,v=null,k=null,b=null,M=0,S=0,q=0,x=0,I=0,$=0,L="type",T="",E=null,N=!1,C=null,P=!1;const W=()=>{if(w)return w;const e=C??JSON.parse(JSON.stringify({items:ee.items,chapters:ee.chapters,families:ee.families}));return w={byId:new Map(e.items.map(e=>[e.id,e])),chapterById:new Map(e.chapters.map(e=>[e.id,e])),data:e},w},_=()=>(y??=r.buildIndex(W().data),y),A=e=>Array.isArray(e)?e:[],U=()=>{P||""===ee.catalogUrl||(P=!0,ee.catalogLoading=!0,fetch(ee.catalogUrl,{credentials:"omit",mode:"cors"}).then(e=>e.ok?e.json():null).then(e=>{const t=e&&"object"==typeof e?Reflect.get(e,"items"):null;Array.isArray(t)&&(C={items:t,chapters:A(Reflect.get(e,"chapters")),families:A(Reflect.get(e,"families"))},w=null,y=null,v=null)}).catch(()=>{}).finally(()=>{ee.catalogLoading=!1,ee.semanticTick+=1,z(0)}))},j=()=>k?.querySelector(`.${s.cssPrefix}__dialog`)??null,R=()=>k?.querySelector(`.${s.cssPrefix}__input`)??null,O=()=>k?.querySelector(`.${s.cssPrefix}__list`)??null,B=()=>"loading"===ee.semanticStatus,K=e=>ee.questions.map((t,n)=>({key:`q${n}`,domId:`${e}-q${n}`,kind:"suggestion",position:n,postId:0,url:"#",query:t,title:[{text:t,hit:!1}],snippet:[],badge:"",icon:s.suggestionIcon})),Q=()=>{const e=ee.query,t=[e,ee.semanticTick,ee.semanticQuery].join("");if(v&&v.key===t)return v;const n=O()?.id??s.cssPrefix,o=""===i(e)?{rows:K(n),count:0,close:!0}:((e,t)=>{const n=i(t),o=ee.semanticQuery===n?a.cachedScores(n)??(E?.query===n?E.similarity:null):null,l=r.rank(_(),t,o,ee.semanticFloor),c=l.query,{byId:u,chapterById:h}=W(),p=[];for(const t of l.hits){const n=u.get(t.id);if(n){p.push({key:`p${n.id}`,domId:`${e}-p${n.id}`,kind:"card",position:p.length,postId:n.id,url:n.url,query:"",title:r.highlight(n.title,c),snippet:r.snippet(n.excerpt,c),badge:s.cardBadge(n),icon:s.cardIcon(n)});for(const n of t.chapters){const t=h.get(n);t&&p.push({key:`p${t.id}`,domId:`${e}-p${t.id}`,kind:"chapter",position:p.length,postId:t.id,url:t.url,query:"",title:r.highlight(t.title,c),snippet:[],badge:"",icon:s.chapterIcon})}}}return{rows:p,count:l.hits.length,close:l.close}})(n,e);return v={key:t,...o},v},z=e=>{window.clearTimeout(S),S=window.setTimeout(()=>{if(!ee.hasQuery||B())return void(ee.announcement="");const e=Q().count;ee.announcement=0===e?ee.emptyTitle:g(1===e?ee.strings.countOne:ee.strings.countMany,e.toLocaleString())},e)},D=()=>{const e=i(ee.query);if(""===e||e===T)return;T=e;const t=Q().count;var n;l(0===t?"no_results":"query",{query_length:e.length,word_count:(n=e,""===n?0:n.split(" ").length),results:t,semantic:"ready"===ee.semanticStatus?"yes":"no"})},F=e=>""!==ee.similarityUrl&&e.length>=2,H=(e,t=!1)=>{const n=i(e);window.clearTimeout(M),window.clearTimeout(q),ee.query=e,ee.active=0,ee.semanticStatus=F(n)&&!a.cachedScores(n)?"loading":"idle",a.cachedScores(n)&&(ee.semanticQuery=n,ee.semanticStatus="ready"),O()?.scrollTo({top:0}),z(700),""!==n&&(M=window.setTimeout(()=>{(async()=>{const e=i(ee.query);if(!F(e))return ee.semanticStatus="idle",void z(700);const t=a.cachedScores(e)??await a.fetchScores(ee.similarityUrl,e);i(ee.query)===e&&(t?(E={query:e,similarity:t},ee.semanticQuery=e,ee.semanticTick+=1,ee.semanticStatus="ready"):ee.semanticStatus="unavailable",ee.active=0,z(0))})()},t?0:450),q=window.setTimeout(D,1500))},J=()=>{const e=ee.prompts[I]??"";let t=40;"type"===L?($+=1,$>=e.length&&(L="hold",t=2e3)):"hold"===L?(L="erase",t=25):"erase"===L?($-=1,t=25,$<=0&&(L="next",t=400)):(I=(I+1)%ee.prompts.length,$=0,L="type"),ee.prompt=(ee.prompts[I]??"").slice(0,$),x=window.setTimeout(J,t)},V=()=>ee.prompts.length>1&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches,X=()=>{window.clearTimeout(x),"global"!==s.role&&(!V()||ee.isOpen||document.hidden||(x=window.setTimeout(J,"hold"===L?2e3:40)))},G=e=>{document.documentElement.classList.toggle(c,e)},Y=(e,t,n)=>{if("suggestion"===e.kind)return l("suggestion",{position:e.position+1}),H(e.query,!0),void R()?.focus();l("result_click",{position:e.position+1,post_id:e.postId,kind:e.kind}),n&&(t?window.open(e.url,"_blank","noopener"):window.location.assign(e.url))},Z=e=>{const t=j();if(!t||t.open)return;const n=t.ownerDocument.activeElement;b=n instanceof HTMLElement&&n!==t.ownerDocument.body?n:k?.querySelector(`.${s.cssPrefix}__box`)??null,window.clearTimeout(x),ee.isOpen=!0,t.showModal(),G(!0);const o=R();o?.focus(),o?.select(),a.warmUp(ee.similarityUrl),U(),_(),N||""===ee.similarityUrl||(N=!0,ee.questions.map(i).filter(e=>e.length>=2).reduce((e,t)=>e.then(()=>a.fetchScores(ee.similarityUrl,t,!1)),Promise.resolve())),l("open",{trigger:e})},{state:ee}=n(s.namespace,{state:{get hasQuery(){return""!==i(ee.query)},get rows(){return ee.isOpen?Q().rows:[]},get hasRows(){return ee.rows.length>0},get sectionLabel(){return ee.hasQuery?Q().close?ee.strings.results:ee.strings.closest:ee.strings.suggestions},get activeId(){return Q().rows[ee.active]?.domId??null},get isActive(){return e().row.position===ee.active},get isChapter(){return"chapter"===e().row.kind},get isLoading(){return ee.hasQuery&&(B()||ee.catalogLoading)},get isEmpty(){return ee.hasQuery&&!B()&&!ee.catalogLoading&&0===Q().count},get emptyTitle(){return g(ee.strings.noneTitle,ee.query.trim())},get notice(){return ee.hasQuery&&"unavailable"===ee.semanticStatus&&Q().count>0?ee.strings.keywordNotice:""},get hasNotice(){return""!==ee.notice}},actions:{open(){Z("click")},close(){j()?.close()},closed(){j()?.open||(ee.isOpen=!1,G(!1),b?.focus({preventScroll:!0}),X())},backdrop(e){e.target===j()&&j()?.close()},input(e){e instanceof InputEvent&&e.isComposing||e.target instanceof HTMLInputElement&&H(e.target.value)},keydown:o(e=>{const t=Q().rows;if(e.isComposing||!t.length)return;if("ArrowDown"===e.key||"ArrowUp"===e.key)return e.preventDefault(),ee.active=(ee.active+("ArrowDown"===e.key?1:-1)+t.length)%t.length,void(()=>{const e=ee.activeId;e&&document.getElementById(e)?.scrollIntoView({block:"nearest"})})();const n=t[ee.active];"Enter"===e.key&&n&&(e.preventDefault(),Y(n,e.metaKey||e.ctrlKey,!0))}),hover(){const{row:t}=e();t.position!==ee.active&&(ee.active=t.position)},choose:o(t=>{const{row:n}=e();"suggestion"===n.kind&&t.preventDefault(),Y(n,!1,!1)}),warmUp(){a.warmUp(ee.similarityUrl),U()}},callbacks:{init(){var e;k=t().ref,"global"!==s.role&&(V()&&(L="type",$=0,ee.prompt=""),X(),document.addEventListener("visibilitychange",()=>document.hidden?window.clearTimeout(x):X())),(e=>{const t=d();t.entries.push(e),t.bound||(t.bound=!0,document.addEventListener("keydown",m))})({role:s.role,isOpen:()=>Boolean(j()?.open),open:Z}),e=()=>{_()},"function"==typeof window.requestIdleCallback?window.requestIdleCallback(e,{timeout:3e3}):window.setTimeout(e,500)}}})})({namespace:"rt-blocks/site-search",cssPrefix:"rt-resource-search",scope:"site",eventPrefix:"site_search",role:"global",engine:{stopWords:new Set(["a","about","all","also","am","an","and","any","are","as","at","be","been","but","by","can","could","did","do","does","explain","find","for","from","get","give","go","going","had","has","have","help","how","i","if","in","into","is","it","its","just","know","let","looking","me","more","my","need","of","on","or","our","please","right","should","show","so","some","tell","than","that","the","their","them","there","these","they","this","those","to","us","versus","vs","want","was","we","were","what","when","where","which","who","why","will","with","would","you","your"]),optionalWords:new Set(["actually","advice","anything","approach","basic","basics","beginner","best","better","care","chose","choose","choosing","con","cons","detail","everything","explained","explaining","explanation","good","great","hello","hey","hi","idea","info","information","keep","large","learn","learning","make","makes","making","maybe","off","one","overview","pls","pro","pros","question","quick","quickly","read","really","recommend","recommendation","run","share","simple","something","start","started","starting","suggestion","thank","thanks","thing","thx","tip","tips","top","understand","understanding","use","used","using","way","ways","worth","year","page","pages","post","posts","blog","article","articles","guide","guides","resource","resources","case","study","studies","rtcamp"]),synonyms:{wp:["wordpress"],adobe:["aem"],cq5:["aem"],episerver:["optimizely"],woo:["woocommerce"],ecommerce:["woocommerce"],a11y:["accessibility"],cwv:["vital"],media:["publishing"],ecom:["woocommerce"],staff:["augmentation"],qe:["quality"],qa:["quality"],vip:["wordpress"]},platformWords:f},cardIcon:e=>"handbook"===e.type?"book":"doc",cardBadge:e=>e.kind,chapterIcon:"section",suggestionIcon:"question"});