(()=>{"use strict";const e=window.wp.i18n,t=e=>"#"===e[0]?document.getElementById(e.slice(1)):document.querySelectorAll(e);document.querySelector(".tablepress-all-tables").addEventListener("click",(t=>{if(t.target){if(t.target.matches(".shortcode a"))return prompt((0,e.__)("To embed this table into a post or page, use this Shortcode:","tablepress"),t.target.title),void t.preventDefault();if(t.target.matches(".table-preview a")){const e=window.innerWidth-120,a=window.innerHeight-120;return tb_show(t.target.title,`${t.target.href}#TB_iframe=true&height=${a}&width=${e}`,!1),void t.preventDefault()}}})),t("#tablepress-page").addEventListener("click",(e=>{if(e.target)return e.target.matches(".ajax-link")?(fetch(`${ajaxurl}?${e.target.href.split("?")[1]}`).then((e=>e.text())).then((t=>{"1"===t&&"hide_message"===e.target.dataset.action&&e.target.closest("div").remove()})),void e.preventDefault()):void 0}));const a=t("#doaction");a&&a.addEventListener("click",(a=>{const r=t("#bulk-action-selector-top").value,l=t(".tablepress-all-tables tbody input:checked").length;"-1"!==r&&0!==l&&("delete"!==r||confirm((0,e._n)("Do you really want to delete this table?","Do you really want to delete these tables?",l,"tablepress")))||a.preventDefault()}))})();