(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=ampPlugins,n=window.lodash,a=window.wp.domReady;var s=e.n(a);const o=window.wp.i18n,i={init(){this.isAmpCompatibleTab()?this.removeAdditionalInfo():this.addAmpMessage(),this.addAmpMessageInSearchResult()},isAmpCompatibleTab:()=>new URLSearchParams(window.location.search.substr(1)).get("tab")===t.AMP_COMPATIBLE,addAmpMessageInSearchResult(){const e=document.getElementById("plugin-filter"),t=document.querySelector(".plugin-install-php .wp-filter-search");if(!e||!t)return;const a=(0,n.debounce)((()=>{t.removeEventListener("input",a,{once:!0});const n=document.querySelector(".plugin-install-tab-amp-compatible");n&&(n.classList.remove("plugin-install-tab-amp-compatible"),n.classList.add("plugin-install-tab-search-result")),new MutationObserver((()=>{this.addAmpMessage()})).observe(e,{childList:!0})}),1e3);t.addEventListener("input",a,{once:!0})},addAmpMessage(){for(const e of t.AMP_PLUGINS){const t=document.querySelector(`.plugin-card.plugin-card-${e}`);if(!t)continue;if(t.classList.contains("amp-extension-card-message"))continue;const n=document.createElement("div"),a=document.createElement("span"),s=document.createElement("span");n.classList.add("amp-extension-card-message"),a.classList.add("amp-logo-icon"),s.classList.add("tooltiptext"),s.append((0,o.__)("This is known to work well with the AMP plugin.","amp")),n.append(a),n.append(s),t.appendChild(n)}},removeAdditionalInfo(){const e=document.querySelectorAll(".plugin-install-tab-amp-compatible .plugin-card-bottom");for(const t of e)t.remove()}};s()((()=>{i.init()}))})();