import{x as e,r as t,s as o,ad as r,a2 as n,bE as a,bu as l,bF as u,bG as s,bH as f,d as i,e as d}from"./index.286e9b79.js";var c=Object.defineProperty,m=Object.defineProperties,p=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,h=(e,t,o)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,y=(e,t)=>{for(var o in t||(t={}))b.call(t,o)&&h(e,o,t[o]);if(g)for(var o of g(t))w.call(t,o)&&h(e,o,t[o]);return e};function C(e){let t=`请使用 '@${e}' 事件，不要放在 props 中`;return t+=`\nPlease use '@${e}' event instead of props`,t}var v=(e,t)=>{for(const[o,r]of t)e[o]=r;return e};const E=e({props:{mode:{type:String,default:"default"},defaultContent:{type:Array,default:[]},defaultHtml:{type:String,default:""},defaultConfig:{type:Object,default:{}},modelValue:{type:String,default:""}},setup(e,a){const s=t(null),f=o(null),i=t("");return r((()=>{(()=>{if(!s.value)return;const t=l(e.defaultContent);var o,r;u({selector:s.value,mode:e.mode,content:t||[],html:e.defaultHtml||e.modelValue||"",config:(o=y({},e.defaultConfig),r={onCreated(t){if(f.value=t,a.emit("onCreated",t),e.defaultConfig.onCreated){const e=C("onCreated");throw new Error(e)}},onChange(t){const o=t.getHtml();if(i.value=o,a.emit("update:modelValue",o),a.emit("onChange",t),e.defaultConfig.onChange){const e=C("onChange");throw new Error(e)}},onDestroyed(t){if(a.emit("onDestroyed",t),e.defaultConfig.onDestroyed){const e=C("onDestroyed");throw new Error(e)}},onMaxLength(t){if(a.emit("onMaxLength",t),e.defaultConfig.onMaxLength){const e=C("onMaxLength");throw new Error(e)}},onFocus(t){if(a.emit("onFocus",t),e.defaultConfig.onFocus){const e=C("onFocus");throw new Error(e)}},onBlur(t){if(a.emit("onBlur",t),e.defaultConfig.onBlur){const e=C("onBlur");throw new Error(e)}},customAlert(t,o){if(a.emit("customAlert",t,o),e.defaultConfig.customAlert){const e=C("customAlert");throw new Error(e)}},customPaste:(t,o)=>{if(e.defaultConfig.customPaste){const e=C("customPaste");throw new Error(e)}let r;return a.emit("customPaste",t,o,(e=>{r=e})),r}},m(o,p(r)))})})()})),n((()=>e.modelValue),(e=>{e!==i.value&&function(e){const t=f.value;null!=t&&t.setHtml(e)}(e)})),{box:s}}}),O={ref:"box",style:{height:"100%"}};var j=v(E,[["render",function(e,t,o,r,n,a){return i(),d("div",O,null,512)}]]);const P=e({props:{editor:{type:Object},mode:{type:String,default:"default"},defaultConfig:{type:Object,default:{}}},setup(e){const o=t(null);return a((()=>{const{editor:t}=e;null!=t&&(t=>{if(o.value){if(null==t)throw new Error("Not found instance of Editor when create <Toolbar/> component");s.getToolbar(t)||f({editor:t,selector:o.value||"<div></div>",mode:e.mode,config:e.defaultConfig})}})(t)})),{selector:o}}}),x={ref:"selector"};var A=v(P,[["render",function(e,t,o,r,n,a){return i(),d("div",x,null,512)}]]);export{j as E,A as T};
