import{r as e}from"./rolldown-runtime.WmLfqUcM.js";var t=e({plugin_exports:()=>n});(function(){var e=hugerte.util.Tools.resolve(`hugerte.PluginManager`);let t=e=>t=>typeof t===e,n=t(`boolean`),r=t(`number`),i=e=>t=>t.options.get(e),a=e=>{let t=e.options.register;t(`nonbreaking_force_tab`,{processor:e=>n(e)?{value:e?3:0,valid:!0}:r(e)?{value:e,valid:!0}:{valid:!1,message:`Must be a boolean or number.`},default:!1}),t(`nonbreaking_wrap`,{processor:`boolean`,default:!0})},o=i(`nonbreaking_force_tab`),s=i(`nonbreaking_wrap`),c=(e,t)=>{let n=``;for(let r=0;r<t;r++)n+=e;return n},l=e=>e.plugins.visualchars?e.plugins.visualchars.isEnabled():!1,u=(e,t)=>{let n=s(e)||e.plugins.visualchars?`<span class="${l(e)?`mce-nbsp-wrap mce-nbsp`:`mce-nbsp-wrap`}" contenteditable="false">${c(`&nbsp;`,t)}</span>`:c(`&nbsp;`,t);e.undoManager.transact(()=>e.insertContent(n))},d=e=>{e.addCommand(`mceNonBreaking`,()=>{u(e,1)})};var f=hugerte.util.Tools.resolve(`hugerte.util.VK`);let p=e=>{let t=o(e);t>0&&e.on(`keydown`,n=>{if(n.keyCode===f.TAB&&!n.isDefaultPrevented()){if(n.shiftKey)return;n.preventDefault(),n.stopImmediatePropagation(),u(e,t)}})},m=e=>t=>{let n=()=>{t.setEnabled(e.selection.isEditable())};return e.on(`NodeChange`,n),n(),()=>{e.off(`NodeChange`,n)}},h=e=>{let t=()=>e.execCommand(`mceNonBreaking`);e.ui.registry.addButton(`nonbreaking`,{icon:`non-breaking`,tooltip:`Nonbreaking space`,onAction:t,onSetup:m(e)}),e.ui.registry.addMenuItem(`nonbreaking`,{icon:`non-breaking`,text:`Nonbreaking space`,onAction:t,onSetup:m(e)})};e.add(`nonbreaking`,e=>{a(e),d(e),h(e),p(e)})})();var n={};export{t};