!function r(n,c,i){function l(t,e){if(!c[t]){if(!n[t]){var o="function"==typeof require&&require;if(!e&&o)return o(t,!0);if(s)return s(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}o=c[t]={exports:{}},n[t][0].call(o.exports,function(e){return l(n[t][1][e]||e)},o,o.exports,r,n,c,i)}return c[t].exports}for(var s="function"==typeof require&&require,e=0;e<i.length;e++)l(i[e]);return l}({1:[function(e,t,o){"use strict";const r=wp.element["Fragment"],n=wp.blockEditor["BlockControls"],c=wp.components["Button"];var i=wp.plugins["registerPlugin"];const l=()=>{const{dispatch:t,select:e}=wp.data;var o=wp.blocks["createBlock"],r=e("core/block-editor"),n=r.getSelectedBlockClientId();const c=n?r.getBlock(n):null;if(c){n=wp.blocks.getBlockType(c.name);if(n&&n.attributes&&(n.attributes.content||"core/shortcode"===c.name))return void window.SUG.App.insert("block",{props:{name:c.name,attributes:c.attributes,setAttributes:e=>{t("core/block-editor").updateBlockAttributes(c.clientId,e)}}})}const i=o("core/shortcode",{text:""});n=r.getBlockInsertionPoint();t("core/block-editor").insertBlock(i,n.index,n.rootClientId),t("core/block-editor").selectBlock(i.clientId),setTimeout(()=>{window.SUG.App.insert("block",{props:{name:"core/shortcode",attributes:{text:""},setAttributes:e=>{t("core/block-editor").updateBlockAttributes(i.clientId,e)}}})},100)},s=()=>React.createElement(c,{icon:React.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M10,3L3,3L3,21L10,21L10,17L7,17L7,7L10,7L10,3ZM14,3L21,3L21,21L14,21L14,17L17,17L17,7L14,7L14,3Z"})),label:SUBlockEditorL10n.insertShortcode,onClick:l,className:"su-insert-shortcode-button"});i("shortcodes-ultimate-toolbar",{render:()=>React.createElement(wp.editPost.PluginMoreMenuItem,{icon:React.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M10,3L3,3L3,21L10,21L10,17L7,17L7,7L10,7L10,3ZM14,3L21,3L21,21L14,21L14,17L17,17L17,7L14,7L14,3Z"})),onClick:l},SUBlockEditorL10n.insertShortcode)}),"on"===SUBlockEditorSettings.showToolbarButton&&wp.domReady(()=>{const e=()=>{var e,t=document.querySelector(".edit-post-header-toolbar, .editor-header__toolbar");t&&!document.querySelector(".su-insert-shortcode-button")&&((e=document.createElement("div")).style.display="inline-flex",e.style.alignItems="center",e.style.marginLeft="8px",t.appendChild(e),wp.element.render(wp.element.createElement(s),e))};e(),new MutationObserver(()=>{e()}).observe(document.body,{childList:!0,subtree:!0})}),"on"===SUBlockEditorSettings.showBlockControlsButton&&wp.hooks.addFilter("editor.BlockEdit","shortcodes-ultimate/with-insert-shortcode-button",t=>e=>-1===SUBlockEditorSettings.supportedBlocks.indexOf(e.name)?React.createElement(t,e):React.createElement(r,null,React.createElement(t,e),React.createElement(n,{controls:[{icon:React.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M10,3L3,3L3,21L10,21L10,17L7,17L7,7L10,7L10,3ZM14,3L21,3L21,21L14,21L14,17L17,17L17,7L14,7L14,3Z"})),title:SUBlockEditorL10n.insertShortcode,onClick:()=>{window.SUG.App.insert("block",{props:e})}}]})))},{}]},{},[1]);
//# sourceMappingURL=index.js.map
