(function(c,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(c=typeof globalThis<"u"?globalThis:c||self,n(c.VueQuilly={},c.Vue))})(this,function(c,n){"use strict";const m=n.defineComponent({__name:"QuillyEditor",props:{modelValue:{},options:{},isSemanticHtmlModel:{type:Boolean}},emits:["update:modelValue","text-change","selection-change","editor-change","blur","focus","ready"],setup(p,{expose:h,emit:g}){const s=p,l=g;let o=null;const u=n.ref(),r=n.ref(),f=t=>{r.value=s.modelValue;const e=t.getContents(),i=t.clipboard.convert({html:s.modelValue??""});t.setContents(i),l("text-change",{delta:i,oldContent:e,source:"api"})},y=t=>{const e=new t(u.value,s.options);return s.modelValue&&f(e),e.on("selection-change",(i,a,d)=>{l(i?"focus":"blur",e),l("selection-change",{range:i,oldRange:a,source:d})}),e.on("text-change",(i,a,d)=>{r.value=s.isSemanticHtmlModel?e.getSemanticHTML():e.root.innerHTML,l("text-change",{delta:i,oldContent:a,source:d})}),e.on("editor-change",i=>{l("editor-change",i)}),l("ready",e),o=e,e};return n.watch(()=>s.modelValue,t=>{o&&(t&&t!==r.value?(f(o),r.value=s.isSemanticHtmlModel?o.getSemanticHTML():o.root.innerHTML):t||o.setContents([]))}),n.watch(r,(t,e)=>{o&&(t&&t!==e?l("update:modelValue",t):t||o.setContents([]))}),n.onBeforeUnmount(()=>{o=null}),h({initialize:y}),(t,e)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:u},null,512))}});c.QuillyEditor=m,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});