!function r(n,c,l){function i(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 i(n[t][1][e]||e)},o,o.exports,r,n,c,l)}return c[t].exports}for(var s="function"==typeof require&&require,e=0;e<l.length;e++)i(l[e]);return i}({1:[function(e,t,o){let r=wp.element.Fragment,n=wp.blockEditor.BlockControls,c=wp.components.Button;var l=wp.plugins.registerPlugin;let i=()=>{let{dispatch:t,select:e}=wp.data;var o=wp.blocks.createBlock,r=e("core/block-editor"),n=r.getSelectedBlockClientId();let 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)}}})}let l=o("core/shortcode",{text:""});n=r.getBlockInsertionPoint();t("core/block-editor").insertBlock(l,n.index,n.rootClientId),t("core/block-editor").selectBlock(l.clientId),setTimeout(()=>{window.SUG.App.insert("block",{props:{name:"core/shortcode",attributes:{text:""},setAttributes:e=>{t("core/block-editor").updateBlockAttributes(l.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:i,className:"su-insert-shortcode-button"});l("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:i},SUBlockEditorL10n.insertShortcode)}),"on"===SUBlockEditorSettings.showToolbarButton&&wp.domReady(()=>{let 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
