dootask/public/js/build/quill-hitosea.1704bc88.js
2024-04-17 23:59:29 +08:00

49 lines
121 KiB
JavaScript
Vendored

var ds=Object.defineProperty;var fs=(n,t,e)=>t in n?ds(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>(fs(n,typeof t!="symbol"?t+"":t,e),e);import{E as O,T as Pt,I as gs,S as x,B as Ie,A as ms,L as B,P as Lt,R as Be,a as ps,b as De,C as Me,c as Yt,d as j,e as at}from"./parchment.d5c5924e.js";import{D as b,a as D}from"./quill-delta.72524c38.js";import{i as Qt,c as rt,m as Y}from"./lodash-es.df04b444.js";class U extends O{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}U.blotName="break";U.tagName="BR";class M extends Pt{}function St(n){return n.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}const K=class extends gs{static compare(t,e){const s=K.order.indexOf(t),i=K.order.indexOf(e);return s>=0||i>=0?s-i:t===e?0:t<e?-1:1}formatAt(t,e,s,i){if(K.compare(this.statics.blotName,s)<0&&this.scroll.query(s,x.BLOT)){const r=this.isolate(t,e);i&&r.wrap(s,i)}else super.formatAt(t,e,s,i)}optimize(t){if(super.optimize(t),this.parent instanceof K&&K.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};let R=K;g(R,"allowedChildren",[K,U,O,M]),g(R,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);const he=1;class w extends Ie{constructor(){super(...arguments);g(this,"cache",{})}delta(){return this.cache.delta==null&&(this.cache.delta=Ue(this)),this.cache.delta}deleteAt(e,s){super.deleteAt(e,s),this.cache={}}formatAt(e,s,i,r){s<=0||(this.scroll.query(i,x.BLOCK)?e+s===this.length()&&this.format(i,r):super.formatAt(e,Math.min(s,this.length()-e-1),i,r),this.cache={})}insertAt(e,s,i){if(i!=null){super.insertAt(e,s,i),this.cache={};return}if(s.length===0)return;const r=s.split(`
`),l=r.shift();l.length>0&&(e<this.length()-1||this.children.tail==null?super.insertAt(Math.min(e,this.length()-1),l):this.children.tail.insertAt(this.children.tail.length(),l),this.cache={});let o=this;r.reduce((a,c)=>(o=o.split(a,!0),o.insertAt(0,c),c.length),e+l.length)}insertBefore(e,s){const{head:i}=this.children;super.insertBefore(e,s),i instanceof U&&i.remove(),this.cache={}}length(){return this.cache.length==null&&(this.cache.length=super.length()+he),this.cache.length}moveChildren(e,s){super.moveChildren(e,s),this.cache={}}optimize(e){super.optimize(e),this.cache={}}path(e){return super.path(e,!0)}removeChild(e){super.removeChild(e),this.cache={}}split(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(s&&(e===0||e>=this.length()-he)){const r=this.clone();return e===0?(this.parent.insertBefore(r,this),this):(this.parent.insertBefore(r,this.next),r)}const i=super.split(e,s);return this.cache={},i}}w.blotName="block";w.tagName="P";w.defaultChild=U;w.allowedChildren=[U,R,O,M];class C extends O{attach(){super.attach(),this.attributes=new ms(this.domNode)}delta(){return new b().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const s=this.scroll.query(t,x.BLOCK_ATTRIBUTE);s!=null&&this.attributes.attribute(s,e)}formatAt(t,e,s,i){this.format(s,i)}insertAt(t,e,s){if(s!=null){super.insertAt(t,e,s);return}const i=e.split(`
`),r=i.pop(),l=i.map(a=>{const c=this.scroll.create(w.blotName);return c.insertAt(0,a),c}),o=this.split(t);l.forEach(a=>{this.parent.insertBefore(a,o)}),r&&this.parent.insertBefore(this.scroll.create("text",r),o)}}C.scope=x.BLOCK_BLOT;function Ue(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return n.descendants(B).reduce((e,s)=>s.length()===0?e:e.insert(s.value(),S(s,{},t)),new b).insert(`
`,S(n))}function S(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return n==null||("formats"in n&&typeof n.formats=="function"&&(t={...t,...n.formats()},e&&delete t["code-token"]),n.parent==null||n.parent.statics.blotName==="scroll"||n.parent.statics.scope!==n.statics.scope)?t:S(n.parent,t,e)}const Z=class extends O{static value(){}constructor(t,e,s){super(t,e),this.selection=s,this.textNode=document.createTextNode(Z.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){this.parent!=null&&this.parent.removeChild(this)}format(t,e){if(this.savedLength!==0){super.format(t,e);return}let s=this,i=0;for(;s!=null&&s.statics.scope!==x.BLOCK_BLOT;)i+=s.offset(s.parent),s=s.parent;s!=null&&(this.savedLength=Z.CONTENTS.length,s.optimize(),s.formatAt(i,Z.CONTENTS.length,t,e),this.savedLength=0)}index(t,e){return t===this.textNode?0:super.index(t,e)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||this.parent==null)return null;const t=this.selection.getNativeRange();for(;this.domNode.lastChild!=null&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const e=this.prev instanceof M?this.prev:null,s=e?e.length():0,i=this.next instanceof M?this.next:null,r=i?i.text:"",{textNode:l}=this,o=l.data.split(Z.CONTENTS).join("");l.data=Z.CONTENTS;let a;if(e)a=e,(o||i)&&(e.insertAt(e.length(),o+r),i&&i.remove());else if(i)a=i,i.insertAt(0,o);else{const c=document.createTextNode(o);a=this.scroll.create(c),this.parent.insertBefore(a,this)}if(this.remove(),t){const c=(y,E)=>e&&y===e.domNode?E:y===l?s+E-1:i&&y===i.domNode?s+o.length+E:null,h=c(t.start.node,t.start.offset),d=c(t.end.node,t.end.offset);if(h!==null&&d!==null)return{startNode:a.domNode,startOffset:h,endNode:a.domNode,endOffset:d}}return null}update(t,e){if(t.some(s=>s.type==="characterData"&&s.target===this.textNode)){const s=this.restore();s&&(e.range=s)}}optimize(t){super.optimize(t);let{parent:e}=this;for(;e;){if(e.domNode.tagName==="A"){this.savedLength=Z.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}};let P=Z;g(P,"blotName","cursor"),g(P,"className","ql-cursor"),g(P,"tagName","span"),g(P,"CONTENTS","\uFEFF");var Fe={exports:{}};(function(n){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(a,c,h){this.fn=a,this.context=c,this.once=h||!1}function r(a,c,h,d,y){if(typeof h!="function")throw new TypeError("The listener must be a function");var E=new i(h,d||a,y),m=e?e+c:c;return a._events[m]?a._events[m].fn?a._events[m]=[a._events[m],E]:a._events[m].push(E):(a._events[m]=E,a._eventsCount++),a}function l(a,c){--a._eventsCount===0?a._events=new s:delete a._events[c]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],h,d;if(this._eventsCount===0)return c;for(d in h=this._events)t.call(h,d)&&c.push(e?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},o.prototype.listeners=function(c){var h=e?e+c:c,d=this._events[h];if(!d)return[];if(d.fn)return[d.fn];for(var y=0,E=d.length,m=new Array(E);y<E;y++)m[y]=d[y].fn;return m},o.prototype.listenerCount=function(c){var h=e?e+c:c,d=this._events[h];return d?d.fn?1:d.length:0},o.prototype.emit=function(c,h,d,y,E,m){var N=e?e+c:c;if(!this._events[N])return!1;var f=this._events[N],q=arguments.length,A,v;if(f.fn){switch(f.once&&this.removeListener(c,f.fn,void 0,!0),q){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,h),!0;case 3:return f.fn.call(f.context,h,d),!0;case 4:return f.fn.call(f.context,h,d,y),!0;case 5:return f.fn.call(f.context,h,d,y,E),!0;case 6:return f.fn.call(f.context,h,d,y,E,m),!0}for(v=1,A=new Array(q-1);v<q;v++)A[v-1]=arguments[v];f.fn.apply(f.context,A)}else{var hs=f.length,ct;for(v=0;v<hs;v++)switch(f[v].once&&this.removeListener(c,f[v].fn,void 0,!0),q){case 1:f[v].fn.call(f[v].context);break;case 2:f[v].fn.call(f[v].context,h);break;case 3:f[v].fn.call(f[v].context,h,d);break;case 4:f[v].fn.call(f[v].context,h,d,y);break;default:if(!A)for(ct=1,A=new Array(q-1);ct<q;ct++)A[ct-1]=arguments[ct];f[v].fn.apply(f[v].context,A)}}return!0},o.prototype.on=function(c,h,d){return r(this,c,h,d,!1)},o.prototype.once=function(c,h,d){return r(this,c,h,d,!0)},o.prototype.removeListener=function(c,h,d,y){var E=e?e+c:c;if(!this._events[E])return this;if(!h)return l(this,E),this;var m=this._events[E];if(m.fn)m.fn===h&&(!y||m.once)&&(!d||m.context===d)&&l(this,E);else{for(var N=0,f=[],q=m.length;N<q;N++)(m[N].fn!==h||y&&!m[N].once||d&&m[N].context!==d)&&f.push(m[N]);f.length?this._events[E]=f.length===1?f[0]:f:l(this,E)}return this},o.prototype.removeAllListeners=function(c){var h;return c?(h=e?e+c:c,this._events[h]&&l(this,h)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,n.exports=o})(Fe);var bs=Fe.exports,$t=new WeakMap;const Ht=["error","warn","log","info"];let _t="warn";function Pe(n){if(_t&&Ht.indexOf(n)<=Ht.indexOf(_t)){for(var t=arguments.length,e=new Array(t>1?t-1:0),s=1;s<t;s++)e[s-1]=arguments[s];console[n](...e)}}function V(n){return Ht.reduce((t,e)=>(t[e]=Pe.bind(console,e,n),t),{})}V.level=n=>{_t=n};Pe.level=V.level;const Rt=V("quill:events"),ys=["selectionchange","mousedown","mouseup","click"];ys.forEach(n=>{document.addEventListener(n,function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];Array.from(document.querySelectorAll(".ql-container")).forEach(i=>{const r=$t.get(i);r&&r.emitter&&r.emitter.handleDOM(...e)})})});class p extends bs{constructor(){super(),this.domListeners={},this.on("error",Rt.error)}emit(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return Rt.log.call(Rt,...e),super.emit(...e)}handleDOM(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i<e;i++)s[i-1]=arguments[i];(this.domListeners[t.type]||[]).forEach(r=>{let{node:l,handler:o}=r;(t.target===l||l.contains(t.target))&&o(t,...s)})}listenDOM(t,e,s){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:s})}}g(p,"events",{EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"}),g(p,"sources",{API:"api",SILENT:"silent",USER:"user"});const Ot=V("quill:selection");class Q{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=t,this.length=e}}class Es{constructor(t,e){this.emitter=e,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new Q(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{!this.mouseDown&&!this.composing&&setTimeout(this.update.bind(this,p.sources.USER),1)}),this.emitter.on(p.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const s=this.getNativeRange();s!=null&&s.start.node!==this.cursor.textNode&&this.emitter.once(p.events.SCROLL_UPDATE,(i,r)=>{try{this.root.contains(s.start.node)&&this.root.contains(s.end.node)&&this.setNativeRange(s.start.node,s.start.offset,s.end.node,s.end.offset);const l=r.some(o=>o.type==="characterData"||o.type==="childList"||o.type==="attributes"&&o.target===this.root);this.update(l?p.sources.SILENT:i)}catch{}})}),this.emitter.on(p.events.SCROLL_OPTIMIZE,(s,i)=>{if(i.range){const{startNode:r,startOffset:l,endNode:o,endOffset:a}=i.range;this.setNativeRange(r,l,o,a),this.update(p.sources.SILENT)}}),this.update(p.sources.SILENT)}handleComposition(){this.emitter.on(p.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(p.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const t=this.cursor.restore();if(!t)return;setTimeout(()=>{this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(p.sources.USER)})}focus(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const s=this.getNativeRange();if(!(s==null||!s.native.collapsed||this.scroll.query(t,x.BLOCK))){if(s.start.node!==this.cursor.textNode){const i=this.scroll.find(s.start.node,!1);if(i==null)return;if(i instanceof B){const r=i.split(s.start.offset);i.parent.insertBefore(this.cursor,r)}else i.insertBefore(this.cursor,s.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const s=this.scroll.length();t=Math.min(t,s-1),e=Math.min(t+e,s-1)-t;let i,[r,l]=this.scroll.leaf(t);if(r==null)return null;if(e>0&&l===r.length()){const[h]=this.scroll.leaf(t+1);if(h){const[d]=this.scroll.line(t),[y]=this.scroll.line(t+1);d===y&&(r=h,l=0)}}[i,l]=r.position(l,!0);const o=document.createRange();if(e>0)return o.setStart(i,l),[r,l]=this.scroll.leaf(t+e),r==null?null:([i,l]=r.position(l,!0),o.setEnd(i,l),o.getBoundingClientRect());let a="left",c;if(i instanceof Text){if(!i.data.length)return null;l<i.data.length?(o.setStart(i,l),o.setEnd(i,l+1)):(o.setStart(i,l-1),o.setEnd(i,l),a="right"),c=o.getBoundingClientRect()}else{if(!(r.domNode instanceof Element))return null;c=r.domNode.getBoundingClientRect(),l>0&&(a="right")}return{bottom:c.top+c.height,height:c.height,left:c[a],right:c[a],top:c.top,width:0}}getNativeRange(){const t=document.getSelection();if(t==null||t.rangeCount<=0)return null;const e=t.getRangeAt(0);if(e==null)return null;const s=this.normalizeNative(e);return Ot.info("getNativeRange",s),s}getRange(){const t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];const e=this.getNativeRange();return e==null?[null,null]:[this.normalizedToRange(e),e]}hasFocus(){return document.activeElement===this.root||document.activeElement!=null&&It(this.root,document.activeElement)}normalizedToRange(t){const e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);const s=e.map(l=>{const[o,a]=l,c=this.scroll.find(o,!0),h=c.offset(this.scroll);return a===0?h:c instanceof B?h+c.index(o,a):h+c.length()}),i=Math.min(Math.max(...s),this.scroll.length()-1),r=Math.min(i,...s);return new Q(r,i-r)}normalizeNative(t){if(!It(this.root,t.startContainer)||!t.collapsed&&!It(this.root,t.endContainer))return null;const e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(s=>{let{node:i,offset:r}=s;for(;!(i instanceof Text)&&i.childNodes.length>0;)if(i.childNodes.length>r)i=i.childNodes[r],r=0;else if(i.childNodes.length===r)i=i.lastChild,i instanceof Text?r=i.data.length:i.childNodes.length>0?r=i.childNodes.length:r=i.childNodes.length+1;else break;s.node=i,s.offset=r}),e}rangeToNative(t){const e=this.scroll.length(),s=(i,r)=>{i=Math.min(e-1,i);const[l,o]=this.scroll.leaf(i);return l?l.position(o,r):[null,-1]};return[...s(t.index,!1),...s(t.index+t.length,!0)]}setNativeRange(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:e,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(Ot.info("setNativeRange",t,e,s,i),t!=null&&(this.root.parentNode==null||t.parentNode==null||s.parentNode==null))return;const l=document.getSelection();if(l!=null)if(t!=null){this.hasFocus()||this.root.focus();const{native:o}=this.getNativeRange()||{};if(o==null||r||t!==o.startContainer||e!==o.startOffset||s!==o.endContainer||i!==o.endOffset){t instanceof Element&&t.tagName==="BR"&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),s instanceof Element&&s.tagName==="BR"&&(i=Array.from(s.parentNode.childNodes).indexOf(s),s=s.parentNode);const a=document.createRange();a.setStart(t,e),a.setEnd(s,i),l.removeAllRanges(),l.addRange(a)}}else l.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p.sources.API;if(typeof e=="string"&&(s=e,e=!1),Ot.info("setRange",t),t!=null){const i=this.rangeToNative(t);this.setNativeRange(...i,e)}else this.setNativeRange(null);this.update(s)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p.sources.USER;const e=this.lastRange,[s,i]=this.getRange();if(this.lastRange=s,this.lastNative=i,this.lastRange!=null&&(this.savedRange=this.lastRange),!Qt(e,this.lastRange)){if(!this.composing&&i!=null&&i.native.collapsed&&i.start.node!==this.cursor.textNode){const l=this.cursor.restore();l&&this.setNativeRange(l.startNode,l.startOffset,l.endNode,l.endOffset)}const r=[p.events.SELECTION_CHANGE,rt(this.lastRange),rt(e),t];this.emitter.emit(p.events.EDITOR_CHANGE,...r),t!==p.sources.SILENT&&this.emitter.emit(...r)}}}function It(n,t){try{t.parentNode}catch{return!1}return n.contains(t)}const xs=/^[ -~]*$/;class qs{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const s=de(t),i=new b;return vs(s.ops.slice()).reduce((l,o)=>{const a=D.exports.Op.length(o);let c=o.attributes||{},h=!1,d=!1;if(o.insert!=null){if(i.retain(a),typeof o.insert=="string"){const m=o.insert;d=!m.endsWith(`
`)&&(e<=l||!!this.scroll.descendant(C,l)[0]),this.scroll.insertAt(l,m);const[N,f]=this.scroll.line(l);let q=Y({},S(N));if(N instanceof w){const[A]=N.descendant(B,f);A&&(q=Y(q,S(A)))}c=D.exports.AttributeMap.diff(q,c)||{}}else if(typeof o.insert=="object"){const m=Object.keys(o.insert)[0];if(m==null)return l;const N=this.scroll.query(m,x.INLINE)!=null;if(N)(e<=l||!!this.scroll.descendant(C,l)[0])&&(d=!0);else if(l>0){const[f,q]=this.scroll.descendant(B,l-1);f instanceof M?f.value()[q]!==`
`&&(h=!0):f instanceof O&&f.statics.scope===x.INLINE_BLOT&&(h=!0)}if(this.scroll.insertAt(l,m,o.insert[m]),N){const[f]=this.scroll.descendant(B,l);if(f){const q=Y({},S(f));c=D.exports.AttributeMap.diff(q,c)||{}}}}e+=a}else if(i.push(o),o.retain!==null&&typeof o.retain=="object"){const m=Object.keys(o.retain)[0];if(m==null)return l;this.scroll.updateEmbedAt(l,m,o.retain[m])}Object.keys(c).forEach(m=>{this.scroll.formatAt(l,a,m,c[m])});const y=h?1:0,E=d?1:0;return e+=y+E,i.retain(y),i.delete(E),l+a+y+E},0),i.reduce((l,o)=>typeof o.delete=="number"?(this.scroll.deleteAt(l,o.delete),l):l+D.exports.Op.length(o),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(s)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update(new b().retain(t).delete(e))}formatLine(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.scroll.update(),Object.keys(s).forEach(r=>{this.scroll.lines(t,Math.max(e,1)).forEach(l=>{l.format(r,s[r])})}),this.scroll.optimize();const i=new b().retain(t).retain(e,rt(s));return this.update(i)}formatText(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(s).forEach(r=>{this.scroll.formatAt(t,e,r,s[r])});const i=new b().retain(t).retain(e,rt(s));return this.update(i)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new b)}getFormat(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=[],i=[];e===0?this.scroll.path(t).forEach(o=>{const[a]=o;a instanceof w?s.push(a):a instanceof B&&i.push(a)}):(s=this.scroll.lines(t,e),i=this.scroll.descendants(B,t,e));const[r,l]=[s,i].map(o=>{const a=o.shift();if(a==null)return{};let c=S(a);for(;Object.keys(c).length>0;){const h=o.shift();if(h==null)return c;c=Ns(S(h),c)}return c});return{...r,...l}}getHTML(t,e){const[s,i]=this.scroll.line(t);if(s){const r=s.length();return s.length()>=i+e&&!(i===0&&e===r)?ft(s,i,e,!0):ft(this.scroll,t,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(s=>typeof s.insert=="string").map(s=>s.insert).join("")}insertContents(t,e){const s=de(e),i=new b().retain(t).concat(s);return this.scroll.insertContents(t,s),this.update(i)}insertEmbed(t,e,s){return this.scroll.insertAt(t,e,s),this.update(new b().retain(t).insert({[e]:s}))}insertText(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return e=e.replace(/\r\n/g,`
`).replace(/\r/g,`
`),this.scroll.insertAt(t,e),Object.keys(s).forEach(i=>{this.scroll.formatAt(t,e.length,i,s[i])}),this.update(new b().retain(t).insert(e,rt(s)))}isBlank(){if(this.scroll.children.length===0)return!0;if(this.scroll.children.length>1)return!1;const t=this.scroll.children.head;if((t==null?void 0:t.statics.blotName)!==w.blotName)return!1;const e=t;return e.children.length>1?!1:e.children.head instanceof U}removeFormat(t,e){const s=this.getText(t,e),[i,r]=this.scroll.line(t+e);let l=0,o=new b;i!=null&&(l=i.length()-r,o=i.delta().slice(r,r+l-1).insert(`
`));const c=this.getContents(t,e+l).diff(new b().insert(s).concat(o)),h=new b().retain(t).concat(c);return this.applyDelta(h)}update(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;const i=this.delta;if(e.length===1&&e[0].type==="characterData"&&e[0].target.data.match(xs)&&this.scroll.find(e[0].target)){const r=this.scroll.find(e[0].target),l=S(r),o=r.offset(this.scroll),a=e[0].oldValue.replace(P.CONTENTS,""),c=new b().insert(a),h=new b().insert(r.value()),d=s&&{oldRange:fe(s.oldRange,-o),newRange:fe(s.newRange,-o)};t=new b().retain(o).concat(c.diff(h,d)).reduce((E,m)=>m.insert?E.insert(m.insert,l):E.push(m),new b),this.delta=i.compose(t)}else this.delta=this.getDelta(),(!t||!Qt(i.compose(t),this.delta))&&(t=i.diff(this.delta,s));return t}}function st(n,t,e){if(n.length===0){const[E]=Bt(e.pop());return t<=0?`</li></${E}>`:`</li></${E}>${st([],t-1,e)}`}const[{child:s,offset:i,length:r,indent:l,type:o},...a]=n,[c,h]=Bt(o);if(l>t)return e.push(o),l===t+1?`<${c}><li${h}>${ft(s,i,r)}${st(a,l,e)}`:`<${c}><li>${st(n,t+1,e)}`;const d=e[e.length-1];if(l===t&&o===d)return`</li><li${h}>${ft(s,i,r)}${st(a,l,e)}`;const[y]=Bt(e.pop());return`</li></${y}>${st(n,t-1,e)}`}function ft(n,t,e){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if("html"in n&&typeof n.html=="function")return n.html(t,e);if(n instanceof M)return St(n.value().slice(t,t+e));if(n instanceof Lt){if(n.statics.blotName==="list-container"){const c=[];return n.children.forEachAt(t,e,(h,d,y)=>{const E="formats"in h&&typeof h.formats=="function"?h.formats():{};c.push({child:h,offset:d,length:y,indent:E.indent||0,type:E.list})}),st(c,-1,[])}const i=[];if(n.children.forEachAt(t,e,(c,h,d)=>{i.push(ft(c,h,d))}),s||n.statics.blotName==="list")return i.join("");const{outerHTML:r,innerHTML:l}=n.domNode,[o,a]=r.split(`>${l}<`);return o==="<table"?`<table style="border: 1px solid #000;">${i.join("")}<${a}`:`${o}>${i.join("")}<${a}`}return n.domNode instanceof Element?n.domNode.outerHTML:""}function Ns(n,t){return Object.keys(t).reduce((e,s)=>{if(n[s]==null)return e;const i=t[s];return i===n[s]?e[s]=i:Array.isArray(i)?i.indexOf(n[s])<0?e[s]=i.concat([n[s]]):e[s]=i:e[s]=[i,n[s]],e},{})}function Bt(n){const t=n==="ordered"?"ol":"ul";switch(n){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function de(n){return n.reduce((t,e)=>{if(typeof e.insert=="string"){const s=e.insert.replace(/\r\n/g,`
`).replace(/\r/g,`
`);return t.insert(s,e.attributes)}return t.push(e)},new b)}function fe(n,t){let{index:e,length:s}=n;return new Q(e+t,s)}function vs(n){const t=[];return n.forEach(e=>{typeof e.insert=="string"?e.insert.split(`
`).forEach((i,r)=>{r&&t.push({insert:`
`,attributes:e.attributes}),i&&t.push({insert:i,attributes:e.attributes})}):t.push(e)}),t}class F{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=t,this.options=e}}g(F,"DEFAULTS",{});const xt="\uFEFF";class Jt extends O{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(s=>{this.contentNode.appendChild(s)}),this.leftGuard=document.createTextNode(xt),this.rightGuard=document.createTextNode(xt),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(t,e){return t===this.leftGuard?0:t===this.rightGuard?1:super.index(t,e)}restore(t){let e=null,s;const i=t.data.split(xt).join("");if(t===this.leftGuard)if(this.prev instanceof M){const r=this.prev.length();this.prev.insertAt(r,i),e={startNode:this.prev.domNode,startOffset:r+i.length}}else s=document.createTextNode(i),this.parent.insertBefore(this.scroll.create(s),this),e={startNode:s,startOffset:i.length};else t===this.rightGuard&&(this.next instanceof M?(this.next.insertAt(0,i),e={startNode:this.next.domNode,startOffset:i.length}):(s=document.createTextNode(i),this.parent.insertBefore(this.scroll.create(s),this.next),e={startNode:s,startOffset:i.length}));return t.data=xt,e}update(t,e){t.forEach(s=>{if(s.type==="characterData"&&(s.target===this.leftGuard||s.target===this.rightGuard)){const i=this.restore(s.target);i&&(e.range=i)}})}}class ws{constructor(t,e){g(this,"isComposing",!1);this.scroll=t,this.emitter=e,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",t=>{this.isComposing||this.handleCompositionStart(t)}),this.scroll.domNode.addEventListener("compositionend",t=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(t)})})}handleCompositionStart(t){const e=t.target instanceof Node?this.scroll.find(t.target,!0):null;e&&!(e instanceof Jt)&&(this.emitter.emit(p.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(p.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(p.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(p.events.COMPOSITION_END,t),this.isComposing=!1}}const ce=class{constructor(t,e){g(this,"modules",{});this.quill=t,this.options=e}init(){Object.keys(this.options.modules).forEach(t=>{this.modules[t]==null&&this.addModule(t)})}addModule(t){const e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}};let G=ce;g(G,"DEFAULTS",{modules:{}}),g(G,"themes",{default:ce});const ks=n=>n.parentElement||n.getRootNode().host||null,As=n=>{const t=n.getBoundingClientRect(),e="offsetWidth"in n&&Math.abs(t.width)/n.offsetWidth||1,s="offsetHeight"in n&&Math.abs(t.height)/n.offsetHeight||1;return{top:t.top,right:t.left+n.clientWidth*e,bottom:t.top+n.clientHeight*s,left:t.left}},qt=n=>{const t=parseInt(n,10);return Number.isNaN(t)?0:t},ge=(n,t,e,s,i,r)=>n<e&&t>s?0:n<e?-(e-n+i):t>s?t-n>s-e?n+i-e:t-s+r:0,Ls=(n,t)=>{var r,l,o,a,c;const e=n.ownerDocument;let s=t,i=n;for(;i;){const h=i===e.body,d=h?{top:0,right:(l=(r=window.visualViewport)==null?void 0:r.width)!=null?l:e.documentElement.clientWidth,bottom:(a=(o=window.visualViewport)==null?void 0:o.height)!=null?a:e.documentElement.clientHeight,left:0}:As(i),y=getComputedStyle(i),E=ge(s.left,s.right,d.left,d.right,qt(y.scrollPaddingLeft),qt(y.scrollPaddingRight)),m=ge(s.top,s.bottom,d.top,d.bottom,qt(y.scrollPaddingTop),qt(y.scrollPaddingBottom));if(E||m)if(h)(c=e.defaultView)==null||c.scrollBy(E,m);else{const{scrollLeft:N,scrollTop:f}=i;m&&(i.scrollTop+=m),E&&(i.scrollLeft+=E);const q=i.scrollLeft-N,A=i.scrollTop-f;s={left:s.left-q,top:s.top-A,right:s.right-q,bottom:s.bottom-A}}i=h||y.position==="fixed"?null:ks(i)}},Ss=100,Ts=["block","break","cursor","inline","scroll","text"],Cs=(n,t,e)=>{const s=new Be;return Ts.forEach(i=>{const r=t.query(i);r&&s.register(r)}),n.forEach(i=>{var o;let r=t.query(i);r||e.error(`Cannot register "${i}" specified in "formats" config. Are you sure it was registered?`);let l=0;for(;r;)if(s.register(r),r="blotName"in r&&(o=r.requiredContainer)!=null?o:null,l+=1,l>Ss){e.error(`Cycle detected in registering blot requiredContainer: "${i}"`);break}}),s},lt=V("quill"),Nt=new Be;Lt.uiClass="ql-ui";const nt=class{static debug(t){t===!0&&(t="log"),V.level(t)}static find(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return $t.get(t)||Nt.find(t,e)}static import(t){return this.imports[t]==null&&lt.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof t!="string"){const i="attrName"in t?t.attrName:t.blotName;typeof i=="string"?this.register(`formats/${i}`,t,e):Object.keys(t).forEach(r=>{this.register(r,t[r],e)})}else this.imports[t]!=null&&!s&&lt.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&typeof e!="boolean"&&e.blotName!=="abstract"&&Nt.register(e),typeof e.register=="function"&&e.register(Nt)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=Rs(t,e),this.container=this.options.container,this.container==null){lt.error("Invalid Quill container",t);return}this.options.debug&&nt.debug(this.options.debug);const s=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",$t.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new p;const i=De.blotName,r=this.options.registry.query(i);if(!r||!("blotName"in r))throw new Error(`Cannot initialize Quill without "${i}" blot`);if(this.scroll=new r(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new qs(this.scroll),this.selection=new Es(this.scroll,this.emitter),this.composition=new ws(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(p.events.EDITOR_CHANGE,l=>{l===p.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(p.events.SCROLL_UPDATE,(l,o)=>{const a=this.selection.lastRange,[c]=this.selection.getRange(),h=a&&c?{oldRange:a,newRange:c}:void 0;I.call(this,()=>this.editor.update(null,o,h),l)}),this.emitter.on(p.events.SCROLL_EMBED_UPDATE,(l,o)=>{const a=this.selection.lastRange,[c]=this.selection.getRange(),h=a&&c?{oldRange:a,newRange:c}:void 0;I.call(this,()=>{const d=new b().retain(l.offset(this)).retain({[l.statics.blotName]:o});return this.editor.update(d,[],h)},nt.sources.USER)}),s){const l=this.clipboard.convert({html:`${s}<p><br></p>`,text:`
`});this.setContents(l)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof t=="string"){const s=t;t=document.createElement("div"),t.classList.add(s)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,s){return[t,e,,s]=H(t,e,s),I.call(this,()=>this.editor.deleteText(t,e),s,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;const e=t();return this.allowReadOnlyEdits=!1,e}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}focus(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.selection.focus(),t.preventScroll||this.scrollSelectionIntoView()}format(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p.sources.API;return I.call(this,()=>{const i=this.getSelection(!0);let r=new b;if(i==null)return r;if(this.scroll.query(t,x.BLOCK))r=this.editor.formatLine(i.index,i.length,{[t]:e});else{if(i.length===0)return this.selection.format(t,e),r;r=this.editor.formatText(i.index,i.length,{[t]:e})}return this.setSelection(i,p.sources.SILENT),r},s)}formatLine(t,e,s,i,r){let l;return[t,e,l,r]=H(t,e,s,i,r),I.call(this,()=>this.editor.formatLine(t,e,l),r,t,0)}formatText(t,e,s,i,r){let l;return[t,e,l,r]=H(t,e,s,i,r),I.call(this,()=>this.editor.formatText(t,e,l),r,t,0)}getBounds(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=null;if(typeof t=="number"?s=this.selection.getBounds(t,e):s=this.selection.getBounds(t.index,t.length),!s)return null;const i=this.container.getBoundingClientRect();return{bottom:s.bottom-i.top,height:s.height,left:s.left-i.left,right:s.right-i.left,top:s.top-i.top,width:s.width}}getContents(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-t;return[t,e]=H(t,e),this.editor.getContents(t,e)}getFormat(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof t=="number"?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}getIndex(t){return t.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(t){return this.scroll.leaf(t)}getLine(t){return this.scroll.line(t)}getLines(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof t!="number"?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}getModule(t){return this.theme.modules[t]}getSelection(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1)&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return typeof t=="number"&&(e=e!=null?e:this.getLength()-t),[t,e]=H(t,e),this.editor.getHTML(t,e)}getText(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return typeof t=="number"&&(e=e!=null?e:this.getLength()-t),[t,e]=H(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:nt.sources.API;return I.call(this,()=>this.editor.insertEmbed(t,e,s),i,t)}insertText(t,e,s,i,r){let l;return[t,,l,r]=H(t,0,s,i,r),I.call(this,()=>this.editor.insertText(t,e,l),r,t,e.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(t,e,s){return[t,e,,s]=H(t,e,s),I.call(this,()=>this.editor.removeFormat(t,e),s,t)}scrollRectIntoView(t){Ls(this.root,t)}scrollIntoView(){console.warn("Quill#scrollIntoView() has been deprecated and will be removed in the near future. Please use Quill#scrollSelectionIntoView() instead."),this.scrollSelectionIntoView()}scrollSelectionIntoView(){const t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.sources.API;return I.call(this,()=>{t=new b(t);const s=this.getLength(),i=this.editor.deleteText(0,s),r=this.editor.insertContents(0,t),l=this.editor.deleteText(this.getLength()-1,1);return i.compose(r).compose(l)},e)}setSelection(t,e,s){t==null?this.selection.setRange(null,e||nt.sources.API):([t,e,,s]=H(t,e,s),this.selection.setRange(new Q(Math.max(0,t),e),s),s!==p.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.sources.API;const s=new b().insert(t);return this.setContents(s,e)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p.sources.USER;const e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.sources.API;return I.call(this,()=>(t=new b(t),this.editor.applyDelta(t)),e,!0)}};let u=nt;g(u,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Nt,theme:"default"}),g(u,"events",p.events),g(u,"sources",p.sources),g(u,"version","2.0.0-rc.5.1"),g(u,"imports",{delta:b,parchment:ps,"core/module":F,"core/theme":G});function me(n){return typeof n=="string"?document.querySelector(n):n}function Dt(n){return Object.entries(n!=null?n:{}).reduce((t,e)=>{let[s,i]=e;return{...t,[s]:i===!0?{}:i}},{})}function pe(n){return Object.fromEntries(Object.entries(n).filter(t=>t[1]!==void 0))}function Rs(n,t){const e=me(n);if(!e)throw new Error("Invalid Quill container");const i=!t.theme||t.theme===u.DEFAULTS.theme?G:u.import(`themes/${t.theme}`);if(!i)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:r,...l}=u.DEFAULTS,{modules:o,...a}=i.DEFAULTS,c=Y({},Dt(r),Dt(o),Dt(t.modules));c!=null&&c.toolbar&&c.toolbar.constructor!==Object&&(c.toolbar={container:c.toolbar});const h={...l,...pe(a),...pe(t)};let d=t.registry;return d?t.formats&&lt.warn('Ignoring "formats" option because "registry" is specified'):d=t.formats?Cs(t.formats,h.registry,lt):h.registry,{...h,registry:d,container:e,theme:i,modules:Object.entries(c).reduce((y,E)=>{let[m,N]=E;if(!N)return y;const f=u.import(`modules/${m}`);return f==null?(lt.error(`Cannot load ${m} module. Are you sure you registered it?`),y):{...y,[m]:Y({},f.DEFAULTS||{},N)}},{}),bounds:me(h.bounds)}}function I(n,t,e,s){if(!this.isEnabled()&&t===p.sources.USER&&!this.allowReadOnlyEdits)return new b;let i=e==null?null:this.getSelection();const r=this.editor.delta,l=n();if(i!=null&&(e===!0&&(e=i.index),s==null?i=be(i,l,t):s!==0&&(i=be(i,e,s,t)),this.setSelection(i,p.sources.SILENT)),l.length()>0){const o=[p.events.TEXT_CHANGE,l,r,t];this.emitter.emit(p.events.EDITOR_CHANGE,...o),t!==p.sources.SILENT&&this.emitter.emit(...o)}return l}function H(n,t,e,s,i){let r={};return typeof n.index=="number"&&typeof n.length=="number"?typeof t!="number"?(i=s,s=e,e=t,t=n.length,n=n.index):(t=n.length,n=n.index):typeof t!="number"&&(i=s,s=e,e=t,t=0),typeof e=="object"?(r=e,i=s):typeof e=="string"&&(s!=null?r[e]=s:i=e),i=i||p.sources.API,[n,t,r,i]}function be(n,t,e,s){const i=typeof e=="number"?e:0;if(n==null)return null;let r,l;return t&&typeof t.transformPosition=="function"?[r,l]=[n.index,n.index+n.length].map(o=>t.transformPosition(o,s!==p.sources.USER)):[r,l]=[n.index,n.index+n.length].map(o=>o<t||o===t&&s===p.sources.USER?o:i>=0?o+i:Math.max(t,o+i)),new Q(r,l-r)}class J extends Me{}function ye(n){return n instanceof w||n instanceof C}function Ee(n){return typeof n.updateContent=="function"}class it extends De{constructor(t,e,s){let{emitter:i}=s;super(t,e),this.emitter=i,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",r=>this.handleDragStart(r))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(p.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(p.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(p.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[s,i]=this.line(t),[r]=this.line(t+e);if(super.deleteAt(t,e),r!=null&&s!==r&&i>0){if(s instanceof C||r instanceof C){this.optimize();return}const l=r.children.head instanceof U?null:r.children.head;s.moveChildren(r,l),s.remove()}this.optimize()}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",t?"true":"false")}formatAt(t,e,s,i){super.formatAt(t,e,s,i),this.optimize()}insertAt(t,e,s){if(t>=this.length())if(s==null||this.scroll.query(e,x.BLOCK)==null){const i=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(i),s==null&&e.endsWith(`
`)?i.insertAt(0,e.slice(0,-1),s):i.insertAt(0,e,s)}else{const i=this.scroll.create(e,s);this.appendChild(i)}else super.insertAt(t,e,s);this.optimize()}insertBefore(t,e){if(t.statics.scope===x.INLINE_BLOT){const s=this.scroll.create(this.statics.defaultChild.blotName);s.appendChild(t),super.insertBefore(s,e)}else super.insertBefore(t,e)}insertContents(t,e){const s=this.deltaToRenderBlocks(e.concat(new b().insert(`
`))),i=s.pop();if(i==null)return;this.batchStart();const r=s.shift();if(r){const a=r.type==="block"&&(r.delta.length()===0||!this.descendant(C,t)[0]&&t<this.length()),c=r.type==="block"?r.delta:new b().insert({[r.key]:r.value});Mt(this,t,c);const h=r.type==="block"?1:0,d=t+c.length()+h;a&&this.insertAt(d-1,`
`);const y=S(this.line(t)[0]),E=D.exports.AttributeMap.diff(y,r.attributes)||{};Object.keys(E).forEach(m=>{this.formatAt(d-1,1,m,E[m])}),t=d}let[l,o]=this.children.find(t);if(s.length&&(l&&(l=l.split(o),o=0),s.forEach(a=>{if(a.type==="block"){const c=this.createBlock(a.attributes,l||void 0);Mt(c,0,a.delta)}else{const c=this.create(a.key,a.value);this.insertBefore(c,l||void 0),Object.keys(a.attributes).forEach(h=>{c.format(h,a.attributes[h])})}})),i.type==="block"&&i.delta.length()){const a=l?l.offset(l.scroll)+o:this.length();Mt(this,a,i.delta)}this.batchEnd(),this.optimize()}isEnabled(){return this.domNode.getAttribute("contenteditable")==="true"}leaf(t){const e=this.path(t).pop();if(!e)return[null,-1];const[s,i]=e;return s instanceof B?[s,i]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(ye,t)}lines(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;const s=(i,r,l)=>{let o=[],a=l;return i.children.forEachAt(r,l,(c,h,d)=>{ye(c)?o.push(c):c instanceof Me&&(o=o.concat(s(c,h,a))),a-=d}),o};return s(this,t,e)}optimize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch||(super.optimize(t,e),t.length>0&&this.emitter.emit(p.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch){Array.isArray(t)&&(this.batch=this.batch.concat(t));return}let e=p.sources.USER;typeof t=="string"&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),t=t.filter(s=>{let{target:i}=s;const r=this.find(i,!0);return r&&!Ee(r)}),t.length>0&&this.emitter.emit(p.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(p.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,s){const[i]=this.descendant(r=>r instanceof C,t);i&&i.statics.blotName===e&&Ee(i)&&i.updateContent(s)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let s=new b;return t.forEach(i=>{var l;const r=i==null?void 0:i.insert;if(!!r)if(typeof r=="string"){const o=r.split(`
`);o.slice(0,-1).forEach(c=>{var h;s.insert(c,i.attributes),e.push({type:"block",delta:s,attributes:(h=i.attributes)!=null?h:{}}),s=new b});const a=o[o.length-1];a&&s.insert(a,i.attributes)}else{const o=Object.keys(r)[0];if(!o)return;this.query(o,x.INLINE)?s.push(i):(s.length()&&e.push({type:"block",delta:s,attributes:{}}),s=new b,e.push({type:"blockEmbed",key:o,value:r[o],attributes:(l=i.attributes)!=null?l:{}}))}}),s.length()&&e.push({type:"block",delta:s,attributes:{}}),e}createBlock(t,e){let s;const i={};Object.entries(t).forEach(o=>{let[a,c]=o;this.query(a,x.BLOCK&x.BLOT)!=null?s=a:i[a]=c});const r=this.create(s||this.statics.defaultChild.blotName,s?t[s]:void 0);this.insertBefore(r,e||void 0);const l=r.length();return Object.entries(i).forEach(o=>{let[a,c]=o;r.formatAt(0,l,a,c)}),r}}g(it,"blotName","scroll"),g(it,"className","ql-editor"),g(it,"tagName","DIV"),g(it,"defaultChild",w),g(it,"allowedChildren",[w,C,J]);function Mt(n,t,e){e.reduce((s,i)=>{const r=D.exports.Op.length(i);let l=i.attributes||{};if(i.insert!=null){if(typeof i.insert=="string"){const o=i.insert;n.insertAt(s,o);const[a]=n.descendant(B,s),c=S(a);l=D.exports.AttributeMap.diff(c,l)||{}}else if(typeof i.insert=="object"){const o=Object.keys(i.insert)[0];if(o==null)return s;if(n.insertAt(s,o,i.insert[o]),n.scroll.query(o,x.INLINE)!=null){const[c]=n.descendant(B,s),h=S(c);l=D.exports.AttributeMap.diff(h,l)||{}}}}return Object.keys(l).forEach(o=>{n.formatAt(s,r,o,l[o])}),s+r},t)}const te={scope:x.BLOCK,whitelist:["right","center","justify"]},Os=new Yt("align","align",te),$e=new j("align","ql-align",te),He=new at("align","text-align",te);class _e extends at{value(t){let e=super.value(t);return e.startsWith("rgb(")?(e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),`#${e.split(",").map(i=>`00${parseInt(i,10).toString(16)}`.slice(-2)).join("")}`):e}}const Is=new j("color","ql-color",{scope:x.INLINE}),ee=new _e("color","color",{scope:x.INLINE}),Bs=new j("background","ql-bg",{scope:x.INLINE}),se=new _e("background","background-color",{scope:x.INLINE});class tt extends J{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(s=>s.length()<=1?"":s.domNode.innerText).join(`
`).slice(t,t+e)}html(t,e){return`<pre>
${St(this.code(t,e))}
</pre>`}}class k extends w{static register(){u.register(tt)}}g(k,"TAB"," ");class ie extends R{}ie.blotName="code";ie.tagName="CODE";k.blotName="code-block";k.className="ql-code-block";k.tagName="DIV";tt.blotName="code-block-container";tt.className="ql-code-block-container";tt.tagName="DIV";tt.allowedChildren=[k];k.allowedChildren=[M,U,P];k.requiredContainer=tt;const ne={scope:x.BLOCK,whitelist:["rtl"]},ze=new Yt("direction","dir",ne),je=new j("direction","ql-direction",ne),Ve=new at("direction","direction",ne),Ke={scope:x.INLINE,whitelist:["serif","monospace"]},Ze=new j("font","ql-font",Ke);class Ds extends at{value(t){return super.value(t).replace(/["']/g,"")}}const Ge=new Ds("font","font-family",Ke),We=new j("size","ql-size",{scope:x.INLINE,whitelist:["small","large","huge"]}),Xe=new at("size","font-size",{scope:x.INLINE,whitelist:["10px","18px","32px"]}),Ms=V("quill:keyboard"),Us=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Tt extends F{static match(t,e){return["altKey","ctrlKey","metaKey","shiftKey"].some(s=>!!e[s]!==t[s]&&e[s]!==null)?!1:e.key===t.key||e.key===t.which}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(s=>{this.options.bindings[s]&&this.addBinding(this.options.bindings[s])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=Ps(t);if(i==null){Ms.warn("Attempted to add invalid keyboard binding",i);return}typeof e=="function"&&(e={handler:e}),typeof s=="function"&&(s={handler:s}),(Array.isArray(i.key)?i.key:[i.key]).forEach(l=>{const o={...i,key:l,...e,...s};this.bindings[o.key]=this.bindings[o.key]||[],this.bindings[o.key].push(o)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing)return;const s=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(f=>Tt.match(t,f));if(s.length===0)return;const i=u.find(t.target,!0);if(i&&i.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(r==null||!this.quill.hasFocus())return;const[l,o]=this.quill.getLine(r.index),[a,c]=this.quill.getLeaf(r.index),[h,d]=r.length===0?[a,c]:this.quill.getLeaf(r.index+r.length),y=a instanceof Pt?a.value().slice(0,c):"",E=h instanceof Pt?h.value().slice(d):"",m={collapsed:r.length===0,empty:r.length===0&&l.length()<=1,format:this.quill.getFormat(r),line:l,offset:o,prefix:y,suffix:E,event:t};s.some(f=>{if(f.collapsed!=null&&f.collapsed!==m.collapsed||f.empty!=null&&f.empty!==m.empty||f.offset!=null&&f.offset!==m.offset)return!1;if(Array.isArray(f.format)){if(f.format.every(q=>m.format[q]==null))return!1}else if(typeof f.format=="object"&&!Object.keys(f.format).every(q=>f.format[q]===!0?m.format[q]!=null:f.format[q]===!1?m.format[q]==null:Qt(f.format[q],m.format[q])))return!1;return f.prefix!=null&&!f.prefix.test(m.prefix)||f.suffix!=null&&!f.suffix.test(m.suffix)?!1:f.handler.call(this,r,m,f)!==!0})&&t.preventDefault()})}handleBackspace(t,e){const s=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(t.index===0||this.quill.getLength()<=1)return;let i={};const[r]=this.quill.getLine(t.index);let l=new b().retain(t.index-s).delete(s);if(e.offset===0){const[o]=this.quill.getLine(t.index-1);if(o&&!(o.statics.blotName==="block"&&o.length()<=1)){const c=r.formats(),h=this.quill.getFormat(t.index-1,1);if(i=D.exports.AttributeMap.diff(c,h)||{},Object.keys(i).length>0){const d=new b().retain(t.index+r.length()-2).retain(1,i);l=l.compose(d)}}}this.quill.updateContents(l,u.sources.USER),this.quill.focus()}handleDelete(t,e){const s=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-s)return;let i={};const[r]=this.quill.getLine(t.index);let l=new b().retain(t.index).delete(s);if(e.offset>=r.length()-1){const[o]=this.quill.getLine(t.index+1);if(o){const a=r.formats(),c=this.quill.getFormat(t.index,1);i=D.exports.AttributeMap.diff(a,c)||{},Object.keys(i).length>0&&(l=l.retain(o.length()-1).retain(1,i))}}this.quill.updateContents(l,u.sources.USER),this.quill.focus()}handleDeleteRange(t){re({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const s=Object.keys(e.format).reduce((r,l)=>(this.quill.scroll.query(l,x.BLOCK)&&!Array.isArray(e.format[l])&&(r[l]=e.format[l]),r),{}),i=new b().retain(t.index).delete(t.length).insert(`
`,s);this.quill.updateContents(i,u.sources.USER),this.quill.setSelection(t.index+1,u.sources.SILENT),this.quill.focus()}}const Fs={bindings:{bold:Ut("bold"),italic:Ut("italic"),underline:Ut("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(n,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","+1",u.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(n,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","-1",u.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(n,t){t.format.indent!=null?this.quill.format("indent","-1",u.sources.USER):t.format.list!=null&&this.quill.format("list",!1,u.sources.USER)}},"indent code-block":xe(!0),"outdent code-block":xe(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(n){this.quill.deleteText(n.index-1,1,u.sources.USER)}},tab:{key:"Tab",handler(n,t){if(t.format.table)return!0;this.quill.history.cutoff();const e=new b().retain(n.index).delete(n.length).insert(" ");return this.quill.updateContents(e,u.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(n.index+1,u.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,u.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(n,t){const e={list:!1};t.format.indent&&(e.indent=!1),this.quill.formatLine(n.index,n.length,e,u.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(n){const[t,e]=this.quill.getLine(n.index),s={...t.formats(),list:"checked"},i=new b().retain(n.index).insert(`
`,s).retain(t.length()-e-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,u.sources.USER),this.quill.setSelection(n.index+1,u.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(n,t){const[e,s]=this.quill.getLine(n.index),i=new b().retain(n.index).insert(`
`,t.format).retain(e.length()-s-1).retain(1,{header:null});this.quill.updateContents(i,u.sources.USER),this.quill.setSelection(n.index+1,u.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(n){const t=this.quill.getModule("table");if(t){const[e,s,i,r]=t.getTable(n),l=$s(e,s,i,r);if(l==null)return;let o=e.offset();if(l<0){const a=new b().retain(o).insert(`
`);this.quill.updateContents(a,u.sources.USER),this.quill.setSelection(n.index+1,n.length,u.sources.SILENT)}else if(l>0){o+=e.length();const a=new b().retain(o).insert(`
`);this.quill.updateContents(a,u.sources.USER),this.quill.setSelection(o,u.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(n,t){const{event:e,line:s}=t,i=s.offset(this.quill.scroll);e.shiftKey?this.quill.setSelection(i-1,u.sources.USER):this.quill.setSelection(i+s.length(),u.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(n,t){if(this.quill.scroll.query("list")==null)return!0;const{length:e}=t.prefix,[s,i]=this.quill.getLine(n.index);if(i>e)return!0;let r;switch(t.prefix.trim()){case"[]":case"[ ]":r="unchecked";break;case"[x]":r="checked";break;case"-":case"*":r="bullet";break;default:r="ordered"}this.quill.insertText(n.index," ",u.sources.USER),this.quill.history.cutoff();const l=new b().retain(n.index-i).delete(e+1).retain(s.length()-2-i).retain(1,{list:r});return this.quill.updateContents(l,u.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(n.index-e,u.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(n){const[t,e]=this.quill.getLine(n.index);let s=2,i=t;for(;i!=null&&i.length()<=1&&i.formats()["code-block"];)if(i=i.prev,s-=1,s<=0){const r=new b().retain(n.index+t.length()-e-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,u.sources.USER),this.quill.setSelection(n.index-1,u.sources.SILENT),!1}return!0}},"embed left":vt("ArrowLeft",!1),"embed left shift":vt("ArrowLeft",!0),"embed right":vt("ArrowRight",!1),"embed right shift":vt("ArrowRight",!0),"table down":qe(!1),"table up":qe(!0)}};Tt.DEFAULTS=Fs;function xe(n){return{key:"Tab",shiftKey:!n,format:{"code-block":!0},handler(t,e){let{event:s}=e;const i=this.quill.scroll.query("code-block"),{TAB:r}=i;if(t.length===0&&!s.shiftKey){this.quill.insertText(t.index,r,u.sources.USER),this.quill.setSelection(t.index+r.length,u.sources.SILENT);return}const l=t.length===0?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:o,length:a}=t;l.forEach((c,h)=>{n?(c.insertAt(0,r),h===0?o+=r.length:a+=r.length):c.domNode.textContent.startsWith(r)&&(c.deleteAt(0,r.length),h===0?o-=r.length:a-=r.length)}),this.quill.update(u.sources.USER),this.quill.setSelection(o,a,u.sources.SILENT)}}}function vt(n,t){return{key:n,shiftKey:t,altKey:null,[n==="ArrowLeft"?"prefix":"suffix"]:/^$/,handler(s){let{index:i}=s;n==="ArrowRight"&&(i+=s.length+1);const[r]=this.quill.getLeaf(i);return r instanceof O?(n==="ArrowLeft"?t?this.quill.setSelection(s.index-1,s.length+1,u.sources.USER):this.quill.setSelection(s.index-1,u.sources.USER):t?this.quill.setSelection(s.index,s.length+1,u.sources.USER):this.quill.setSelection(s.index+s.length+1,u.sources.USER),!1):!0}}}function Ut(n){return{key:n[0],shortKey:!0,handler(t,e){this.quill.format(n,!e.format[n],u.sources.USER)}}}function qe(n){return{key:n?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,e){const s=n?"prev":"next",i=e.line,r=i.parent[s];if(r!=null){if(r.statics.blotName==="table-row"){let l=r.children.head,o=i;for(;o.prev!=null;)o=o.prev,l=l.next;const a=l.offset(this.quill.scroll)+Math.min(e.offset,l.length()-1);this.quill.setSelection(a,0,u.sources.USER)}}else{const l=i.table()[s];l!=null&&(n?this.quill.setSelection(l.offset(this.quill.scroll)+l.length()-1,0,u.sources.USER):this.quill.setSelection(l.offset(this.quill.scroll),0,u.sources.USER))}return!1}}}function Ps(n){if(typeof n=="string"||typeof n=="number")n={key:n};else if(typeof n=="object")n=rt(n);else return null;return n.shortKey&&(n[Us]=n.shortKey,delete n.shortKey),n}function re(n){let{quill:t,range:e}=n;const s=t.getLines(e);let i={};if(s.length>1){const r=s[0].formats(),l=s[s.length-1].formats();i=D.exports.AttributeMap.diff(l,r)||{}}t.deleteText(e,u.sources.USER),Object.keys(i).length>0&&t.formatLine(e.index,1,i,u.sources.USER),t.setSelection(e.index,u.sources.SILENT)}function $s(n,t,e,s){return t.prev==null&&t.next==null?e.prev==null&&e.next==null?s===0?-1:1:e.prev==null?-1:1:t.prev==null?-1:t.next==null?1:null}const Hs=/font-weight:\s*normal/,_s=["P","OL","UL"],Ne=n=>n&&_s.includes(n.tagName),zs=n=>{Array.from(n.querySelectorAll("br")).filter(t=>Ne(t.previousElementSibling)&&Ne(t.nextElementSibling)).forEach(t=>{var e;(e=t.parentNode)==null||e.removeChild(t)})},js=n=>{Array.from(n.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return(e=t.getAttribute("style"))==null?void 0:e.match(Hs)}).forEach(t=>{var s;const e=n.createDocumentFragment();e.append(...t.childNodes),(s=t.parentNode)==null||s.replaceChild(e,t)})};function Vs(n){n.querySelector('[id^="docs-internal-guid-"]')&&(js(n),zs(n))}const Ks=/\bmso-list:[^;]*ignore/i,Zs=/\bmso-list:[^;]*\bl(\d+)/i,Gs=/\bmso-list:[^;]*\blevel(\d+)/i,Ws=(n,t)=>{const e=n.getAttribute("style"),s=e==null?void 0:e.match(Zs);if(!s)return null;const i=Number(s[1]),r=e==null?void 0:e.match(Gs),l=r?Number(r[1]):1,o=new RegExp(`@list l${i}:level${l}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=t.match(o),c=a&&a[1]==="bullet"?"bullet":"ordered";return{id:i,indent:l,type:c,element:n}},Xs=n=>{var l,o;const t=Array.from(n.querySelectorAll("[style*=mso-list]")),e=[],s=[];t.forEach(a=>{(a.getAttribute("style")||"").match(Ks)?e.push(a):s.push(a)}),e.forEach(a=>{var c;return(c=a.parentNode)==null?void 0:c.removeChild(a)});const i=n.documentElement.innerHTML,r=s.map(a=>Ws(a,i)).filter(a=>a);for(;r.length;){const a=[];let c=r.shift();for(;c;)a.push(c),c=r.length&&((l=r[0])==null?void 0:l.element)===c.element.nextElementSibling&&r[0].id===c.id?r.shift():null;const h=document.createElement("ul");a.forEach(E=>{const m=document.createElement("li");m.setAttribute("data-list",E.type),E.indent>1&&m.setAttribute("class",`ql-indent-${E.indent-1}`),m.innerHTML=E.element.innerHTML,h.appendChild(m)});const d=(o=a[0])==null?void 0:o.element,{parentNode:y}=d!=null?d:{};d&&(y==null||y.replaceChild(h,d)),a.slice(1).forEach(E=>{let{element:m}=E;y==null||y.removeChild(m)})}};function Ys(n){n.documentElement.getAttribute("xmlns:w")==="urn:schemas-microsoft-com:office:word"&&Xs(n)}const Qs=[Ys,Vs],Js=n=>{n.documentElement&&Qs.forEach(t=>{t(n)})},ti=V("quill:clipboard"),ei=[[Node.TEXT_NODE,fi],[Node.TEXT_NODE,we],["br",li],[Node.ELEMENT_NODE,we],[Node.ELEMENT_NODE,ri],[Node.ELEMENT_NODE,ni],[Node.ELEMENT_NODE,hi],["li",ci],["ol, ul",ui],["pre",oi],["tr",di],["b",Ft("bold")],["i",Ft("italic")],["strike",Ft("strike")],["style",ai]],si=[Os,ze].reduce((n,t)=>(n[t.keyName]=t,n),{}),ve=[He,se,ee,Ve,Ge,Xe].reduce((n,t)=>(n[t.keyName]=t,n),{});class Ye extends F{constructor(t,e){var s;super(t,e),this.quill.root.addEventListener("copy",i=>this.onCaptureCopy(i,!1)),this.quill.root.addEventListener("cut",i=>this.onCaptureCopy(i,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],ei.concat((s=this.options.matchers)!=null?s:[]).forEach(i=>{let[r,l]=i;this.addMatcher(r,l)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:s}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(i[k.blotName])return new b().insert(s||"",{[k.blotName]:i[k.blotName]});if(!e)return new b().insert(s||"",i);const r=this.convertHTML(e);return pt(r,`
`)&&(r.ops[r.ops.length-1].attributes==null||i.table)?r.compose(new b().retain(r.length()-1).delete(1)):r}normalizeHTML(t){Js(t)}convertHTML(t){const e=new DOMParser().parseFromString(t,"text/html");this.normalizeHTML(e);const s=e.body,i=new WeakMap,[r,l]=this.prepareMatching(s,i);return le(this.quill.scroll,s,r,l,i)}dangerouslyPasteHTML(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u.sources.API;if(typeof t=="string"){const i=this.convert({html:t,text:""});this.quill.setContents(i,e),this.quill.setSelection(0,u.sources.SILENT)}else{const i=this.convert({html:e,text:""});this.quill.updateContents(new b().retain(t).concat(i),s),this.quill.setSelection(t+i.length(),u.sources.SILENT)}}onCaptureCopy(t){var l,o;let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(t.defaultPrevented)return;t.preventDefault();const[s]=this.quill.selection.getRange();if(s==null)return;const{html:i,text:r}=this.onCopy(s,e);(l=t.clipboardData)==null||l.setData("text/plain",r),(o=t.clipboardData)==null||o.setData("text/html",i),e&&re({range:s,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(e=>e[0]!=="#").join(`
`)}onCapturePaste(t){var l,o,a,c,h;if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(e==null)return;const s=(l=t.clipboardData)==null?void 0:l.getData("text/html");let i=(o=t.clipboardData)==null?void 0:o.getData("text/plain");if(!s&&!i){const d=(a=t.clipboardData)==null?void 0:a.getData("text/uri-list");d&&(i=this.normalizeURIList(d))}const r=Array.from(((c=t.clipboardData)==null?void 0:c.files)||[]);if(!s&&r.length>0){this.quill.uploader.upload(e,r);return}if(s&&r.length>0){const d=new DOMParser().parseFromString(s,"text/html");if(d.body.childElementCount===1&&((h=d.body.firstElementChild)==null?void 0:h.tagName)==="IMG"){this.quill.uploader.upload(e,r);return}}this.onPaste(e,{html:s,text:i})}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:s,html:i}=e;const r=this.quill.getFormat(t.index),l=this.convert({text:s,html:i},r);ti.log("onPaste",l,{text:s,html:i});const o=new b().retain(t.index).delete(t.length).concat(l);this.quill.updateContents(o,u.sources.USER),this.quill.setSelection(o.length()-t.length,u.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const s=[],i=[];return this.matchers.forEach(r=>{const[l,o]=r;switch(l){case Node.TEXT_NODE:i.push(o);break;case Node.ELEMENT_NODE:s.push(o);break;default:Array.from(t.querySelectorAll(l)).forEach(a=>{if(e.has(a)){const c=e.get(a);c==null||c.push(o)}else e.set(a,[o])});break}}),[s,i]}}g(Ye,"DEFAULTS",{matchers:[]});function et(n,t,e,s){return s.query(t)?n.reduce((i,r)=>{if(!r.insert)return i;if(r.attributes&&r.attributes[t])return i.push(r);const l=e?{[t]:e}:{};return i.insert(r.insert,{...l,...r.attributes})},new b):n}function pt(n,t){let e="";for(let s=n.ops.length-1;s>=0&&e.length<t.length;--s){const i=n.ops[s];if(typeof i.insert!="string")break;e=i.insert+e}return e.slice(-1*t.length)===t}function W(n,t){if(!(n instanceof Element))return!1;const e=t.query(n);return e&&e.prototype instanceof O?!1:["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(n.tagName.toLowerCase())}function ii(n,t){return n.previousElementSibling&&n.nextElementSibling&&!W(n.previousElementSibling,t)&&!W(n.nextElementSibling,t)}const wt=new WeakMap;function Qe(n){return n==null?!1:(wt.has(n)||(n.tagName==="PRE"?wt.set(n,!0):wt.set(n,Qe(n.parentNode))),wt.get(n))}function le(n,t,e,s,i){return t.nodeType===t.TEXT_NODE?s.reduce((r,l)=>l(t,r,n),new b):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((r,l)=>{let o=le(n,l,e,s,i);return l.nodeType===t.ELEMENT_NODE&&(o=e.reduce((a,c)=>c(l,a,n),o),o=(i.get(l)||[]).reduce((a,c)=>c(l,a,n),o)),r.concat(o)},new b):new b}function Ft(n){return(t,e,s)=>et(e,n,!0,s)}function ni(n,t,e){const s=Yt.keys(n),i=j.keys(n),r=at.keys(n),l={};return s.concat(i).concat(r).forEach(o=>{let a=e.query(o,x.ATTRIBUTE);a!=null&&(l[a.attrName]=a.value(n),l[a.attrName])||(a=si[o],a!=null&&(a.attrName===o||a.keyName===o)&&(l[a.attrName]=a.value(n)||void 0),a=ve[o],a!=null&&(a.attrName===o||a.keyName===o)&&(a=ve[o],l[a.attrName]=a.value(n)||void 0))}),Object.entries(l).reduce((o,a)=>{let[c,h]=a;return et(o,c,h,e)},t)}function ri(n,t,e){const s=e.query(n);if(s==null)return t;if(s.prototype instanceof O){const i={},r=s.value(n);if(r!=null)return i[s.blotName]=r,new b().insert(i,s.formats(n,e))}else if(s.prototype instanceof Ie&&!pt(t,`
`)&&t.insert(`
`),"blotName"in s&&"formats"in s&&typeof s.formats=="function")return et(t,s.blotName,s.formats(n,e),e);return t}function li(n,t){return pt(t,`
`)||t.insert(`
`),t}function oi(n,t,e){const s=e.query("code-block"),i=s&&"formats"in s&&typeof s.formats=="function"?s.formats(n,e):!0;return et(t,"code-block",i,e)}function ai(){return new b}function ci(n,t,e){const s=e.query(n);if(s==null||s.blotName!=="list"||!pt(t,`
`))return t;let i=-1,r=n.parentNode;for(;r!=null;)["OL","UL"].includes(r.tagName)&&(i+=1),r=r.parentNode;return i<=0?t:t.reduce((l,o)=>o.insert?o.attributes&&typeof o.attributes.indent=="number"?l.push(o):l.insert(o.insert,{indent:i,...o.attributes||{}}):l,new b)}function ui(n,t,e){const s=n;let i=s.tagName==="OL"?"ordered":"bullet";const r=s.getAttribute("data-checked");return r&&(i=r==="true"?"checked":"unchecked"),et(t,"list",i,e)}function we(n,t,e){if(!pt(t,`
`)){if(W(n,e)&&(n.childNodes.length>0||n instanceof HTMLParagraphElement))return t.insert(`
`);if(t.length()>0&&n.nextSibling){let s=n.nextSibling;for(;s!=null;){if(W(s,e))return t.insert(`
`);const i=e.query(s);if(i&&i.prototype instanceof C)return t.insert(`
`);s=s.firstChild}}}return t}function hi(n,t,e){var r;const s={},i=n.style||{};return i.fontStyle==="italic"&&(s.italic=!0),i.textDecoration==="underline"&&(s.underline=!0),i.textDecoration==="line-through"&&(s.strike=!0),(((r=i.fontWeight)==null?void 0:r.startsWith("bold"))||parseInt(i.fontWeight,10)>=700)&&(s.bold=!0),t=Object.entries(s).reduce((l,o)=>{let[a,c]=o;return et(l,a,c,e)},t),parseFloat(i.textIndent||0)>0?new b().insert(" ").concat(t):t}function di(n,t,e){var i,r;const s=((i=n.parentElement)==null?void 0:i.tagName)==="TABLE"?n.parentElement:(r=n.parentElement)==null?void 0:r.parentElement;if(s!=null){const o=Array.from(s.querySelectorAll("tr")).indexOf(n)+1;return et(t,"table",o,e)}return t}function fi(n,t,e){var i;let s=n.data;if(((i=n.parentElement)==null?void 0:i.tagName)==="O:P")return t.insert(s.trim());if(!Qe(n)){if(s.trim().length===0&&s.includes(`
`)&&!ii(n,e))return t;const r=(l,o)=>{const a=o.replace(/[^\u00a0]/g,"");return a.length<1&&l?" ":a};s=s.replace(/\r\n/g," ").replace(/\n/g," "),s=s.replace(/\s\s+/g,r.bind(r,!0)),(n.previousSibling==null&&n.parentElement!=null&&W(n.parentElement,e)||n.previousSibling instanceof Element&&W(n.previousSibling,e))&&(s=s.replace(/^\s+/,r.bind(r,!1))),(n.nextSibling==null&&n.parentElement!=null&&W(n.parentElement,e)||n.nextSibling instanceof Element&&W(n.nextSibling,e))&&(s=s.replace(/\s+$/,r.bind(r,!1)))}return t.insert(s)}class Je extends F{constructor(e,s){super(e,s);g(this,"lastRecorded",0);g(this,"ignoreChange",!1);g(this,"stack",{undo:[],redo:[]});g(this,"currentRange",null);this.quill.on(u.events.EDITOR_CHANGE,(i,r,l,o)=>{i===u.events.SELECTION_CHANGE?r&&o!==u.sources.SILENT&&(this.currentRange=r):i===u.events.TEXT_CHANGE&&(this.ignoreChange||(!this.options.userOnly||o===u.sources.USER?this.record(r,l):this.transform(r)),this.currentRange=zt(this.currentRange,r))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",i=>{i.inputType==="historyUndo"?(this.undo(),i.preventDefault()):i.inputType==="historyRedo"&&(this.redo(),i.preventDefault())})}change(e,s){if(this.stack[e].length===0)return;const i=this.stack[e].pop();if(!i)return;const r=this.quill.getContents(),l=i.delta.invert(r);this.stack[s].push({delta:l,range:zt(i.range,l)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(i.delta,u.sources.USER),this.ignoreChange=!1,this.restoreSelection(i)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,s){if(e.ops.length===0)return;this.stack.redo=[];let i=e.invert(s),r=this.currentRange;const l=Date.now();if(this.lastRecorded+this.options.delay>l&&this.stack.undo.length>0){const o=this.stack.undo.pop();o&&(i=i.compose(o.delta),r=o.range)}else this.lastRecorded=l;i.length()!==0&&(this.stack.undo.push({delta:i,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){ke(this.stack.undo,e),ke(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,u.sources.USER);else{const s=mi(this.quill.scroll,e.delta);this.quill.setSelection(s,u.sources.USER)}}}g(Je,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});function ke(n,t){let e=t;for(let s=n.length-1;s>=0;s-=1){const i=n[s];n[s]={delta:e.transform(i.delta,!0),range:i.range&&zt(i.range,e)},e=i.delta.transform(e),n[s].delta.length()===0&&n.splice(s,1)}}function gi(n,t){const e=t.ops[t.ops.length-1];return e==null?!1:e.insert!=null?typeof e.insert=="string"&&e.insert.endsWith(`
`):e.attributes!=null?Object.keys(e.attributes).some(s=>n.query(s,x.BLOCK)!=null):!1}function mi(n,t){const e=t.reduce((i,r)=>i+(r.delete||0),0);let s=t.length()-e;return gi(n,t)&&(s-=1),s}function zt(n,t){if(!n)return n;const e=t.transformPosition(n.index),s=t.transformPosition(n.index+n.length);return{index:e,length:s-e}}class ts extends F{constructor(t,e){super(t,e),t.root.addEventListener("drop",s=>{var l;s.preventDefault();let i=null;if(document.caretRangeFromPoint)i=document.caretRangeFromPoint(s.clientX,s.clientY);else if(document.caretPositionFromPoint){const o=document.caretPositionFromPoint(s.clientX,s.clientY);i=document.createRange(),i.setStart(o.offsetNode,o.offset),i.setEnd(o.offsetNode,o.offset)}const r=i&&t.selection.normalizeNative(i);if(r){const o=t.selection.normalizedToRange(r);(l=s.dataTransfer)!=null&&l.files&&this.upload(o,s.dataTransfer.files)}})}upload(t,e){const s=[];Array.from(e).forEach(i=>{var r;i&&((r=this.options.mimetypes)==null?void 0:r.includes(i.type))&&s.push(i)}),s.length>0&&this.options.handler.call(this,t,s)}}ts.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(n,t){const e=t.map(s=>new Promise(i=>{const r=new FileReader;r.onload=l=>{i(l.target.result)},r.readAsDataURL(s)}));Promise.all(e).then(s=>{const i=s.reduce((r,l)=>r.insert({image:l}),new b().retain(n.index).delete(n.length));this.quill.updateContents(i,p.sources.USER),this.quill.setSelection(n.index+s.length,p.sources.SILENT)})}};const pi=["insertText","insertReplacementText"];class bi extends F{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",s=>{this.handleBeforeInput(s)}),/Android/i.test(navigator.userAgent)||t.on(u.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){re({range:t,quill:this.quill})}replaceText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(t.length===0)return!1;if(e){const s=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents(new b().retain(t.index).insert(e,s),u.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,u.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!pi.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||e.collapsed===!0)return;const s=yi(t);if(s==null)return;const i=this.quill.selection.normalizeNative(e),r=i?this.quill.selection.normalizedToRange(i):null;r&&this.replaceText(r,s)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}}function yi(n){var t;return typeof n.data=="string"?n.data:(t=n.dataTransfer)!=null&&t.types.includes("text/plain")?n.dataTransfer.getData("text/plain"):null}const Ei=/Mac/i.test(navigator.platform),xi=100,qi=n=>!!(n.key==="ArrowLeft"||n.key==="ArrowRight"||n.key==="ArrowUp"||n.key==="ArrowDown"||n.key==="Home"||Ei&&n.key==="a"&&n.ctrlKey===!0);class Ni extends F{constructor(e,s){super(e,s);g(this,"isListening",!1);g(this,"selectionChangeDeadline",0);this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,s){let{line:i,event:r}=s;if(!(i instanceof Lt)||!i.uiNode)return!0;const l=getComputedStyle(i.domNode).direction==="rtl";return l&&r.key!=="ArrowRight"||!l&&r.key!=="ArrowLeft"?!0:(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),u.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&qi(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+xi,this.isListening)return;this.isListening=!0;const e=()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()};document.addEventListener("selectionchange",e,{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const s=e.getRangeAt(0);if(s.collapsed!==!0||s.startOffset!==0)return;const i=this.quill.scroll.find(s.startContainer);if(!(i instanceof Lt)||!i.uiNode)return;const r=document.createRange();r.setStartAfter(i.uiNode),r.setEndAfter(i.uiNode),e.removeAllRanges(),e.addRange(r)}}u.register({"blots/block":w,"blots/block/embed":C,"blots/break":U,"blots/container":J,"blots/cursor":P,"blots/embed":Jt,"blots/inline":R,"blots/scroll":it,"blots/text":M,"modules/clipboard":Ye,"modules/history":Je,"modules/keyboard":Tt,"modules/uploader":ts,"modules/input":bi,"modules/uiNode":Ni});class vi extends j{add(t,e){let s=0;if(e==="+1"||e==="-1"){const i=this.value(t)||0;s=e==="+1"?i+1:i-1}else typeof e=="number"&&(s=e);return s===0?(this.remove(t),!0):super.add(t,s.toString())}canAdd(t,e){return super.canAdd(t,e)||super.canAdd(t,parseInt(e,10))}value(t){return parseInt(super.value(t),10)||void 0}}const wi=new vi("indent","ql-indent",{scope:x.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class jt extends w{}g(jt,"blotName","blockquote"),g(jt,"tagName","blockquote");class Vt extends w{static formats(t){return this.tagName.indexOf(t.tagName)+1}}g(Vt,"blotName","header"),g(Vt,"tagName",["H1","H2","H3","H4","H5","H6"]);class bt extends J{}bt.blotName="list-container";bt.tagName="OL";class yt extends w{static create(t){const e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){u.register(bt)}constructor(t,e){super(t,e);const s=e.ownerDocument.createElement("span"),i=r=>{if(!t.isEnabled())return;const l=this.statics.formats(e,t);l==="checked"?(this.format("list","unchecked"),r.preventDefault()):l==="unchecked"&&(this.format("list","checked"),r.preventDefault())};s.addEventListener("mousedown",i),s.addEventListener("touchstart",i),this.attachUI(s)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}yt.blotName="list";yt.tagName="LI";bt.allowedChildren=[yt];yt.requiredContainer=bt;class gt extends R{static create(){return super.create()}static formats(){return!0}optimize(t){super.optimize(t),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}g(gt,"blotName","bold"),g(gt,"tagName",["STRONG","B"]);class Kt extends gt{}g(Kt,"blotName","italic"),g(Kt,"tagName",["EM","I"]);class X extends R{static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return es(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}format(t,e){t!==this.statics.blotName||!e?super.format(t,e):this.domNode.setAttribute("href",this.constructor.sanitize(e))}}g(X,"blotName","link"),g(X,"tagName","A"),g(X,"SANITIZED_URL","about:blank"),g(X,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);function es(n,t){const e=document.createElement("a");e.href=n;const s=e.href.slice(0,e.href.indexOf(":"));return t.indexOf(s)>-1}class Zt extends R{static create(t){return t==="super"?document.createElement("sup"):t==="sub"?document.createElement("sub"):super.create(t)}static formats(t){if(t.tagName==="SUB")return"sub";if(t.tagName==="SUP")return"super"}}g(Zt,"blotName","script"),g(Zt,"tagName",["SUB","SUP"]);class Gt extends gt{}g(Gt,"blotName","strike"),g(Gt,"tagName",["S","STRIKE"]);class Wt extends R{}g(Wt,"blotName","underline"),g(Wt,"tagName","U");class kt extends Jt{static create(t){if(window.katex==null)throw new Error("Formula module requires KaTeX.");const e=super.create(t);return typeof t=="string"&&(window.katex.render(t,e,{throwOnError:!1,errorColor:"#f00"}),e.setAttribute("data-value",t)),e}static value(t){return t.getAttribute("data-value")}html(){const{formula:t}=this.value();return`<span>${t}</span>`}}g(kt,"blotName","formula"),g(kt,"className","ql-formula"),g(kt,"tagName","SPAN");const Ae=["alt","height","width"];class Xt extends O{static create(t){const e=super.create(t);return typeof t=="string"&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return Ae.reduce((e,s)=>(t.hasAttribute(s)&&(e[s]=t.getAttribute(s)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return es(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){Ae.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}g(Xt,"blotName","image"),g(Xt,"tagName","IMG");const Le=["height","width"];class At extends C{static create(t){const e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return Le.reduce((e,s)=>(t.hasAttribute(s)&&(e[s]=t.getAttribute(s)),e),{})}static sanitize(t){return X.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){Le.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`<a href="${t}">${t}</a>`}}g(At,"blotName","video"),g(At,"className","ql-video"),g(At,"tagName","IFRAME");const ht=new j("code-token","hljs",{scope:x.INLINE});class _ extends R{static formats(t,e){for(;t!=null&&t!==e.domNode;){if(t.classList&&t.classList.contains(k.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,s){super(t,e,s),ht.add(this.domNode,s)}format(t,e){t!==_.blotName?super.format(t,e):e?ht.add(this.domNode,e):(ht.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),ht.value(this.domNode)||this.unwrap()}}_.blotName="code-token";_.className="ql-token";class T extends k{static create(t){const e=super.create(t);return typeof t=="string"&&e.setAttribute("data-language",t),e}static formats(t){return t.getAttribute("data-language")||"plain"}static register(){}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-language",e):super.format(t,e)}replaceWith(t,e){return this.formatAt(0,this.length(),_.blotName,!1),super.replaceWith(t,e)}}class dt extends tt{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===T.blotName&&(this.forceNext=!0,this.children.forEach(s=>{s.format(t,e)}))}formatAt(t,e,s,i){s===T.blotName&&(this.forceNext=!0),super.formatAt(t,e,s,i)}highlight(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(this.children.head==null)return;const i=`${Array.from(this.domNode.childNodes).filter(l=>l!==this.uiNode).map(l=>l.textContent).join(`
`)}
`,r=T.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==i){if(i.trim().length>0||this.cachedText==null){const l=this.children.reduce((a,c)=>a.concat(Ue(c,!1)),new b),o=t(i,r);l.diff(o).reduce((a,c)=>{let{retain:h,attributes:d}=c;return h?(d&&Object.keys(d).forEach(y=>{[T.blotName,_.blotName].includes(y)&&this.formatAt(a,h,y,d[y])}),a+h):a},0)}this.cachedText=i,this.forceNext=!1}}html(t,e){const[s]=this.children.find(t);return`<pre data-language="${s?T.formats(s.domNode):"plain"}">
${St(this.code(t,e))}
</pre>`}optimize(t){if(super.optimize(t),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){const e=T.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}dt.allowedChildren=[T];T.requiredContainer=dt;T.allowedChildren=[_,P,M,U];const ki=(n,t,e)=>{if(typeof n.versionString=="string"){const s=n.versionString.split(".")[0];if(parseInt(s,10)>=11)return n.highlight(e,{language:t}).value}return n.highlight(t,e).value};class ss extends F{static register(){u.register(_,!0),u.register(T,!0),u.register(dt,!0)}constructor(t,e){if(super(t,e),this.options.hljs==null)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((s,i)=>{let{key:r}=i;return s[r]=!0,s},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(u.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof dt))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(s=>{let{key:i,label:r}=s;const l=e.ownerDocument.createElement("option");l.textContent=r,l.setAttribute("value",i),e.appendChild(l)}),e.addEventListener("change",()=>{t.format(T.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),t.uiNode==null&&(t.attachUI(e),t.children.head&&(e.value=T.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(u.events.SCROLL_OPTIMIZE,()=>{t&&clearTimeout(t),t=setTimeout(()=>{this.highlight(),t=null},this.options.interval)})}highlight(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(this.quill.selection.composing)return;this.quill.update(u.sources.USER);const s=this.quill.getSelection();(t==null?this.quill.scroll.descendants(dt):[t]).forEach(r=>{r.highlight(this.highlightBlot,e)}),this.quill.update(u.sources.SILENT),s!=null&&this.quill.setSelection(s,u.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"plain";if(e=this.languages[e]?e:"plain",e==="plain")return St(t).split(`
`).reduce((i,r,l)=>(l!==0&&i.insert(`
`,{[k.blotName]:e}),i.insert(r)),new b);const s=this.quill.root.ownerDocument.createElement("div");return s.classList.add(k.className),s.innerHTML=ki(this.options.hljs,e,t),le(this.quill.scroll,s,[(i,r)=>{const l=ht.value(i);return l?r.compose(new b().retain(r.length(),{[_.blotName]:l})):r}],[(i,r)=>i.data.split(`
`).reduce((l,o,a)=>(a!==0&&l.insert(`
`,{[k.blotName]:e}),l.insert(o)),r)],new WeakMap)}}ss.DEFAULTS={hljs:(()=>window.hljs)(),interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};const ue=class extends w{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",oe()),e}static formats(t){if(t.hasAttribute("data-row"))return t.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,e){t===ue.blotName&&e?this.domNode.setAttribute("data-row",e):super.format(t,e)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};let L=ue;g(L,"blotName","table"),g(L,"tagName","TD");class z extends J{checkMerge(){if(super.checkMerge()&&this.next.children.head!=null){const t=this.children.head.formats(),e=this.children.tail.formats(),s=this.next.children.head.formats(),i=this.next.children.tail.formats();return t.table===e.table&&t.table===s.table&&t.table===i.table}return!1}optimize(t){super.optimize(t),this.children.forEach(e=>{if(e.next==null)return;const s=e.formats(),i=e.next.formats();if(s.table!==i.table){const r=this.splitAfter(e);r&&r.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}g(z,"blotName","table-row"),g(z,"tagName","TR");class $ extends J{}g($,"blotName","table-body"),g($,"tagName","TBODY");class ot extends J{balanceCells(){const t=this.descendants(z),e=t.reduce((s,i)=>Math.max(i.children.length,s),0);t.forEach(s=>{new Array(e-s.children.length).fill(0).forEach(()=>{let i;s.children.head!=null&&(i=L.formats(s.children.head.domNode));const r=this.scroll.create(L.blotName,i);s.appendChild(r),r.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant($);e==null||e.children.head==null||e.children.forEach(s=>{const i=s.children.at(t);i!=null&&i.remove()})}insertColumn(t){const[e]=this.descendant($);e==null||e.children.head==null||e.children.forEach(s=>{const i=s.children.at(t),r=L.formats(s.children.head.domNode),l=this.scroll.create(L.blotName,r);s.insertBefore(l,i)})}insertRow(t){const[e]=this.descendant($);if(e==null||e.children.head==null)return;const s=oe(),i=this.scroll.create(z.blotName);e.children.head.children.forEach(()=>{const l=this.scroll.create(L.blotName,s);i.appendChild(l)});const r=e.children.at(t);e.insertBefore(i,r)}rows(){const t=this.children.head;return t==null?[]:t.children.map(e=>e)}}g(ot,"blotName","table-container"),g(ot,"tagName","TABLE");ot.allowedChildren=[$];$.requiredContainer=ot;$.allowedChildren=[z];z.requiredContainer=$;z.allowedChildren=[L];L.requiredContainer=z;function oe(){return`row-${Math.random().toString(36).slice(2,6)}`}class Ai extends F{static register(){u.register(L),u.register(z),u.register($),u.register(ot)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(ot).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();e!=null&&(t.deleteColumn(e.cellOffset()),this.quill.update(u.sources.USER))}deleteRow(){const[,t]=this.getTable();t!=null&&(t.remove(),this.quill.update(u.sources.USER))}deleteTable(){const[t]=this.getTable();if(t==null)return;const e=t.offset();t.remove(),this.quill.update(u.sources.USER),this.quill.setSelection(e,u.sources.SILENT)}getTable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.quill.getSelection();if(t==null)return[null,null,null,-1];const[e,s]=this.quill.getLine(t.index);if(e==null||e.statics.blotName!==L.blotName)return[null,null,null,-1];const i=e.parent;return[i.parent.parent,i,e,s]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[s,i,r]=this.getTable(e);if(r==null)return;const l=r.cellOffset();s.insertColumn(l+t),this.quill.update(u.sources.USER);let o=i.rowOffset();t===0&&(o+=1),this.quill.setSelection(e.index+o,e.length,u.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[s,i,r]=this.getTable(e);if(r==null)return;const l=i.rowOffset();s.insertRow(l+t),this.quill.update(u.sources.USER),t>0?this.quill.setSelection(e,u.sources.SILENT):this.quill.setSelection(e.index+i.children.length,e.length,u.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const s=this.quill.getSelection();if(s==null)return;const i=new Array(t).fill(0).reduce(r=>{const l=new Array(e).fill(`
`).join("");return r.insert(l,{table:oe()})},new b().retain(s.index));this.quill.updateContents(i,u.sources.USER),this.quill.setSelection(s.index,u.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(u.events.SCROLL_OPTIMIZE,t=>{t.some(e=>["TD","TR","TBODY","TABLE"].includes(e.target.tagName)?(this.quill.once(u.events.TEXT_CHANGE,(s,i,r)=>{r===u.sources.USER&&this.balanceTables()}),!0):!1)})}}const Se=V("quill:toolbar");class ae extends F{constructor(t,e){var s,i;if(super(t,e),Array.isArray(this.options.container)){const r=document.createElement("div");r.setAttribute("role","toolbar"),Li(r,this.options.container),(i=(s=t.container)==null?void 0:s.parentNode)==null||i.insertBefore(r,t.container),this.container=r}else typeof this.options.container=="string"?this.container=document.querySelector(this.options.container):this.container=this.options.container;if(!(this.container instanceof HTMLElement)){Se.error("Container required for toolbar",this.options);return}this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(r=>{var o;const l=(o=this.options.handlers)==null?void 0:o[r];l&&this.addHandler(r,l)}),Array.from(this.container.querySelectorAll("button, select")).forEach(r=>{this.attach(r)}),this.quill.on(u.events.EDITOR_CHANGE,()=>{const[r]=this.quill.selection.getRange();this.update(r)})}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find(i=>i.indexOf("ql-")===0);if(!e)return;if(e=e.slice(3),t.tagName==="BUTTON"&&t.setAttribute("type","button"),this.handlers[e]==null&&this.quill.scroll.query(e)==null){Se.warn("ignoring attaching to nonexistent format",e,t);return}const s=t.tagName==="SELECT"?"change":"click";t.addEventListener(s,i=>{let r;if(t.tagName==="SELECT"){if(t.selectedIndex<0)return;const o=t.options[t.selectedIndex];o.hasAttribute("selected")?r=!1:r=o.value||!1}else t.classList.contains("ql-active")?r=!1:r=t.value||!t.hasAttribute("value"),i.preventDefault();this.quill.focus();const[l]=this.quill.selection.getRange();if(this.handlers[e]!=null)this.handlers[e].call(this,r);else if(this.quill.scroll.query(e).prototype instanceof O){if(r=prompt(`Enter ${e}`),!r)return;this.quill.updateContents(new b().retain(l.index).delete(l.length).insert({[e]:r}),u.sources.USER)}else this.quill.format(e,r,u.sources.USER);this.update(l)}),this.controls.push([e,t])}update(t){const e=t==null?{}:this.quill.getFormat(t);this.controls.forEach(s=>{const[i,r]=s;if(r.tagName==="SELECT"){let l=null;if(t==null)l=null;else if(e[i]==null)l=r.querySelector("option[selected]");else if(!Array.isArray(e[i])){let o=e[i];typeof o=="string"&&(o=o.replace(/"/g,'\\"')),l=r.querySelector(`option[value="${o}"]`)}l==null?(r.value="",r.selectedIndex=-1):l.selected=!0}else if(t==null)r.classList.remove("ql-active"),r.setAttribute("aria-pressed","false");else if(r.hasAttribute("value")){const l=e[i],o=l===r.getAttribute("value")||l!=null&&l.toString()===r.getAttribute("value")||l==null&&!r.getAttribute("value");r.classList.toggle("ql-active",o),r.setAttribute("aria-pressed",o.toString())}else{const l=e[i]!=null;r.classList.toggle("ql-active",l),r.setAttribute("aria-pressed",l.toString())}})}}ae.DEFAULTS={};function Te(n,t,e){const s=document.createElement("button");s.setAttribute("type","button"),s.classList.add(`ql-${t}`),s.setAttribute("aria-pressed","false"),e!=null?(s.value=e,s.setAttribute("aria-label",`${t}: ${e}`)):s.setAttribute("aria-label",t),n.appendChild(s)}function Li(n,t){Array.isArray(t[0])||(t=[t]),t.forEach(e=>{const s=document.createElement("span");s.classList.add("ql-formats"),e.forEach(i=>{if(typeof i=="string")Te(s,i);else{const r=Object.keys(i)[0],l=i[r];Array.isArray(l)?Si(s,r,l):Te(s,r,l)}}),n.appendChild(s)})}function Si(n,t,e){const s=document.createElement("select");s.classList.add(`ql-${t}`),e.forEach(i=>{const r=document.createElement("option");i!==!1?r.setAttribute("value",String(i)):r.setAttribute("selected","selected"),s.appendChild(r)}),n.appendChild(s)}ae.DEFAULTS={container:null,handlers:{clean(){const n=this.quill.getSelection();if(n!=null)if(n.length===0){const t=this.quill.getFormat();Object.keys(t).forEach(e=>{this.quill.scroll.query(e,x.INLINE)!=null&&this.quill.format(e,!1,u.sources.USER)})}else this.quill.removeFormat(n,u.sources.USER)},direction(n){const{align:t}=this.quill.getFormat();n==="rtl"&&t==null?this.quill.format("align","right",u.sources.USER):!n&&t==="right"&&this.quill.format("align",!1,u.sources.USER),this.quill.format("direction",n,u.sources.USER)},indent(n){const t=this.quill.getSelection(),e=this.quill.getFormat(t),s=parseInt(e.indent||0,10);if(n==="+1"||n==="-1"){let i=n==="+1"?1:-1;e.direction==="rtl"&&(i*=-1),this.quill.format("indent",s+i,u.sources.USER)}},link(n){n===!0&&(n=prompt("Enter link URL:")),this.quill.format("link",n,u.sources.USER)},list(n){const t=this.quill.getSelection(),e=this.quill.getFormat(t);n==="check"?e.list==="checked"||e.list==="unchecked"?this.quill.format("list",!1,u.sources.USER):this.quill.format("list","unchecked",u.sources.USER):this.quill.format("list",n,u.sources.USER)}}};const Ti='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',Ci='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',Ri='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',Oi='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>',Ii='<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',Bi='<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',Di='<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',Mi='<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',Ce='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',Ui='<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',Fi='<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',Pi='<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>',$i='<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',Hi='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',_i='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',zi='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',ji='<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',Vi='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',Ki='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>',Zi='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',Gi='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',Wi='<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',Xi='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>',Yi='<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',Qi='<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>',Ji='<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',tn='<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',en='<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',sn='<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>';var mt={align:{"":Ti,center:Ci,right:Ri,justify:Oi},background:Ii,blockquote:Bi,bold:Di,clean:Mi,code:Ce,"code-block":Ce,color:Ui,direction:{"":Fi,rtl:Pi},formula:$i,header:{1:Hi,2:_i},italic:zi,image:ji,indent:{"+1":Vi,"-1":Ki},link:Zi,list:{bullet:Gi,check:Wi,ordered:Xi},script:{sub:Yi,super:Qi},strike:Ji,table:tn,underline:en,video:sn};const nn='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>';let Re=0;function Oe(n,t){n.setAttribute(t,`${n.getAttribute(t)!=="true"}`)}class Ct{constructor(t){this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),e.preventDefault();break}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),Oe(this.label,"aria-expanded"),Oe(this.options,"aria-hidden")}buildItem(t){const e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");const s=t.getAttribute("value");return s&&e.setAttribute("data-value",s),t.textContent&&e.setAttribute("data-label",t.textContent),e.addEventListener("click",()=>{this.selectItem(e,!0)}),e.addEventListener("keydown",i=>{switch(i.key){case"Enter":this.selectItem(e,!0),i.preventDefault();break;case"Escape":this.escape(),i.preventDefault();break}}),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML=nn,t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){const t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${Re}`,Re+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{const s=this.buildItem(e);t.appendChild(s),e.selected===!0&&this.selectItem(s)}),this.container.appendChild(t)}buildPicker(){Array.from(this.select.attributes).forEach(t=>{this.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const s=this.container.querySelector(".ql-selected");t!==s&&(s!=null&&s.classList.remove("ql-selected"),t!=null&&(t.classList.add("ql-selected"),this.select.selectedIndex=Array.from(t.parentNode.children).indexOf(t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let t;if(this.select.selectedIndex>-1){const s=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(s)}else this.selectItem(null);const e=t!=null&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}class is extends Ct{constructor(t,e){super(t),this.label.innerHTML=e,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(s=>{s.classList.add("ql-primary")})}buildItem(t){const e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);const s=this.label.querySelector(".ql-color-label"),i=t&&t.getAttribute("data-value")||"";s&&(s.tagName==="line"?s.style.stroke=i:s.style.fill=i)}}class ns extends Ct{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(s=>{s.innerHTML=e[s.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const s=t||this.defaultItem;if(s!=null){if(this.label.innerHTML===s.innerHTML)return;this.label.innerHTML=s.innerHTML}}}const rn=n=>{const{overflowY:t}=getComputedStyle(n,null);return t!=="visible"&&t!=="clip"};class rs{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,rn(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=`${-1*this.quill.root.scrollTop}px`}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(t){const e=t.left+t.width/2-this.root.offsetWidth/2,s=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}px`,this.root.style.top=`${s}px`,this.root.classList.remove("ql-flip");const i=this.boundsContainer.getBoundingClientRect(),r=this.root.getBoundingClientRect();let l=0;if(r.right>i.right&&(l=i.right-r.right,this.root.style.left=`${e+l}px`),r.left<i.left&&(l=i.left-r.left,this.root.style.left=`${e+l}px`),r.bottom>i.bottom){const o=r.bottom-r.top,a=t.bottom-t.top+o;this.root.style.top=`${s-a}px`,this.root.classList.add("ql-flip")}return l}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const ln=[!1,"center","right","justify"],on=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],an=[!1,"serif","monospace"],cn=["1","2","3",!1],un=["small",!1,"large","huge"];class Et extends G{constructor(t,e){super(t,e);const s=i=>{if(!document.body.contains(t.root)){document.body.removeEventListener("click",s);return}this.tooltip!=null&&!this.tooltip.root.contains(i.target)&&document.activeElement!==this.tooltip.textbox&&!this.quill.hasFocus()&&this.tooltip.hide(),this.pickers!=null&&this.pickers.forEach(r=>{r.container.contains(i.target)||r.close()})};t.emitter.listenDOM("click",document.body,s)}addModule(t){const e=super.addModule(t);return t==="toolbar"&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach(s=>{(s.getAttribute("class")||"").split(/\s+/).forEach(r=>{if(!!r.startsWith("ql-")&&(r=r.slice(3),e[r]!=null))if(r==="direction")s.innerHTML=e[r][""]+e[r].rtl;else if(typeof e[r]=="string")s.innerHTML=e[r];else{const l=s.value||"";l!=null&&e[r][l]&&(s.innerHTML=e[r][l])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(i=>{if(i.classList.contains("ql-align")&&(i.querySelector("option")==null&&ut(i,ln),typeof e.align=="object"))return new ns(i,e.align);if(i.classList.contains("ql-background")||i.classList.contains("ql-color")){const r=i.classList.contains("ql-background")?"background":"color";return i.querySelector("option")==null&&ut(i,on,r==="background"?"#ffffff":"#000000"),new is(i,e[r])}return i.querySelector("option")==null&&(i.classList.contains("ql-font")?ut(i,an):i.classList.contains("ql-header")?ut(i,cn):i.classList.contains("ql-size")&&ut(i,un)),new Ct(i)});const s=()=>{this.pickers.forEach(i=>{i.update()})};this.quill.on(p.events.EDITOR_CHANGE,s)}}Et.DEFAULTS=Y({},G.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let n=this.container.querySelector("input.ql-image[type=file]");n==null&&(n=document.createElement("input"),n.setAttribute("type","file"),n.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),n.classList.add("ql-image"),n.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,n.files),n.value=""}),this.container.appendChild(n)),n.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class ls extends rs{constructor(t,e){super(t,e),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",t=>{t.key==="Enter"?(this.save(),t.preventDefault()):t.key==="Escape"&&(this.cancel(),t.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"link",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),this.textbox==null)return;e!=null?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const s=this.quill.getBounds(this.quill.selection.savedRange);s!=null&&this.position(s),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${t}`)||""),this.root.setAttribute("data-mode",t)}restoreFocus(){this.quill.focus()}save(){let{value:t}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,p.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,p.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=hn(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(e!=null){const s=e.index+e.length;this.quill.insertEmbed(s,this.root.getAttribute("data-mode"),t,p.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(s+1," ",p.sources.USER),this.quill.setSelection(s+2,p.sources.USER)}break}}this.textbox.value="",this.hide()}}function hn(n){let t=n.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||n.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return t?`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`:(t=n.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`:n}function ut(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t.forEach(s=>{const i=document.createElement("option");s===e?i.setAttribute("selected","selected"):i.setAttribute("value",String(s)),n.appendChild(i)})}const dn=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class os extends ls{constructor(t,e){super(t,e),this.quill.on(p.events.EDITOR_CHANGE,(s,i,r,l)=>{if(s===p.events.SELECTION_CHANGE)if(i!=null&&i.length>0&&l===p.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const o=this.quill.getLines(i.index,i.length);if(o.length===1){const a=this.quill.getBounds(i);a!=null&&this.position(a)}else{const a=o[o.length-1],c=this.quill.getIndex(a),h=Math.min(a.length()-1,i.index+i.length-c),d=this.quill.getBounds(new Q(c,h));d!=null&&this.position(d)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(p.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const t=this.quill.getSelection();if(t!=null){const e=this.quill.getBounds(t);e!=null&&this.position(e)}},1)})}cancel(){this.show()}position(t){const e=super.position(t),s=this.root.querySelector(".ql-tooltip-arrow");return s.style.marginLeft="",e!==0&&(s.style.marginLeft=`${-1*e-s.offsetWidth/2}px`),e}}g(os,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class as extends Et{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=dn),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new os(this.quill,this.options.bounds),t.container!=null&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),mt),this.buildPickers(t.container.querySelectorAll("select"),mt))}}as.DEFAULTS=Y({},Et.DEFAULTS,{modules:{toolbar:{handlers:{link(n){n?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});const fn=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class cs extends ls{constructor(){super(...arguments);g(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",e=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),e.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",e=>{if(this.linkRange!=null){const s=this.linkRange;this.restoreFocus(),this.quill.formatText(s,"link",!1,p.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(p.events.SELECTION_CHANGE,(e,s,i)=>{if(e!=null){if(e.length===0&&i===p.sources.USER){const[r,l]=this.quill.scroll.descendant(X,e.index);if(r!=null){this.linkRange=new Q(e.index-l,r.length());const o=X.formats(r.domNode);this.preview.textContent=o,this.preview.setAttribute("href",o),this.show();const a=this.quill.getBounds(this.linkRange);a!=null&&this.position(a);return}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}g(cs,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class us extends Et{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=fn),super(t,e),this.quill.container.classList.add("ql-snow")}extendToolbar(t){t.container!=null&&(t.container.classList.add("ql-snow"),this.buildButtons(t.container.querySelectorAll("button"),mt),this.buildPickers(t.container.querySelectorAll("select"),mt),this.tooltip=new cs(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,s)=>{t.handlers.link.call(t,!s.format.link)}))}}us.DEFAULTS=Y({},Et.DEFAULTS,{modules:{toolbar:{handlers:{link(n){if(n){const t=this.quill.getSelection();if(t==null||t.length===0)return;let e=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(e)&&e.indexOf("mailto:")!==0&&(e=`mailto:${e}`);const{tooltip:s}=this.quill.theme;s.edit("link",e)}else this.quill.format("link",!1)}}}}});u.register({"attributors/attribute/direction":ze,"attributors/class/align":$e,"attributors/class/background":Bs,"attributors/class/color":Is,"attributors/class/direction":je,"attributors/class/font":Ze,"attributors/class/size":We,"attributors/style/align":He,"attributors/style/background":se,"attributors/style/color":ee,"attributors/style/direction":Ve,"attributors/style/font":Ge,"attributors/style/size":Xe},!0);u.register({"formats/align":$e,"formats/direction":je,"formats/indent":wi,"formats/background":se,"formats/color":ee,"formats/font":Ze,"formats/size":We,"formats/blockquote":jt,"formats/code-block":k,"formats/header":Vt,"formats/list":yt,"formats/bold":gt,"formats/code":ie,"formats/italic":Kt,"formats/link":X,"formats/script":Zt,"formats/strike":Gt,"formats/underline":Wt,"formats/formula":kt,"formats/image":Xt,"formats/video":At,"modules/syntax":ss,"modules/table":Ai,"modules/toolbar":ae,"themes/bubble":as,"themes/snow":us,"ui/icons":mt,"ui/picker":Ct,"ui/icon-picker":ns,"ui/color-picker":is,"ui/tooltip":rs},!0);export{u as Q};