var dl=Object.defineProperty;var pl=(r,t,e)=>t in r?dl(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var q=(r,t,e)=>pl(r,typeof t!="symbol"?t+"":t,e);import{a as gl,aH as ml,r as er,_ as bl,q as yl,Z as vl,aj as kt,c as El,o as Nl,b as bt,S as T,K as F,P as Zr}from"./vue.YrNK8sx4.js";import{A as Al}from"./api.o0bWG1Ko.js";import{c as Gt,g as qi,Y as kr,Z as _e,$ as Yt,E as Wr}from"./index.Cep9aVOj.js";import{_ as wl}from"./_plugin-vue_export-helper.DlAUqK2U.js";var C=(r=>(r[r.TYPE=3]="TYPE",r[r.LEVEL=12]="LEVEL",r[r.ATTRIBUTE=13]="ATTRIBUTE",r[r.BLOT=14]="BLOT",r[r.INLINE=7]="INLINE",r[r.BLOCK=11]="BLOCK",r[r.BLOCK_BLOT=10]="BLOCK_BLOT",r[r.INLINE_BLOT=6]="INLINE_BLOT",r[r.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",r[r.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",r[r.ANY=15]="ANY",r))(C||{});class It{constructor(t,e,s={}){this.attrName=t,this.keyName=e;const n=C.TYPE&C.ATTRIBUTE;this.scope=s.scope!=null?s.scope&C.LEVEL|n:C.ATTRIBUTE,s.whitelist!=null&&(this.whitelist=s.whitelist)}static keys(t){return Array.from(t.attributes).map(e=>e.name)}add(t,e){return this.canAdd(t,e)?(t.setAttribute(this.keyName,e),!0):!1}canAdd(t,e){return this.whitelist==null?!0:typeof e=="string"?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1}remove(t){t.removeAttribute(this.keyName)}value(t){const e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""}}class Se extends Error{constructor(t){t="[Parchment] "+t,super(t),this.message=t,this.name=this.constructor.name}}const Li=class fr{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(t,e=!1){if(t==null)return null;if(this.blots.has(t))return this.blots.get(t)||null;if(e){let s=null;try{s=t.parentNode}catch{return null}return this.find(s,e)}return null}create(t,e,s){const n=this.query(e);if(n==null)throw new Se(`Unable to create ${e} blot`);const i=n,o=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:i.create(s),a=new i(t,o,s);return fr.blots.set(a.domNode,a),a}find(t,e=!1){return fr.find(t,e)}query(t,e=C.ANY){let s;return typeof t=="string"?s=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?s=this.types.text:typeof t=="number"?t&C.LEVEL&C.BLOCK?s=this.types.block:t&C.LEVEL&C.INLINE&&(s=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(n=>(s=this.classes[n],!!s)),s=s||this.tags[t.tagName]),s==null?null:"scope"in s&&e&C.LEVEL&s.scope&&e&C.TYPE&s.scope?s:null}register(...t){return t.map(e=>{const s="blotName"in e,n="attrName"in e;if(!s&&!n)throw new Se("Invalid definition");if(s&&e.blotName==="abstract")throw new Se("Cannot register abstract class");const i=s?e.blotName:n?e.attrName:void 0;return this.types[i]=e,n?typeof e.keyName=="string"&&(this.attributes[e.keyName]=e):s&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(o=>o.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(o=>{(this.tags[o]==null||e.className==null)&&(this.tags[o]=e)}))),e})}};Li.blots=new WeakMap;let Ce=Li;function Yr(r,t){return(r.getAttribute("class")||"").split(/\s+/).filter(e=>e.indexOf(`${t}-`)===0)}class xl extends It{static keys(t){return(t.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(t,e){return this.canAdd(t,e)?(this.remove(t),t.classList.add(`${this.keyName}-${e}`),!0):!1}remove(t){Yr(t,this.keyName).forEach(e=>{t.classList.remove(e)}),t.classList.length===0&&t.removeAttribute("class")}value(t){const e=(Yr(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}}const wt=xl;function sr(r){const t=r.split("-"),e=t.slice(1).map(s=>s[0].toUpperCase()+s.slice(1)).join("");return t[0]+e}class Tl extends It{static keys(t){return(t.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(t,e){return this.canAdd(t,e)?(t.style[sr(this.keyName)]=e,!0):!1}remove(t){t.style[sr(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[sr(this.keyName)];return this.canAdd(t,e)?e:""}}const Xt=Tl;class ql{constructor(t){this.attributes={},this.domNode=t,this.build()}attribute(t,e){e?t.add(this.domNode,e)&&(t.value(this.domNode)!=null?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])}build(){this.attributes={};const t=Ce.find(this.domNode);if(t==null)return;const e=It.keys(this.domNode),s=wt.keys(this.domNode),n=Xt.keys(this.domNode);e.concat(s).concat(n).forEach(i=>{const o=t.scroll.query(i,C.ATTRIBUTE);o instanceof It&&(this.attributes[o.attrName]=o)})}copy(t){Object.keys(this.attributes).forEach(e=>{const s=this.attributes[e].value(this.domNode);t.format(e,s)})}move(t){this.copy(t),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((t,e)=>(t[e]=this.attributes[e].value(this.domNode),t),{})}}const Qs=ql,_i=class{constructor(t,e){this.scroll=t,this.domNode=e,Ce.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(this.tagName==null)throw new Se("Blot definition missing tagName");let e,s;return Array.isArray(this.tagName)?(typeof t=="string"?(s=t.toUpperCase(),parseInt(s,10).toString()===s&&(s=parseInt(s,10))):typeof t=="number"&&(s=t),typeof s=="number"?e=document.createElement(this.tagName[s-1]):s&&this.tagName.indexOf(s)>-1?e=document.createElement(s):e=document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e}get statics(){return this.constructor}attach(){}clone(){const t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){this.parent!=null&&this.parent.removeChild(this),Ce.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,s,n){const i=this.isolate(t,e);if(this.scroll.query(s,C.BLOT)!=null&&n)i.wrap(s,n);else if(this.scroll.query(s,C.ATTRIBUTE)!=null){const o=this.scroll.create(this.statics.scope);i.wrap(o),o.format(s,n)}}insertAt(t,e,s){const n=s==null?this.scroll.create("text",e):this.scroll.create(e,s),i=this.split(t);this.parent.insertBefore(n,i||void 0)}isolate(t,e){const s=this.split(t);if(s==null)throw new Error("Attempt to isolate at end");return s.split(e),s}length(){return 1}offset(t=this.parent){return this.parent==null||this===t?0:this.parent.children.offset(this)+this.parent.offset(t)}optimize(t){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(t,e){const s=typeof t=="string"?this.scroll.create(t,e):t;return this.parent!=null&&(this.parent.insertBefore(s,this.next||void 0),this.remove()),s}split(t,e){return t===0?this:this.next}update(t,e){}wrap(t,e){const s=typeof t=="string"?this.scroll.create(t,e):t;if(this.parent!=null&&this.parent.insertBefore(s,this.next||void 0),typeof s.appendChild!="function")throw new Se(`Cannot wrap ${t}`);return s.appendChild(this),s}};_i.blotName="abstract";let Si=_i;const ki=class extends Si{static value(t){return!0}index(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1}position(t,e){let s=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(s+=1),[this.parent.domNode,s]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};ki.scope=C.INLINE_BLOT;let Ll=ki;const J=Ll;class _l{constructor(){this.head=null,this.tail=null,this.length=0}append(...t){if(this.insertBefore(t[0],null),t.length>1){const e=t.slice(1);this.append(...e)}}at(t){const e=this.iterator();let s=e();for(;s&&t>0;)t-=1,s=e();return s}contains(t){const e=this.iterator();let s=e();for(;s;){if(s===t)return!0;s=e()}return!1}indexOf(t){const e=this.iterator();let s=e(),n=0;for(;s;){if(s===t)return n;n+=1,s=e()}return-1}insertBefore(t,e){t!=null&&(this.remove(t),t.next=e,e!=null?(t.prev=e.prev,e.prev!=null&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):this.tail!=null?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)}offset(t){let e=0,s=this.head;for(;s!=null;){if(s===t)return e;e+=s.length(),s=s.next}return-1}remove(t){this.contains(t)&&(t.prev!=null&&(t.prev.next=t.next),t.next!=null&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)}iterator(t=this.head){return()=>{const e=t;return t!=null&&(t=t.next),e}}find(t,e=!1){const s=this.iterator();let n=s();for(;n;){const i=n.length();if(to?s(u,t-o,Math.min(e,o+h-t)):s(u,0,Math.min(h,t+e-o)),o+=h,u=a()}}map(t){return this.reduce((e,s)=>(e.push(t(s)),e),[])}reduce(t,e){const s=this.iterator();let n=s();for(;n;)e=t(e,n),n=s();return e}}function Xr(r,t){const e=t.find(r);if(e)return e;try{return t.create(r)}catch{const s=t.create(C.INLINE);return Array.from(r.childNodes).forEach(n=>{s.domNode.appendChild(n)}),r.parentNode&&r.parentNode.replaceChild(s.domNode,r),s.attach(),s}}const Ci=class Kt extends Si{constructor(t,e){super(t,e),this.uiNode=null,this.build()}appendChild(t){this.insertBefore(t)}attach(){super.attach(),this.children.forEach(t=>{t.attach()})}attachUI(t){this.uiNode!=null&&this.uiNode.remove(),this.uiNode=t,Kt.uiClass&&this.uiNode.classList.add(Kt.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new _l,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=Xr(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof Se)return;throw e}})}deleteAt(t,e){if(t===0&&e===this.length())return this.remove();this.children.forEachAt(t,e,(s,n,i)=>{s.deleteAt(n,i)})}descendant(t,e=0){const[s,n]=this.children.find(e);return t.blotName==null&&t(s)||t.blotName!=null&&s instanceof t?[s,n]:s instanceof Kt?s.descendant(t,n):[null,-1]}descendants(t,e=0,s=Number.MAX_VALUE){let n=[],i=s;return this.children.forEachAt(e,s,(o,a,u)=>{(t.blotName==null&&t(o)||t.blotName!=null&&o instanceof t)&&n.push(o),o instanceof Kt&&(n=n.concat(o.descendants(t,a,i))),i-=u}),n}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(e=>{t||this.statics.allowedChildren.some(s=>e instanceof s)||(e.statics.scope===C.BLOCK_BLOT?(e.next!=null&&this.splitAfter(e),e.prev!=null&&this.splitAfter(e.prev),e.parent.unwrap(),t=!0):e instanceof Kt?e.unwrap():e.remove())})}formatAt(t,e,s,n){this.children.forEachAt(t,e,(i,o,a)=>{i.formatAt(o,a,s,n)})}insertAt(t,e,s){const[n,i]=this.children.find(t);if(n)n.insertAt(i,e,s);else{const o=s==null?this.scroll.create("text",e):this.scroll.create(e,s);this.appendChild(o)}}insertBefore(t,e){t.parent!=null&&t.parent.children.remove(t);let s=null;this.children.insertBefore(t,e||null),t.parent=this,e!=null&&(s=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==s)&&this.domNode.insertBefore(t.domNode,s),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(s=>{t.insertBefore(s,e)})}optimize(t){if(super.optimize(t),this.enforceAllowedChildren(),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0)if(this.statics.defaultChild!=null){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,e=!1){const[s,n]=this.children.find(t,e),i=[[this,t]];return s instanceof Kt?i.concat(s.path(n,e)):(s!=null&&i.push([s,n]),i)}removeChild(t){this.children.remove(t)}replaceWith(t,e){const s=typeof t=="string"?this.scroll.create(t,e):t;return s instanceof Kt&&this.moveChildren(s),super.replaceWith(s)}split(t,e=!1){if(!e){if(t===0)return this;if(t===this.length())return this.next}const s=this.clone();return this.parent&&this.parent.insertBefore(s,this.next||void 0),this.children.forEachAt(t,this.length(),(n,i,o)=>{const a=n.split(i,e);a!=null&&s.appendChild(a)}),s}splitAfter(t){const e=this.clone();for(;t.next!=null;)e.appendChild(t.next);return this.parent&&this.parent.insertBefore(e,this.next||void 0),e}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(t,e){const s=[],n=[];t.forEach(i=>{i.target===this.domNode&&i.type==="childList"&&(s.push(...i.addedNodes),n.push(...i.removedNodes))}),n.forEach(i=>{if(i.parentNode!=null&&i.tagName!=="IFRAME"&&document.body.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const o=this.scroll.find(i);o!=null&&(o.domNode.parentNode==null||o.domNode.parentNode===this.domNode)&&o.detach()}),s.filter(i=>i.parentNode===this.domNode&&i!==this.uiNode).sort((i,o)=>i===o?0:i.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(i=>{let o=null;i.nextSibling!=null&&(o=this.scroll.find(i.nextSibling));const a=Xr(i,this.scroll);(a.next!==o||a.next==null)&&(a.parent!=null&&a.parent.removeChild(this),this.insertBefore(a,o||void 0))}),this.enforceAllowedChildren()}};Ci.uiClass="";let Sl=Ci;const Nt=Sl;function kl(r,t){if(Object.keys(r).length!==Object.keys(t).length)return!1;for(const e in r)if(r[e]!==t[e])return!1;return!0}const Ae=class we extends Nt{static create(t){return super.create(t)}static formats(t,e){const s=e.query(we.blotName);if(!(s!=null&&t.tagName===s.tagName)){if(typeof this.tagName=="string")return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new Qs(this.domNode)}format(t,e){if(t===this.statics.blotName&&!e)this.children.forEach(s=>{s instanceof we||(s=s.wrap(we.blotName,!0)),this.attributes.copy(s)}),this.unwrap();else{const s=this.scroll.query(t,C.INLINE);if(s==null)return;s instanceof It?this.attributes.attribute(s,e):e&&(t!==this.statics.blotName||this.formats()[t]!==e)&&this.replaceWith(t,e)}}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return e!=null&&(t[this.statics.blotName]=e),t}formatAt(t,e,s,n){this.formats()[s]!=null||this.scroll.query(s,C.ATTRIBUTE)?this.isolate(t,e).format(s,n):super.formatAt(t,e,s,n)}optimize(t){super.optimize(t);const e=this.formats();if(Object.keys(e).length===0)return this.unwrap();const s=this.next;s instanceof we&&s.prev===this&&kl(e,s.formats())&&(s.moveChildren(this),s.remove())}replaceWith(t,e){const s=super.replaceWith(t,e);return this.attributes.copy(s),s}update(t,e){super.update(t,e),t.some(s=>s.target===this.domNode&&s.type==="attributes")&&this.attributes.build()}wrap(t,e){const s=super.wrap(t,e);return s instanceof we&&this.attributes.move(s),s}};Ae.allowedChildren=[Ae,J],Ae.blotName="inline",Ae.scope=C.INLINE_BLOT,Ae.tagName="SPAN";let Cl=Ae;const Cr=Cl,xe=class dr extends Nt{static create(t){return super.create(t)}static formats(t,e){const s=e.query(dr.blotName);if(!(s!=null&&t.tagName===s.tagName)){if(typeof this.tagName=="string")return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new Qs(this.domNode)}format(t,e){const s=this.scroll.query(t,C.BLOCK);s!=null&&(s instanceof It?this.attributes.attribute(s,e):t===this.statics.blotName&&!e?this.replaceWith(dr.blotName):e&&(t!==this.statics.blotName||this.formats()[t]!==e)&&this.replaceWith(t,e))}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return e!=null&&(t[this.statics.blotName]=e),t}formatAt(t,e,s,n){this.scroll.query(s,C.BLOCK)!=null?this.format(s,n):super.formatAt(t,e,s,n)}insertAt(t,e,s){if(s==null||this.scroll.query(e,C.INLINE)!=null)super.insertAt(t,e,s);else{const n=this.split(t);if(n!=null){const i=this.scroll.create(e,s);n.parent.insertBefore(i,n)}else throw new Error("Attempt to insertAt after block boundaries")}}replaceWith(t,e){const s=super.replaceWith(t,e);return this.attributes.copy(s),s}update(t,e){super.update(t,e),t.some(s=>s.target===this.domNode&&s.type==="attributes")&&this.attributes.build()}};xe.blotName="block",xe.scope=C.BLOCK_BLOT,xe.tagName="P",xe.allowedChildren=[Cr,xe,J];let Ol=xe;const is=Ol,pr=class extends Nt{checkMerge(){return this.next!==null&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,s,n){super.formatAt(t,e,s,n),this.enforceAllowedChildren()}insertAt(t,e,s){super.insertAt(t,e,s),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};pr.blotName="container",pr.scope=C.BLOCK_BLOT;let Il=pr;const Js=Il;class Rl extends J{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,s,n){t===0&&e===this.length()?this.format(s,n):super.formatAt(t,e,s,n)}formats(){return this.statics.formats(this.domNode,this.scroll)}}const lt=Rl,Bl={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},Ml=100,Te=class extends Nt{constructor(t,e){super(null,e),this.registry=t,this.scroll=this,this.build(),this.observer=new MutationObserver(s=>{this.update(s)}),this.observer.observe(this.domNode,Bl),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const s=this.registry.find(t,e);return s?s.scroll===this?s:e?this.find(s.scroll.domNode.parentNode,!0):null:null}query(t,e=C.ANY){return this.registry.query(t,e)}register(...t){return this.registry.register(...t)}build(){this.scroll!=null&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(t,e){this.update(),t===0&&e===this.length()?this.children.forEach(s=>{s.remove()}):super.deleteAt(t,e)}formatAt(t,e,s,n){this.update(),super.formatAt(t,e,s,n)}insertAt(t,e,s){this.update(),super.insertAt(t,e,s)}optimize(t=[],e={}){super.optimize(e);const s=e.mutationsMap||new WeakMap;let n=Array.from(this.observer.takeRecords());for(;n.length>0;)t.push(n.pop());const i=(u,h=!0)=>{u==null||u===this||u.domNode.parentNode!=null&&(s.has(u.domNode)||s.set(u.domNode,[]),h&&i(u.parent))},o=u=>{s.has(u.domNode)&&(u instanceof Nt&&u.children.forEach(o),s.delete(u.domNode),u.optimize(e))};let a=t;for(let u=0;a.length>0;u+=1){if(u>=Ml)throw new Error("[Parchment] Maximum optimize iterations reached");for(a.forEach(h=>{const p=this.find(h.target,!0);p!=null&&(p.domNode===h.target&&(h.type==="childList"?(i(this.find(h.previousSibling,!1)),Array.from(h.addedNodes).forEach(b=>{const d=this.find(b,!1);i(d,!1),d instanceof Nt&&d.children.forEach(g=>{i(g,!1)})})):h.type==="attributes"&&i(p.prev)),i(p))}),this.children.forEach(o),a=Array.from(this.observer.takeRecords()),n=a.slice();n.length>0;)t.push(n.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const s=new WeakMap;t.map(n=>{const i=this.find(n.target,!0);return i==null?null:s.has(i.domNode)?(s.get(i.domNode).push(n),null):(s.set(i.domNode,[n]),i)}).forEach(n=>{n!=null&&n!==this&&s.has(n.domNode)&&n.update(s.get(n.domNode)||[],e)}),e.mutationsMap=s,s.has(this.domNode)&&super.update(s.get(this.domNode),e),this.optimize(t,e)}};Te.blotName="scroll",Te.defaultChild=is,Te.allowedChildren=[is,Js],Te.scope=C.BLOCK_BLOT,Te.tagName="DIV";let Dl=Te;const Or=Dl,gr=class Oi extends J{static create(t){return document.createTextNode(t)}static value(t){return t.data}constructor(t,e){super(t,e),this.text=this.statics.value(this.domNode)}deleteAt(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)}index(t,e){return this.domNode===t?e:-1}insertAt(t,e,s){s==null?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,s)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof Oi&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(t,e=!1){return[this.domNode,t]}split(t,e=!1){if(!e){if(t===0)return this;if(t===this.length())return this.next}const s=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(s,this.next||void 0),this.text=this.statics.value(this.domNode),s}update(t,e){t.some(s=>s.type==="characterData"&&s.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};gr.blotName="text",gr.scope=C.INLINE_BLOT;let Ul=gr;const Ws=Ul,jl=Object.freeze(Object.defineProperty({__proto__:null,Attributor:It,AttributorStore:Qs,BlockBlot:is,ClassAttributor:wt,ContainerBlot:Js,EmbedBlot:lt,InlineBlot:Cr,LeafBlot:J,ParentBlot:Nt,Registry:Ce,Scope:C,ScrollBlot:Or,StyleAttributor:Xt,TextBlot:Ws},Symbol.toStringTag,{value:"Module"}));var mr={exports:{}},it=-1,st=1,K=0;function ls(r,t,e,s,n){if(r===t)return r?[[K,r]]:[];if(e!=null){var i=Zl(r,t,e);if(i)return i}var o=Ir(r,t),a=r.substring(0,o);r=r.substring(o),t=t.substring(o),o=tn(r,t);var u=r.substring(r.length-o);r=r.substring(0,r.length-o),t=t.substring(0,t.length-o);var h=Pl(r,t);return a&&h.unshift([K,a]),u&&h.push([K,u]),Rr(h,n),s&&Fl(h),h}function Pl(r,t){var e;if(!r)return[[st,t]];if(!t)return[[it,r]];var s=r.length>t.length?r:t,n=r.length>t.length?t:r,i=s.indexOf(n);if(i!==-1)return e=[[st,s.substring(0,i)],[K,n],[st,s.substring(i+n.length)]],r.length>t.length&&(e[0][0]=e[2][0]=it),e;if(n.length===1)return[[it,r],[st,t]];var o=$l(r,t);if(o){var a=o[0],u=o[1],h=o[2],p=o[3],b=o[4],d=ls(a,h),g=ls(u,p);return d.concat([[K,b]],g)}return Hl(r,t)}function Hl(r,t){for(var e=r.length,s=t.length,n=Math.ceil((e+s)/2),i=n,o=2*n,a=new Array(o),u=new Array(o),h=0;he)g+=2;else if(k>s)d+=2;else if(b){var L=i+p-v;if(L>=0&&L=I)return Qr(r,t,x,k)}}}for(var M=-N+m;M<=N-y;M+=2){var L=i+M,I;M===-N||M!==N&&u[L-1]e)y+=2;else if($>s)m+=2;else if(!b){var E=i+p-M;if(E>=0&&E=I)return Qr(r,t,x,k)}}}}return[[it,r],[st,t]]}function Qr(r,t,e,s){var n=r.substring(0,e),i=t.substring(0,s),o=r.substring(e),a=t.substring(s),u=ls(n,i),h=ls(o,a);return u.concat(h)}function Ir(r,t){if(!r||!t||r.charAt(0)!==t.charAt(0))return 0;for(var e=0,s=Math.min(r.length,t.length),n=s,i=0;es?r=r.substring(e-s):et.length?r:t,s=r.length>t.length?t:r;if(e.length<4||s.length*2=g.length?[x,k,L,I,E]:null}var i=n(e,s,Math.ceil(e.length/4)),o=n(e,s,Math.ceil(e.length/2)),a;if(!i&&!o)return null;o?i?a=i[4].length>o[4].length?i:o:a=o:a=i;var u,h,p,b;r.length>t.length?(u=a[0],h=a[1],p=a[2],b=a[3]):(p=a[0],b=a[1],u=a[2],h=a[3]);var d=a[4];return[u,h,p,b,d]}function Fl(r){for(var t=!1,e=[],s=0,n=null,i=0,o=0,a=0,u=0,h=0;i0?e[s-1]:-1,o=0,a=0,u=0,h=0,n=null,t=!0)),i++;for(t&&Rr(r),Kl(r),i=1;i=g?(d>=p.length/2||d>=b.length/2)&&(r.splice(i,0,[K,b.substring(0,d)]),r[i-1][1]=p.substring(0,p.length-d),r[i+1][1]=b.substring(d),i++):(g>=p.length/2||g>=b.length/2)&&(r.splice(i,0,[K,p.substring(0,g)]),r[i-1][0]=st,r[i-1][1]=b.substring(0,b.length-g),r[i+1][0]=it,r[i+1][1]=p.substring(g),i++),i++}i++}}var ti=/[^a-zA-Z0-9]/,ei=/\s/,si=/[\r\n]/,Vl=/\n\r?\n$/,zl=/^\r?\n\r?\n/;function Kl(r){function t(g,m){if(!g||!m)return 6;var y=g.charAt(g.length-1),N=m.charAt(0),v=y.match(ti),E=N.match(ti),x=v&&y.match(ei),k=E&&N.match(ei),L=x&&y.match(si),I=k&&N.match(si),M=L&&g.match(Vl),$=I&&m.match(zl);return M||$?5:L||I?4:v&&!x&&k?3:x||k?2:v||E?1:0}for(var e=1;e=b&&(b=d,u=s,h=n,p=i)}r[e-1][1]!=u&&(u?r[e-1][1]=u:(r.splice(e-1,1),e--),r[e][1]=h,p?r[e+1][1]=p:(r.splice(e+1,1),e--))}e++}}function Rr(r,t){r.push([K,""]);for(var e=0,s=0,n=0,i="",o="",a;e=0&&Mi(r[u][1])){var h=r[u][1].slice(-1);if(r[u][1]=r[u][1].slice(0,-1),i=h+i,o=h+o,!r[u][1]){r.splice(u,1),e--;var p=u-1;r[p]&&r[p][0]===st&&(n++,o=r[p][1]+o,p--),r[p]&&r[p][0]===it&&(s++,i=r[p][1]+i,p--),u=p}}if(Bi(r[e][1])){var h=r[e][1].charAt(0);r[e][1]=r[e][1].slice(1),i+=h,o+=h}}if(e0||o.length>0){i.length>0&&o.length>0&&(a=Ir(o,i),a!==0&&(u>=0?r[u][1]+=o.substring(0,a):(r.splice(0,0,[K,o.substring(0,a)]),e++),o=o.substring(a),i=i.substring(a)),a=tn(o,i),a!==0&&(r[e][1]=o.substring(o.length-a)+r[e][1],o=o.substring(0,o.length-a),i=i.substring(0,i.length-a)));var b=n+s;i.length===0&&o.length===0?(r.splice(e-b,b),e=e-b):i.length===0?(r.splice(e-b,b,[st,o]),e=e-b+1):o.length===0?(r.splice(e-b,b,[it,i]),e=e-b+1):(r.splice(e-b,b,[it,i],[st,o]),e=e-b+2)}e!==0&&r[e-1][0]===K?(r[e-1][1]+=r[e][1],r.splice(e,1)):e++,n=0,s=0,i="",o="";break}}r[r.length-1][1]===""&&r.pop();var d=!1;for(e=1;e=55296&&r<=56319}function Ri(r){return r>=56320&&r<=57343}function Bi(r){return Ri(r.charCodeAt(0))}function Mi(r){return Ii(r.charCodeAt(r.length-1))}function Gl(r){for(var t=[],e=0;e0&&t.push(r[e]);return t}function nr(r,t,e,s){return Mi(r)||Bi(s)?null:Gl([[K,r],[it,t],[st,e],[K,s]])}function Zl(r,t,e){var s=typeof e=="number"?{index:e,length:0}:e.oldRange,n=typeof e=="number"?null:e.newRange,i=r.length,o=t.length;if(s.length===0&&(n===null||n.length===0)){var a=s.index,u=r.slice(0,a),h=r.slice(a),p=n?n.index:null;t:{var b=a+o-i;if(p!==null&&p!==b||b<0||b>o)break t;var d=t.slice(0,b),g=t.slice(b);if(g!==h)break t;var m=Math.min(a,b),y=u.slice(0,m),N=d.slice(0,m);if(y!==N)break t;var v=u.slice(m),E=d.slice(m);return nr(y,v,E,h)}t:{if(p!==null&&p!==a)break t;var x=a,d=t.slice(0,x),g=t.slice(x);if(d!==u)break t;var k=Math.min(i-x,o-x),L=h.slice(h.length-k),I=g.slice(g.length-k);if(L!==I)break t;var v=h.slice(0,h.length-k),E=g.slice(0,g.length-k);return nr(u,v,E,L)}}if(s.length>0&&n&&n.length===0)t:{var y=r.slice(0,s.index),L=r.slice(s.index+s.length),m=y.length,k=L.length;if(o-1}function Tn(l,c){var f=this.__data__,A=ye(f,l);return A<0?f.push([l,c]):f[A][1]=c,this}G.prototype.clear=Nn,G.prototype.delete=An,G.prototype.get=wn,G.prototype.has=xn,G.prototype.set=Tn;function Y(l){var c=-1,f=l?l.length:0;for(this.clear();++c-1&&l%1==0&&l-1&&l%1==0&&l<=n}function St(l){var c=typeof l;return!!l&&(c=="object"||c=="function")}function js(l){return!!l&&typeof l=="object"}function Je(l){return Ne(l)?be(l):Pn(l)}function Jn(){return[]}function tr(){return!1}r.exports=Bs})(Ys,Ys.exports);var Di=Ys.exports,Xs={exports:{}};Xs.exports;(function(r,t){var e=200,s="__lodash_hash_undefined__",n=1,i=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",h="[object AsyncFunction]",p="[object Boolean]",b="[object Date]",d="[object Error]",g="[object Function]",m="[object GeneratorFunction]",y="[object Map]",N="[object Number]",v="[object Null]",E="[object Object]",x="[object Promise]",k="[object Proxy]",L="[object RegExp]",I="[object Set]",M="[object String]",$="[object Symbol]",B="[object Undefined]",Ft="[object WeakMap]",Qt="[object ArrayBuffer]",Jt="[object DataView]",ps="[object Float32Array]",gs="[object Float64Array]",ms="[object Int8Array]",on="[object Int16Array]",an="[object Int32Array]",cn="[object Uint8Array]",un="[object Uint8ClampedArray]",P="[object Uint16Array]",hn="[object Uint32Array]",fn=/[\\^$.*+?()[\]{}|]/g,dt=/^\[object .+?Constructor\]$/,bs=/^(?:0|[1-9]\d*)$/,H={};H[ps]=H[gs]=H[ms]=H[on]=H[an]=H[cn]=H[un]=H[P]=H[hn]=!0,H[a]=H[u]=H[Qt]=H[p]=H[Jt]=H[b]=H[d]=H[g]=H[y]=H[N]=H[E]=H[L]=H[I]=H[M]=H[Ft]=!1;var ys=typeof Gt=="object"&&Gt&&Gt.Object===Object&&Gt,dn=typeof self=="object"&&self&&self.Object===Object&&self,pt=ys||dn||Function("return this")(),vs=t&&!t.nodeType&&t,Es=vs&&!0&&r&&!r.nodeType&&r,Be=Es&&Es.exports===vs,Me=Be&&ys.process,Ns=function(){try{return Me&&Me.binding&&Me.binding("util")}catch{}}(),De=Ns&&Ns.isTypedArray;function As(l,c){for(var f=-1,A=l==null?0:l.length,R=0,O=[];++f-1}function kn(l,c){var f=this.__data__,A=ve(f,l);return A<0?(++this.size,f.push([l,c])):f[A][1]=c,this}Y.prototype.clear=qn,Y.prototype.delete=Ln,Y.prototype.get=_n,Y.prototype.has=Sn,Y.prototype.set=kn;function nt(l){var c=-1,f=l==null?0:l.length;for(this.clear();++cD))return!1;var j=O.get(l);if(j&&O.get(c))return j==c;var X=-1,rt=!0,z=f&i?new be:void 0;for(O.set(l,c),O.set(c,l);++X-1&&l%1==0&&l-1&&l%1==0&&l<=o}function Us(l){var c=typeof l;return l!=null&&(c=="object"||c=="function")}function St(l){return l!=null&&typeof l=="object"}var js=De?gn(De):Fn;function Je(l){return Xe(l)?Pn(l):Vn(l)}function Jn(){return[]}function tr(){return!1}r.exports=Qn})(Xs,Xs.exports);var Ui=Xs.exports,Br={};Object.defineProperty(Br,"__esModule",{value:!0});const Yl=Di,Xl=Ui;var br;(function(r){function t(i={},o={},a=!1){typeof i!="object"&&(i={}),typeof o!="object"&&(o={});let u=Yl(o);a||(u=Object.keys(u).reduce((h,p)=>(u[p]!=null&&(h[p]=u[p]),h),{}));for(const h in i)i[h]!==void 0&&o[h]===void 0&&(u[h]=i[h]);return Object.keys(u).length>0?u:void 0}r.compose=t;function e(i={},o={}){typeof i!="object"&&(i={}),typeof o!="object"&&(o={});const a=Object.keys(i).concat(Object.keys(o)).reduce((u,h)=>(Xl(i[h],o[h])||(u[h]=o[h]===void 0?null:o[h]),u),{});return Object.keys(a).length>0?a:void 0}r.diff=e;function s(i={},o={}){i=i||{};const a=Object.keys(o).reduce((u,h)=>(o[h]!==i[h]&&i[h]!==void 0&&(u[h]=o[h]),u),{});return Object.keys(i).reduce((u,h)=>(i[h]!==o[h]&&o[h]===void 0&&(u[h]=null),u),a)}r.invert=s;function n(i,o,a=!1){if(typeof i!="object")return o;if(typeof o!="object")return;if(!a)return o;const u=Object.keys(o).reduce((h,p)=>(i[p]===void 0&&(h[p]=o[p]),h),{});return Object.keys(u).length>0?u:void 0}r.transform=n})(br||(br={}));Br.default=br;var sn={};Object.defineProperty(sn,"__esModule",{value:!0});var yr;(function(r){function t(e){return typeof e.delete=="number"?e.delete:typeof e.retain=="number"?e.retain:typeof e.retain=="object"&&e.retain!==null?1:typeof e.insert=="string"?e.insert.length:1}r.length=t})(yr||(yr={}));sn.default=yr;var Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});const ni=sn;class Ql{constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const e=this.ops[this.index];if(e){const s=this.offset,n=ni.default.length(e);if(t>=n-s?(t=n-s,this.index+=1,this.offset=0):this.offset+=t,typeof e.delete=="number")return{delete:t};{const i={};return e.attributes&&(i.attributes=e.attributes),typeof e.retain=="number"?i.retain=t:typeof e.retain=="object"&&e.retain!==null?i.retain=e.retain:typeof e.insert=="string"?i.insert=e.insert.substr(s,t):i.insert=e.insert,i}}else return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?ni.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const t=this.ops[this.index];return t?typeof t.delete=="number"?"delete":typeof t.retain=="number"||typeof t.retain=="object"&&t.retain!==null?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);{const t=this.offset,e=this.index,s=this.next(),n=this.ops.slice(this.index);return this.offset=t,this.index=e,[s].concat(n)}}else return[]}}Mr.default=Ql;(function(r,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const e=Wl,s=Di,n=Ui,i=Br;t.AttributeMap=i.default;const o=sn;t.Op=o.default;const a=Mr;t.OpIterator=a.default;const u="\0",h=(b,d)=>{if(typeof b!="object"||b===null)throw new Error(`cannot retain a ${typeof b}`);if(typeof d!="object"||d===null)throw new Error(`cannot retain a ${typeof d}`);const g=Object.keys(b)[0];if(!g||g!==Object.keys(d)[0])throw new Error(`embed types not matched: ${g} != ${Object.keys(d)[0]}`);return[g,b[g],d[g]]};class p{constructor(d){Array.isArray(d)?this.ops=d:d!=null&&Array.isArray(d.ops)?this.ops=d.ops:this.ops=[]}static registerEmbed(d,g){this.handlers[d]=g}static unregisterEmbed(d){delete this.handlers[d]}static getHandler(d){const g=this.handlers[d];if(!g)throw new Error(`no handlers for embed type "${d}"`);return g}insert(d,g){const m={};return typeof d=="string"&&d.length===0?this:(m.insert=d,g!=null&&typeof g=="object"&&Object.keys(g).length>0&&(m.attributes=g),this.push(m))}delete(d){return d<=0?this:this.push({delete:d})}retain(d,g){if(typeof d=="number"&&d<=0)return this;const m={retain:d};return g!=null&&typeof g=="object"&&Object.keys(g).length>0&&(m.attributes=g),this.push(m)}push(d){let g=this.ops.length,m=this.ops[g-1];if(d=s(d),typeof m=="object"){if(typeof d.delete=="number"&&typeof m.delete=="number")return this.ops[g-1]={delete:m.delete+d.delete},this;if(typeof m.delete=="number"&&d.insert!=null&&(g-=1,m=this.ops[g-1],typeof m!="object"))return this.ops.unshift(d),this;if(n(d.attributes,m.attributes)){if(typeof d.insert=="string"&&typeof m.insert=="string")return this.ops[g-1]={insert:m.insert+d.insert},typeof d.attributes=="object"&&(this.ops[g-1].attributes=d.attributes),this;if(typeof d.retain=="number"&&typeof m.retain=="number")return this.ops[g-1]={retain:m.retain+d.retain},typeof d.attributes=="object"&&(this.ops[g-1].attributes=d.attributes),this}}return g===this.ops.length?this.ops.push(d):this.ops.splice(g,0,d),this}chop(){const d=this.ops[this.ops.length-1];return d&&typeof d.retain=="number"&&!d.attributes&&this.ops.pop(),this}filter(d){return this.ops.filter(d)}forEach(d){this.ops.forEach(d)}map(d){return this.ops.map(d)}partition(d){const g=[],m=[];return this.forEach(y=>{(d(y)?g:m).push(y)}),[g,m]}reduce(d,g){return this.ops.reduce(d,g)}changeLength(){return this.reduce((d,g)=>g.insert?d+o.default.length(g):g.delete?d-g.delete:d,0)}length(){return this.reduce((d,g)=>d+o.default.length(g),0)}slice(d=0,g=1/0){const m=[],y=new a.default(this.ops);let N=0;for(;N0&&m.next(N.retain-E)}const v=new p(y);for(;g.hasNext()||m.hasNext();)if(m.peekType()==="insert")v.push(m.next());else if(g.peekType()==="delete")v.push(g.next());else{const E=Math.min(g.peekLength(),m.peekLength()),x=g.next(E),k=m.next(E);if(k.retain){const L={};if(typeof x.retain=="number")L.retain=typeof k.retain=="number"?E:k.retain;else if(typeof k.retain=="number")x.retain==null?L.insert=x.insert:L.retain=x.retain;else{const M=x.retain==null?"insert":"retain",[$,B,Ft]=h(x[M],k.retain),Qt=p.getHandler($);L[M]={[$]:Qt.compose(B,Ft,M==="retain")}}const I=i.default.compose(x.attributes,k.attributes,typeof x.retain=="number");if(I&&(L.attributes=I),v.push(L),!m.hasNext()&&n(v.ops[v.ops.length-1],L)){const M=new p(g.rest());return v.concat(M).chop()}}else typeof k.delete=="number"&&(typeof x.retain=="number"||typeof x.retain=="object"&&x.retain!==null)&&v.push(k)}return v.chop()}concat(d){const g=new p(this.ops.slice());return d.ops.length>0&&(g.push(d.ops[0]),g.ops=g.ops.concat(d.ops.slice(1))),g}diff(d,g){if(this.ops===d.ops)return new p;const m=[this,d].map(x=>x.map(k=>{if(k.insert!=null)return typeof k.insert=="string"?k.insert:u;const L=x===d?"on":"with";throw new Error("diff() called "+L+" non-document")}).join("")),y=new p,N=e(m[0],m[1],g,!0),v=new a.default(this.ops),E=new a.default(d.ops);return N.forEach(x=>{let k=x[1].length;for(;k>0;){let L=0;switch(x[0]){case e.INSERT:L=Math.min(E.peekLength(),k),y.push(E.next(L));break;case e.DELETE:L=Math.min(k,v.peekLength()),v.next(L),y.delete(L);break;case e.EQUAL:L=Math.min(v.peekLength(),E.peekLength(),k);const I=v.next(L),M=E.next(L);n(I.insert,M.insert)?y.retain(L,i.default.diff(I.attributes,M.attributes)):y.push(M).delete(L);break}k-=L}}),y.chop()}eachLine(d,g=` `){const m=new a.default(this.ops);let y=new p,N=0;for(;m.hasNext();){if(m.peekType()!=="insert")return;const v=m.peek(),E=o.default.length(v)-m.peekLength(),x=typeof v.insert=="string"?v.insert.indexOf(g,E)-E:-1;if(x<0)y.push(m.next());else if(x>0)y.push(m.next(x));else{if(d(y,m.next(1).attributes||{},N)===!1)return;N+=1,y=new p}}y.length()>0&&d(y,{},N)}invert(d){const g=new p;return this.reduce((m,y)=>{if(y.insert)g.delete(o.default.length(y));else{if(typeof y.retain=="number"&&y.attributes==null)return g.retain(y.retain),m+y.retain;if(y.delete||typeof y.retain=="number"){const N=y.delete||y.retain;return d.slice(m,m+N).forEach(E=>{y.delete?g.push(E):y.retain&&y.attributes&&g.retain(o.default.length(E),i.default.invert(y.attributes,E.attributes))}),m+N}else if(typeof y.retain=="object"&&y.retain!==null){const N=d.slice(m,m+1),v=new a.default(N.ops).next(),[E,x,k]=h(y.retain,v.insert),L=p.getHandler(E);return g.retain({[E]:L.invert(x,k)},i.default.invert(y.attributes,v.attributes)),m+1}}return m},0),g.chop()}transform(d,g=!1){if(g=!!g,typeof d=="number")return this.transformPosition(d,g);const m=d,y=new a.default(this.ops),N=new a.default(m.ops),v=new p;for(;y.hasNext()||N.hasNext();)if(y.peekType()==="insert"&&(g||N.peekType()!=="insert"))v.retain(o.default.length(y.next()));else if(N.peekType()==="insert")v.push(N.next());else{const E=Math.min(y.peekLength(),N.peekLength()),x=y.next(E),k=N.next(E);if(x.delete)continue;if(k.delete)v.push(k);else{const L=x.retain,I=k.retain;let M=typeof I=="object"&&I!==null?I:E;if(typeof L=="object"&&L!==null&&typeof I=="object"&&I!==null){const $=Object.keys(L)[0];if($===Object.keys(I)[0]){const B=p.getHandler($);B&&(M={[$]:B.transform(L[$],I[$],g)})}}v.retain(M,i.default.transform(x.attributes,k.attributes,g))}}return v.chop()}transformPosition(d,g=!1){g=!!g;const m=new a.default(this.ops);let y=0;for(;m.hasNext()&&y<=d;){const N=m.peekLength(),v=m.peekType();if(m.next(),v==="delete"){d-=Math.min(N,d-y);continue}else v==="insert"&&(y":">",'"':""","'":"'"};function nn(r){return r.replace(/[&<>"']/g,t=>Jl[t])}const Ct=class Ct extends Cr{static compare(t,e){const s=Ct.order.indexOf(t),n=Ct.order.indexOf(e);return s>=0||n>=0?s-n:t===e?0:t0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};q(Ct,"allowedChildren",[Ct,xt,lt,At]),q(Ct,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let Rt=Ct;const ri=1;class W extends is{constructor(){super(...arguments);q(this,"cache",{})}delta(){return this.cache.delta==null&&(this.cache.delta=ji(this)),this.cache.delta}deleteAt(e,s){super.deleteAt(e,s),this.cache={}}formatAt(e,s,n,i){s<=0||(this.scroll.query(n,C.BLOCK)?e+s===this.length()&&this.format(n,i):super.formatAt(e,Math.min(s,this.length()-e-1),n,i),this.cache={})}insertAt(e,s,n){if(n!=null){super.insertAt(e,s,n),this.cache={};return}if(s.length===0)return;const i=s.split(` `),o=i.shift();o.length>0&&(e(a=a.split(u,!0),a.insertAt(0,h),h.length),e+o.length)}insertBefore(e,s){const{head:n}=this.children;super.insertBefore(e,s),n instanceof xt&&n.remove(),this.cache={}}length(){return this.cache.length==null&&(this.cache.length=super.length()+ri),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()-ri)){const i=this.clone();return e===0?(this.parent.insertBefore(i,this),this):(this.parent.insertBefore(i,this.next),i)}const n=super.split(e,s);return this.cache={},n}}W.blotName="block";W.tagName="P";W.defaultChild=xt;W.allowedChildren=[xt,Rt,lt,At];class ht extends lt{attach(){super.attach(),this.attributes=new Qs(this.domNode)}delta(){return new S().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const s=this.scroll.query(t,C.BLOCK_ATTRIBUTE);s!=null&&this.attributes.attribute(s,e)}formatAt(t,e,s,n){this.format(s,n)}insertAt(t,e,s){if(s!=null){super.insertAt(t,e,s);return}const n=e.split(` `),i=n.pop(),o=n.map(u=>{const h=this.scroll.create(W.blotName);return h.insertAt(0,u),h}),a=this.split(t);o.forEach(u=>{this.parent.insertBefore(u,a)}),i&&this.parent.insertBefore(this.scroll.create("text",i),a)}}ht.scope=C.BLOCK_BLOT;function ji(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return r.descendants(J).reduce((e,s)=>s.length()===0?e:e.insert(s.value(),ct(s,{},t)),new S).insert(` `,ct(r))}function ct(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return r==null||("formats"in r&&typeof r.formats=="function"&&(t={...t,...r.formats()},e&&delete t["code-token"]),r.parent==null||r.parent.statics.blotName==="scroll"||r.parent.statics.scope!==r.statics.scope)?t:ct(r.parent,t,e)}const at=class at extends lt{static value(){}constructor(t,e,s){super(t,e),this.selection=s,this.textNode=document.createTextNode(at.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,n=0;for(;s!=null&&s.statics.scope!==C.BLOCK_BLOT;)n+=s.offset(s.parent),s=s.parent;s!=null&&(this.savedLength=at.CONTENTS.length,s.optimize(),s.formatAt(n,at.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 At?this.prev:null,s=e?e.length():0,n=this.next instanceof At?this.next:null,i=n?n.text:"",{textNode:o}=this,a=o.data.split(at.CONTENTS).join("");o.data=at.CONTENTS;let u;if(e)u=e,(a||n)&&(e.insertAt(e.length(),a+i),n&&n.remove());else if(n)u=n,n.insertAt(0,a);else{const h=document.createTextNode(a);u=this.scroll.create(h),this.parent.insertBefore(u,this)}if(this.remove(),t){const h=(d,g)=>e&&d===e.domNode?g:d===o?s+g-1:n&&d===n.domNode?s+a.length+g:null,p=h(t.start.node,t.start.offset),b=h(t.end.node,t.end.offset);if(p!==null&&b!==null)return{startNode:u.domNode,startOffset:p,endNode:u.domNode,endOffset:b}}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=at.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}};q(at,"blotName","cursor"),q(at,"className","ql-cursor"),q(at,"tagName","span"),q(at,"CONTENTS","\uFEFF");let Oe=at;var Pi={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function n(u,h,p){this.fn=u,this.context=h,this.once=p||!1}function i(u,h,p,b,d){if(typeof p!="function")throw new TypeError("The listener must be a function");var g=new n(p,b||u,d),m=e?e+h:h;return u._events[m]?u._events[m].fn?u._events[m]=[u._events[m],g]:u._events[m].push(g):(u._events[m]=g,u._eventsCount++),u}function o(u,h){--u._eventsCount===0?u._events=new s:delete u._events[h]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var h=[],p,b;if(this._eventsCount===0)return h;for(b in p=this._events)t.call(p,b)&&h.push(e?b.slice(1):b);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(p)):h},a.prototype.listeners=function(h){var p=e?e+h:h,b=this._events[p];if(!b)return[];if(b.fn)return[b.fn];for(var d=0,g=b.length,m=new Array(g);d1?t-1:0),s=1;s(t[e]=Hi.bind(console,e,r),t),{})}$t.level=r=>{Nr=r};Hi.level=$t.level;const rr=$t("quill:events"),so=["selectionchange","mousedown","mouseup","click"];so.forEach(r=>{document.addEventListener(r,function(){for(var t=arguments.length,e=new Array(t),s=0;s{const i=vr.get(n);i&&i.emitter&&i.emitter.handleDOM(...e)})})});class _ extends eo{constructor(){super(),this.domListeners={},this.on("error",rr.error)}emit(){for(var t=arguments.length,e=new Array(t),s=0;s1?e-1:0),n=1;n{let{node:o,handler:a}=i;(t.target===o||o.contains(t.target))&&a(t,...s)})}listenDOM(t,e,s){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:s})}}q(_,"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"}),q(_,"sources",{API:"api",SILENT:"silent",USER:"user"});const ir=$t("quill:selection");class oe{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=t,this.length=e}}class no{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 oe(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,_.sources.USER),1)}),this.emitter.on(_.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const s=this.getNativeRange();s!=null&&s.start.node!==this.cursor.textNode&&this.emitter.once(_.events.SCROLL_UPDATE,(n,i)=>{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 o=i.some(a=>a.type==="characterData"||a.type==="childList"||a.type==="attributes"&&a.target===this.root);this.update(o?_.sources.SILENT:n)}catch{}})}),this.emitter.on(_.events.SCROLL_OPTIMIZE,(s,n)=>{if(n.range){const{startNode:i,startOffset:o,endNode:a,endOffset:u}=n.range;this.setNativeRange(i,o,a,u),this.update(_.sources.SILENT)}}),this.update(_.sources.SILENT)}handleComposition(){this.emitter.on(_.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(_.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(_.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const s=this.getNativeRange();if(!(s==null||!s.native.collapsed||this.scroll.query(t,C.BLOCK))){if(s.start.node!==this.cursor.textNode){const n=this.scroll.find(s.start.node,!1);if(n==null)return;if(n instanceof J){const i=n.split(s.start.offset);n.parent.insertBefore(this.cursor,i)}else n.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 n,[i,o]=this.scroll.leaf(t);if(i==null)return null;if(e>0&&o===i.length()){const[p]=this.scroll.leaf(t+1);if(p){const[b]=this.scroll.line(t),[d]=this.scroll.line(t+1);b===d&&(i=p,o=0)}}[n,o]=i.position(o,!0);const a=document.createRange();if(e>0)return a.setStart(n,o),[i,o]=this.scroll.leaf(t+e),i==null?null:([n,o]=i.position(o,!0),a.setEnd(n,o),a.getBoundingClientRect());let u="left",h;if(n instanceof Text){if(!n.data.length)return null;o0&&(u="right")}return{bottom:h.top+h.height,height:h.height,left:h[u],right:h[u],top:h.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 ir.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&&lr(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(o=>{const[a,u]=o,h=this.scroll.find(a,!0),p=h.offset(this.scroll);return u===0?p:h instanceof J?p+h.index(a,u):p+h.length()}),n=Math.min(Math.max(...s),this.scroll.length()-1),i=Math.min(n,...s);return new oe(i,n-i)}normalizeNative(t){if(!lr(this.root,t.startContainer)||!t.collapsed&&!lr(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:n,offset:i}=s;for(;!(n instanceof Text)&&n.childNodes.length>0;)if(n.childNodes.length>i)n=n.childNodes[i],i=0;else if(n.childNodes.length===i)n=n.lastChild,n instanceof Text?i=n.data.length:n.childNodes.length>0?i=n.childNodes.length:i=n.childNodes.length+1;else break;s.node=n,s.offset=i}),e}rangeToNative(t){const e=this.scroll.length(),s=(n,i)=>{n=Math.min(e-1,n);const[o,a]=this.scroll.leaf(n);return o?o.position(a,i):[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,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:e,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(ir.info("setNativeRange",t,e,s,n),t!=null&&(this.root.parentNode==null||t.parentNode==null||s.parentNode==null))return;const o=document.getSelection();if(o!=null)if(t!=null){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:a}=this.getNativeRange()||{};if(a==null||i||t!==a.startContainer||e!==a.startOffset||s!==a.endContainer||n!==a.endOffset){t instanceof Element&&t.tagName==="BR"&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),s instanceof Element&&s.tagName==="BR"&&(n=Array.from(s.parentNode.childNodes).indexOf(s),s=s.parentNode);const u=document.createRange();u.setStart(t,e),u.setEnd(s,n),o.removeAllRanges(),o.addRange(u)}}else o.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]:_.sources.API;if(typeof e=="string"&&(s=e,e=!1),ir.info("setRange",t),t!=null){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(s)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_.sources.USER;const e=this.lastRange,[s,n]=this.getRange();if(this.lastRange=s,this.lastNative=n,this.lastRange!=null&&(this.savedRange=this.lastRange),!kr(e,this.lastRange)){if(!this.composing&&n!=null&&n.native.collapsed&&n.start.node!==this.cursor.textNode){const o=this.cursor.restore();o&&this.setNativeRange(o.startNode,o.startOffset,o.endNode,o.endOffset)}const i=[_.events.SELECTION_CHANGE,_e(this.lastRange),_e(e),t];this.emitter.emit(_.events.EDITOR_CHANGE,...i),t!==_.sources.SILENT&&this.emitter.emit(...i)}}}function lr(r,t){try{t.parentNode}catch{return!1}return r.contains(t)}const ro=/^[ -~]*$/;class io{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const s=ii(t),n=new S;return oo(s.ops.slice()).reduce((o,a)=>{const u=ft.Op.length(a);let h=a.attributes||{},p=!1,b=!1;if(a.insert!=null){if(n.retain(u),typeof a.insert=="string"){const m=a.insert;b=!m.endsWith(` `)&&(e<=o||!!this.scroll.descendant(ht,o)[0]),this.scroll.insertAt(o,m);const[y,N]=this.scroll.line(o);let v=Yt({},ct(y));if(y instanceof W){const[E]=y.descendant(J,N);E&&(v=Yt(v,ct(E)))}h=ft.AttributeMap.diff(v,h)||{}}else if(typeof a.insert=="object"){const m=Object.keys(a.insert)[0];if(m==null)return o;const y=this.scroll.query(m,C.INLINE)!=null;if(y)(e<=o||this.scroll.descendant(ht,o)[0])&&(b=!0);else if(o>0){const[N,v]=this.scroll.descendant(J,o-1);N instanceof At?N.value()[v]!==` `&&(p=!0):N instanceof lt&&N.statics.scope===C.INLINE_BLOT&&(p=!0)}if(this.scroll.insertAt(o,m,a.insert[m]),y){const[N]=this.scroll.descendant(J,o);if(N){const v=Yt({},ct(N));h=ft.AttributeMap.diff(v,h)||{}}}}e+=u}else if(n.push(a),a.retain!==null&&typeof a.retain=="object"){const m=Object.keys(a.retain)[0];if(m==null)return o;this.scroll.updateEmbedAt(o,m,a.retain[m])}Object.keys(h).forEach(m=>{this.scroll.formatAt(o,u,m,h[m])});const d=p?1:0,g=b?1:0;return e+=d+g,n.retain(d),n.delete(g),o+u+d+g},0),n.reduce((o,a)=>typeof a.delete=="number"?(this.scroll.deleteAt(o,a.delete),o):o+ft.Op.length(a),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(s)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update(new S().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(i=>{this.scroll.lines(t,Math.max(e,1)).forEach(o=>{o.format(i,s[i])})}),this.scroll.optimize();const n=new S().retain(t).retain(e,_e(s));return this.update(n)}formatText(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(s).forEach(i=>{this.scroll.formatAt(t,e,i,s[i])});const n=new S().retain(t).retain(e,_e(s));return this.update(n)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new S)}getFormat(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=[],n=[];e===0?this.scroll.path(t).forEach(a=>{const[u]=a;u instanceof W?s.push(u):u instanceof J&&n.push(u)}):(s=this.scroll.lines(t,e),n=this.scroll.descendants(J,t,e));const[i,o]=[s,n].map(a=>{const u=a.shift();if(u==null)return{};let h=ct(u);for(;Object.keys(h).length>0;){const p=a.shift();if(p==null)return h;h=lo(ct(p),h)}return h});return{...i,...o}}getHTML(t,e){const[s,n]=this.scroll.line(t);if(s){const i=s.length();return s.length()>=n+e&&!(n===0&&e===i)?os(s,n,e,!0):os(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=ii(e),n=new S().retain(t).concat(s);return this.scroll.insertContents(t,s),this.update(n)}insertEmbed(t,e,s){return this.scroll.insertAt(t,e,s),this.update(new S().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(n=>{this.scroll.formatAt(t,e.length,n,s[n])}),this.update(new S().retain(t).insert(e,_e(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 xt}removeFormat(t,e){const s=this.getText(t,e),[n,i]=this.scroll.line(t+e);let o=0,a=new S;n!=null&&(o=n.length()-i,a=n.delta().slice(i,i+o-1).insert(` `));const h=this.getContents(t,e+o).diff(new S().insert(s).concat(a)),p=new S().retain(t).concat(h);return this.applyDelta(p)}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 n=this.delta;if(e.length===1&&e[0].type==="characterData"&&e[0].target.data.match(ro)&&this.scroll.find(e[0].target)){const i=this.scroll.find(e[0].target),o=ct(i),a=i.offset(this.scroll),u=e[0].oldValue.replace(Oe.CONTENTS,""),h=new S().insert(u),p=new S().insert(i.value()),b=s&&{oldRange:li(s.oldRange,-a),newRange:li(s.newRange,-a)};t=new S().retain(a).concat(h.diff(p,b)).reduce((g,m)=>m.insert?g.insert(m.insert,o):g.push(m),new S),this.delta=n.compose(t)}else this.delta=this.getDelta(),(!t||!kr(n.compose(t),this.delta))&&(t=n.diff(this.delta,s));return t}}function qe(r,t,e){if(r.length===0){const[g]=or(e.pop());return t<=0?``:`${qe([],t-1,e)}`}const[{child:s,offset:n,length:i,indent:o,type:a},...u]=r,[h,p]=or(a);if(o>t)return e.push(a),o===t+1?`<${h}>${os(s,n,i)}${qe(u,o,e)}`:`<${h}>
  • ${qe(r,t+1,e)}`;const b=e[e.length-1];if(o===t&&a===b)return`
  • ${os(s,n,i)}${qe(u,o,e)}`;const[d]=or(e.pop());return`${qe(r,t-1,e)}`}function os(r,t,e){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if("html"in r&&typeof r.html=="function")return r.html(t,e);if(r instanceof At)return nn(r.value().slice(t,t+e)).replaceAll(" "," ");if(r instanceof Nt){if(r.statics.blotName==="list-container"){const h=[];return r.children.forEachAt(t,e,(p,b,d)=>{const g="formats"in p&&typeof p.formats=="function"?p.formats():{};h.push({child:p,offset:b,length:d,indent:g.indent||0,type:g.list})}),qe(h,-1,[])}const n=[];if(r.children.forEachAt(t,e,(h,p,b)=>{n.push(os(h,p,b))}),s||r.statics.blotName==="list")return n.join("");const{outerHTML:i,innerHTML:o}=r.domNode,[a,u]=i.split(`>${o}<`);return a==="${n.join("")}<${u}`:`${a}>${n.join("")}<${u}`}return r.domNode instanceof Element?r.domNode.outerHTML:""}function lo(r,t){return Object.keys(t).reduce((e,s)=>{if(r[s]==null)return e;const n=t[s];return n===r[s]?e[s]=n:Array.isArray(n)?n.indexOf(r[s])<0?e[s]=n.concat([r[s]]):e[s]=n:e[s]=[n,r[s]],e},{})}function or(r){const t=r==="ordered"?"ol":"ul";switch(r){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function ii(r){return r.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 S)}function li(r,t){let{index:e,length:s}=r;return new oe(e+t,s)}function oo(r){const t=[];return r.forEach(e=>{typeof e.insert=="string"?e.insert.split(` `).forEach((n,i)=>{i&&t.push({insert:` `,attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})}):t.push(e)}),t}class Tt{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=t,this.options=e}}q(Tt,"DEFAULTS",{});const $s="\uFEFF";class Dr extends lt{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($s),this.rightGuard=document.createTextNode($s),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 n=t.data.split($s).join("");if(t===this.leftGuard)if(this.prev instanceof At){const i=this.prev.length();this.prev.insertAt(i,n),e={startNode:this.prev.domNode,startOffset:i+n.length}}else s=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(s),this),e={startNode:s,startOffset:n.length};else t===this.rightGuard&&(this.next instanceof At?(this.next.insertAt(0,n),e={startNode:this.next.domNode,startOffset:n.length}):(s=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(s),this.next),e={startNode:s,startOffset:n.length}));return t.data=$s,e}update(t,e){t.forEach(s=>{if(s.type==="characterData"&&(s.target===this.leftGuard||s.target===this.rightGuard)){const n=this.restore(s.target);n&&(e.range=n)}})}}class ao{constructor(t,e){q(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 Dr)&&(this.emitter.emit(_.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(_.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(_.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(_.events.COMPOSITION_END,t),this.isComposing=!1}}const ns=class ns{constructor(t,e){q(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]}};q(ns,"DEFAULTS",{modules:{}}),q(ns,"themes",{default:ns});let Ie=ns;const co=r=>r.parentElement||r.getRootNode().host||null,uo=r=>{const t=r.getBoundingClientRect(),e="offsetWidth"in r&&Math.abs(t.width)/r.offsetWidth||1,s="offsetHeight"in r&&Math.abs(t.height)/r.offsetHeight||1;return{top:t.top,right:t.left+r.clientWidth*e,bottom:t.top+r.clientHeight*s,left:t.left}},Fs=r=>{const t=parseInt(r,10);return Number.isNaN(t)?0:t},oi=(r,t,e,s,n,i)=>rs?0:rs?t-r>s-e?r+n-e:t-s+i:0,ho=(r,t)=>{var i,o,a;const e=r.ownerDocument;let s=t,n=r;for(;n;){const u=n===e.body,h=u?{top:0,right:((i=window.visualViewport)==null?void 0:i.width)??e.documentElement.clientWidth,bottom:((o=window.visualViewport)==null?void 0:o.height)??e.documentElement.clientHeight,left:0}:uo(n),p=getComputedStyle(n),b=oi(s.left,s.right,h.left,h.right,Fs(p.scrollPaddingLeft),Fs(p.scrollPaddingRight)),d=oi(s.top,s.bottom,h.top,h.bottom,Fs(p.scrollPaddingTop),Fs(p.scrollPaddingBottom));if(b||d)if(u)(a=e.defaultView)==null||a.scrollBy(b,d);else{const{scrollLeft:g,scrollTop:m}=n;d&&(n.scrollTop+=d),b&&(n.scrollLeft+=b);const y=n.scrollLeft-g,N=n.scrollTop-m;s={left:s.left-y,top:s.top-N,right:s.right-y,bottom:s.bottom-N}}n=u||p.position==="fixed"?null:co(n)}},fo=100,po=["block","break","cursor","inline","scroll","text"],go=(r,t,e)=>{const s=new Ce;return po.forEach(n=>{const i=t.query(n);i&&s.register(i)}),r.forEach(n=>{let i=t.query(n);i||e.error(`Cannot register "${n}" specified in "formats" config. Are you sure it was registered?`);let o=0;for(;i;)if(s.register(i),i="blotName"in i?i.requiredContainer??null:null,o+=1,o>fo){e.error(`Cycle detected in registering blot requiredContainer: "${n}"`);break}}),s},ke=$t("quill"),Vs=new Ce;Nt.uiClass="ql-ui";const vt=class vt{static debug(t){t===!0&&(t="log"),$t.level(t)}static find(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return vr.get(t)||Vs.find(t,e)}static import(t){return this.imports[t]==null&&ke.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(){if(typeof(arguments.length<=0?void 0:arguments[0])!="string"){const t=arguments.length<=0?void 0:arguments[0],e=!!(!(arguments.length<=1)&&arguments[1]),s="attrName"in t?t.attrName:t.blotName;typeof s=="string"?this.register(`formats/${s}`,t,e):Object.keys(t).forEach(n=>{this.register(n,t[n],e)})}else{const t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],s=!!(!(arguments.length<=2)&&arguments[2]);this.imports[t]!=null&&!s&&ke.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&typeof e!="boolean"&&e.blotName!=="abstract"&&Vs.register(e),typeof e.register=="function"&&e.register(Vs)}}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=mo(t,e),this.container=this.options.container,this.container==null){ke.error("Invalid Quill container",t);return}this.options.debug&&vt.debug(this.options.debug);const s=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",vr.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new _;const n=Or.blotName,i=this.options.registry.query(n);if(!i||!("blotName"in i))throw new Error(`Cannot initialize Quill without "${n}" blot`);if(this.scroll=new i(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new io(this.scroll),this.selection=new no(this.scroll,this.emitter),this.composition=new ao(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(_.events.EDITOR_CHANGE,o=>{o===_.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(_.events.SCROLL_UPDATE,(o,a)=>{const u=this.selection.lastRange,[h]=this.selection.getRange(),p=u&&h?{oldRange:u,newRange:h}:void 0;yt.call(this,()=>this.editor.update(null,a,p),o)}),this.emitter.on(_.events.SCROLL_EMBED_UPDATE,(o,a)=>{const u=this.selection.lastRange,[h]=this.selection.getRange(),p=u&&h?{oldRange:u,newRange:h}:void 0;yt.call(this,()=>{const b=new S().retain(o.offset(this)).retain({[o.statics.blotName]:a});return this.editor.update(b,[],p)},vt.sources.USER)}),s){const o=this.clipboard.convert({html:`${s}


    `,text:` `});this.setContents(o)}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]=jt(t,e,s),yt.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]:_.sources.API;return yt.call(this,()=>{const n=this.getSelection(!0);let i=new S;if(n==null)return i;if(this.scroll.query(t,C.BLOCK))i=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(n.length===0)return this.selection.format(t,e),i;i=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,_.sources.SILENT),i},s)}formatLine(t,e,s,n,i){let o;return[t,e,o,i]=jt(t,e,s,n,i),yt.call(this,()=>this.editor.formatLine(t,e,o),i,t,0)}formatText(t,e,s,n,i){let o;return[t,e,o,i]=jt(t,e,s,n,i),yt.call(this,()=>this.editor.formatText(t,e,o),i,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 n=this.container.getBoundingClientRect();return{bottom:s.bottom-n.top,height:s.height,left:s.left-n.left,right:s.right-n.left,top:s.top-n.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]=jt(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??this.getLength()-t),[t,e]=jt(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??this.getLength()-t),[t,e]=jt(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,s){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:vt.sources.API;return yt.call(this,()=>this.editor.insertEmbed(t,e,s),n,t)}insertText(t,e,s,n,i){let o;return[t,,o,i]=jt(t,0,s,n,i),yt.call(this,()=>this.editor.insertText(t,e,o),i,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]=jt(t,e,s),yt.call(this,()=>this.editor.removeFormat(t,e),s,t)}scrollRectIntoView(t){ho(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]:_.sources.API;return yt.call(this,()=>{t=new S(t);const s=this.getLength(),n=this.editor.deleteText(0,s),i=this.editor.insertContents(0,t),o=this.editor.deleteText(this.getLength()-1,1);return n.compose(i).compose(o)},e)}setSelection(t,e,s){t==null?this.selection.setRange(null,e||vt.sources.API):([t,e,,s]=jt(t,e,s),this.selection.setRange(new oe(Math.max(0,t),e),s),s!==_.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_.sources.API;const s=new S().insert(t);return this.setContents(s,e)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_.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]:_.sources.API;return yt.call(this,()=>(t=new S(t),this.editor.applyDelta(t)),e,!0)}};q(vt,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Vs,theme:"default"}),q(vt,"events",_.events),q(vt,"sources",_.sources),q(vt,"version","2.0.3"),q(vt,"imports",{delta:S,parchment:jl,"core/module":Tt,"core/theme":Ie});let w=vt;function ai(r){return typeof r=="string"?document.querySelector(r):r}function ar(r){return Object.entries(r??{}).reduce((t,e)=>{let[s,n]=e;return{...t,[s]:n===!0?{}:n}},{})}function ci(r){return Object.fromEntries(Object.entries(r).filter(t=>t[1]!==void 0))}function mo(r,t){const e=ai(r);if(!e)throw new Error("Invalid Quill container");const n=!t.theme||t.theme===w.DEFAULTS.theme?Ie:w.import(`themes/${t.theme}`);if(!n)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:i,...o}=w.DEFAULTS,{modules:a,...u}=n.DEFAULTS;let h=ar(t.modules);h!=null&&h.toolbar&&h.toolbar.constructor!==Object&&(h={...h,toolbar:{container:h.toolbar}});const p=Yt({},ar(i),ar(a),h),b={...o,...ci(u),...ci(t)};let d=t.registry;return d?t.formats&&ke.warn('Ignoring "formats" option because "registry" is specified'):d=t.formats?go(t.formats,b.registry,ke):b.registry,{...b,registry:d,container:e,theme:n,modules:Object.entries(p).reduce((g,m)=>{let[y,N]=m;if(!N)return g;const v=w.import(`modules/${y}`);return v==null?(ke.error(`Cannot load ${y} module. Are you sure you registered it?`),g):{...g,[y]:Yt({},v.DEFAULTS||{},N)}},{}),bounds:ai(b.bounds)}}function yt(r,t,e,s){if(!this.isEnabled()&&t===_.sources.USER&&!this.allowReadOnlyEdits)return new S;let n=e==null?null:this.getSelection();const i=this.editor.delta,o=r();if(n!=null&&(e===!0&&(e=n.index),s==null?n=ui(n,o,t):s!==0&&(n=ui(n,e,s,t)),this.setSelection(n,_.sources.SILENT)),o.length()>0){const a=[_.events.TEXT_CHANGE,o,i,t];this.emitter.emit(_.events.EDITOR_CHANGE,...a),t!==_.sources.SILENT&&this.emitter.emit(...a)}return o}function jt(r,t,e,s,n){let i={};return typeof r.index=="number"&&typeof r.length=="number"?typeof t!="number"?(n=s,s=e,e=t,t=r.length,r=r.index):(t=r.length,r=r.index):typeof t!="number"&&(n=s,s=e,e=t,t=0),typeof e=="object"?(i=e,n=s):typeof e=="string"&&(s!=null?i[e]=s:n=e),n=n||_.sources.API,[r,t,i,n]}function ui(r,t,e,s){const n=typeof e=="number"?e:0;if(r==null)return null;let i,o;return t&&typeof t.transformPosition=="function"?[i,o]=[r.index,r.index+r.length].map(a=>t.transformPosition(a,s!==_.sources.USER)):[i,o]=[r.index,r.index+r.length].map(a=>a=0?a+n:Math.max(t,a+n)),new oe(i,o-i)}class ae extends Js{}function hi(r){return r instanceof W||r instanceof ht}function fi(r){return typeof r.updateContent=="function"}class Le extends Or{constructor(t,e,s){let{emitter:n}=s;super(t,e),this.emitter=n,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",i=>this.handleDragStart(i))}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(_.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(_.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(_.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[s,n]=this.line(t),[i]=this.line(t+e);if(super.deleteAt(t,e),i!=null&&s!==i&&n>0){if(s instanceof ht||i instanceof ht){this.optimize();return}const o=i.children.head instanceof xt?null:i.children.head;s.moveChildren(i,o),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,n){super.formatAt(t,e,s,n),this.optimize()}insertAt(t,e,s){if(t>=this.length())if(s==null||this.scroll.query(e,C.BLOCK)==null){const n=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(n),s==null&&e.endsWith(` `)?n.insertAt(0,e.slice(0,-1),s):n.insertAt(0,e,s)}else{const n=this.scroll.create(e,s);this.appendChild(n)}else super.insertAt(t,e,s);this.optimize()}insertBefore(t,e){if(t.statics.scope===C.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 S().insert(` `))),n=s.pop();if(n==null)return;this.batchStart();const i=s.shift();if(i){const u=i.type==="block"&&(i.delta.length()===0||!this.descendant(ht,t)[0]&&t{this.formatAt(b-1,1,m,g[m])}),t=b}let[o,a]=this.children.find(t);if(s.length&&(o&&(o=o.split(a),a=0),s.forEach(u=>{if(u.type==="block"){const h=this.createBlock(u.attributes,o||void 0);cr(h,0,u.delta)}else{const h=this.create(u.key,u.value);this.insertBefore(h,o||void 0),Object.keys(u.attributes).forEach(p=>{h.format(p,u.attributes[p])})}})),n.type==="block"&&n.delta.length()){const u=o?o.offset(o.scroll)+a:this.length();cr(this,u,n.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,n]=e;return s instanceof J?[s,n]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(hi,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=(n,i,o)=>{let a=[],u=o;return n.children.forEachAt(i,o,(h,p,b)=>{hi(h)?a.push(h):h instanceof Js&&(a=a.concat(s(h,p,u))),u-=b}),a};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(_.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=_.sources.USER;typeof t=="string"&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),t=t.filter(s=>{let{target:n}=s;const i=this.find(n,!0);return i&&!fi(i)}),t.length>0&&this.emitter.emit(_.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(_.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,s){const[n]=this.descendant(i=>i instanceof ht,t);n&&n.statics.blotName===e&&fi(n)&&n.updateContent(s)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let s=new S;return t.forEach(n=>{const i=n==null?void 0:n.insert;if(i)if(typeof i=="string"){const o=i.split(` `);o.slice(0,-1).forEach(u=>{s.insert(u,n.attributes),e.push({type:"block",delta:s,attributes:n.attributes??{}}),s=new S});const a=o[o.length-1];a&&s.insert(a,n.attributes)}else{const o=Object.keys(i)[0];if(!o)return;this.query(o,C.INLINE)?s.push(n):(s.length()&&e.push({type:"block",delta:s,attributes:{}}),s=new S,e.push({type:"blockEmbed",key:o,value:i[o],attributes:n.attributes??{}}))}}),s.length()&&e.push({type:"block",delta:s,attributes:{}}),e}createBlock(t,e){let s;const n={};Object.entries(t).forEach(a=>{let[u,h]=a;this.query(u,C.BLOCK&C.BLOT)!=null?s=u:n[u]=h});const i=this.create(s||this.statics.defaultChild.blotName,s?t[s]:void 0);this.insertBefore(i,e||void 0);const o=i.length();return Object.entries(n).forEach(a=>{let[u,h]=a;i.formatAt(0,o,u,h)}),i}}q(Le,"blotName","scroll"),q(Le,"className","ql-editor"),q(Le,"tagName","DIV"),q(Le,"defaultChild",W),q(Le,"allowedChildren",[W,ht,ae]);function cr(r,t,e){e.reduce((s,n)=>{const i=ft.Op.length(n);let o=n.attributes||{};if(n.insert!=null){if(typeof n.insert=="string"){const a=n.insert;r.insertAt(s,a);const[u]=r.descendant(J,s),h=ct(u);o=ft.AttributeMap.diff(h,o)||{}}else if(typeof n.insert=="object"){const a=Object.keys(n.insert)[0];if(a==null)return s;if(r.insertAt(s,a,n.insert[a]),r.scroll.query(a,C.INLINE)!=null){const[h]=r.descendant(J,s),p=ct(h);o=ft.AttributeMap.diff(p,o)||{}}}}return Object.keys(o).forEach(a=>{r.formatAt(s,i,a,o[a])}),s+i},t)}const Ur={scope:C.BLOCK,whitelist:["right","center","justify"]},bo=new It("align","align",Ur),$i=new wt("align","ql-align",Ur),Fi=new Xt("align","text-align",Ur);class Vi extends Xt{value(t){let e=super.value(t);return e.startsWith("rgb(")?(e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),`#${e.split(",").map(n=>`00${parseInt(n,10).toString(16)}`.slice(-2)).join("")}`):e}}const yo=new wt("color","ql-color",{scope:C.INLINE}),jr=new Vi("color","color",{scope:C.INLINE}),vo=new wt("background","ql-bg",{scope:C.INLINE}),Pr=new Vi("background","background-color",{scope:C.INLINE});class ce extends ae{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`
    ${nn(this.code(t,e))}
    
    `}}class tt extends W{static register(){w.register(ce)}}q(tt,"TAB"," ");class Hr extends Rt{}Hr.blotName="code";Hr.tagName="CODE";tt.blotName="code-block";tt.className="ql-code-block";tt.tagName="DIV";ce.blotName="code-block-container";ce.className="ql-code-block-container";ce.tagName="DIV";ce.allowedChildren=[tt];tt.allowedChildren=[At,xt,Oe];tt.requiredContainer=ce;const $r={scope:C.BLOCK,whitelist:["rtl"]},zi=new It("direction","dir",$r),Ki=new wt("direction","ql-direction",$r),Gi=new Xt("direction","direction",$r),Zi={scope:C.INLINE,whitelist:["serif","monospace"]},Wi=new wt("font","ql-font",Zi);class Eo extends Xt{value(t){return super.value(t).replace(/["']/g,"")}}const Yi=new Eo("font","font-family",Zi),Xi=new wt("size","ql-size",{scope:C.INLINE,whitelist:["small","large","huge"]}),Qi=new Xt("size","font-size",{scope:C.INLINE,whitelist:["10px","18px","32px"]}),No=$t("quill:keyboard"),Ao=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class rn extends Tt{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 n=xo(t);if(n==null){No.warn("Attempted to add invalid keyboard binding",n);return}typeof e=="function"&&(e={handler:e}),typeof s=="function"&&(s={handler:s}),(Array.isArray(n.key)?n.key:[n.key]).forEach(o=>{const a={...n,key:o,...e,...s};this.bindings[a.key]=this.bindings[a.key]||[],this.bindings[a.key].push(a)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing||t.keyCode===229&&(t.key==="Enter"||t.key==="Backspace"))return;const n=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(v=>rn.match(t,v));if(n.length===0)return;const i=w.find(t.target,!0);if(i&&i.scroll!==this.quill.scroll)return;const o=this.quill.getSelection();if(o==null||!this.quill.hasFocus())return;const[a,u]=this.quill.getLine(o.index),[h,p]=this.quill.getLeaf(o.index),[b,d]=o.length===0?[h,p]:this.quill.getLeaf(o.index+o.length),g=h instanceof Ws?h.value().slice(0,p):"",m=b instanceof Ws?b.value().slice(d):"",y={collapsed:o.length===0,empty:o.length===0&&a.length()<=1,format:this.quill.getFormat(o),line:a,offset:u,prefix:g,suffix:m,event:t};n.some(v=>{if(v.collapsed!=null&&v.collapsed!==y.collapsed||v.empty!=null&&v.empty!==y.empty||v.offset!=null&&v.offset!==y.offset)return!1;if(Array.isArray(v.format)){if(v.format.every(E=>y.format[E]==null))return!1}else if(typeof v.format=="object"&&!Object.keys(v.format).every(E=>v.format[E]===!0?y.format[E]!=null:v.format[E]===!1?y.format[E]==null:kr(v.format[E],y.format[E])))return!1;return v.prefix!=null&&!v.prefix.test(y.prefix)||v.suffix!=null&&!v.suffix.test(y.suffix)?!1:v.handler.call(this,o,y,v)!==!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 n={};const[i]=this.quill.getLine(t.index);let o=new S().retain(t.index-s).delete(s);if(e.offset===0){const[a]=this.quill.getLine(t.index-1);if(a&&!(a.statics.blotName==="block"&&a.length()<=1)){const h=i.formats(),p=this.quill.getFormat(t.index-1,1);if(n=ft.AttributeMap.diff(h,p)||{},Object.keys(n).length>0){const b=new S().retain(t.index+i.length()-2).retain(1,n);o=o.compose(b)}}}this.quill.updateContents(o,w.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 n={};const[i]=this.quill.getLine(t.index);let o=new S().retain(t.index).delete(s);if(e.offset>=i.length()-1){const[a]=this.quill.getLine(t.index+1);if(a){const u=i.formats(),h=this.quill.getFormat(t.index,1);n=ft.AttributeMap.diff(u,h)||{},Object.keys(n).length>0&&(o=o.retain(a.length()-1).retain(1,n))}}this.quill.updateContents(o,w.sources.USER),this.quill.focus()}handleDeleteRange(t){Fr({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const s=Object.keys(e.format).reduce((i,o)=>(this.quill.scroll.query(o,C.BLOCK)&&!Array.isArray(e.format[o])&&(i[o]=e.format[o]),i),{}),n=new S().retain(t.index).delete(t.length).insert(` `,s);this.quill.updateContents(n,w.sources.USER),this.quill.setSelection(t.index+1,w.sources.SILENT),this.quill.focus()}}const wo={bindings:{bold:ur("bold"),italic:ur("italic"),underline:ur("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(r,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","+1",w.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(r,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","-1",w.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(r,t){t.format.indent!=null?this.quill.format("indent","-1",w.sources.USER):t.format.list!=null&&this.quill.format("list",!1,w.sources.USER)}},"indent code-block":di(!0),"outdent code-block":di(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(r){this.quill.deleteText(r.index-1,1,w.sources.USER)}},tab:{key:"Tab",handler(r,t){if(t.format.table)return!0;this.quill.history.cutoff();const e=new S().retain(r.index).delete(r.length).insert(" ");return this.quill.updateContents(e,w.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(r.index+1,w.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,w.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(r,t){const e={list:!1};t.format.indent&&(e.indent=!1),this.quill.formatLine(r.index,r.length,e,w.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(r){const[t,e]=this.quill.getLine(r.index),s={...t.formats(),list:"checked"},n=new S().retain(r.index).insert(` `,s).retain(t.length()-e-1).retain(1,{list:"unchecked"});this.quill.updateContents(n,w.sources.USER),this.quill.setSelection(r.index+1,w.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(r,t){const[e,s]=this.quill.getLine(r.index),n=new S().retain(r.index).insert(` `,t.format).retain(e.length()-s-1).retain(1,{header:null});this.quill.updateContents(n,w.sources.USER),this.quill.setSelection(r.index+1,w.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(r){const t=this.quill.getModule("table");if(t){const[e,s,n,i]=t.getTable(r),o=To(e,s,n,i);if(o==null)return;let a=e.offset();if(o<0){const u=new S().retain(a).insert(` `);this.quill.updateContents(u,w.sources.USER),this.quill.setSelection(r.index+1,r.length,w.sources.SILENT)}else if(o>0){a+=e.length();const u=new S().retain(a).insert(` `);this.quill.updateContents(u,w.sources.USER),this.quill.setSelection(a,w.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(r,t){const{event:e,line:s}=t,n=s.offset(this.quill.scroll);e.shiftKey?this.quill.setSelection(n-1,w.sources.USER):this.quill.setSelection(n+s.length(),w.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(r,t){if(this.quill.scroll.query("list")==null)return!0;const{length:e}=t.prefix,[s,n]=this.quill.getLine(r.index);if(n>e)return!0;let i;switch(t.prefix.trim()){case"[]":case"[ ]":i="unchecked";break;case"[x]":i="checked";break;case"-":case"*":i="bullet";break;default:i="ordered"}this.quill.insertText(r.index," ",w.sources.USER),this.quill.history.cutoff();const o=new S().retain(r.index-n).delete(e+1).retain(s.length()-2-n).retain(1,{list:i});return this.quill.updateContents(o,w.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(r.index-e,w.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(r){const[t,e]=this.quill.getLine(r.index);let s=2,n=t;for(;n!=null&&n.length()<=1&&n.formats()["code-block"];)if(n=n.prev,s-=1,s<=0){const i=new S().retain(r.index+t.length()-e-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(i,w.sources.USER),this.quill.setSelection(r.index-1,w.sources.SILENT),!1}return!0}},"embed left":zs("ArrowLeft",!1),"embed left shift":zs("ArrowLeft",!0),"embed right":zs("ArrowRight",!1),"embed right shift":zs("ArrowRight",!0),"table down":pi(!1),"table up":pi(!0)}};rn.DEFAULTS=wo;function di(r){return{key:"Tab",shiftKey:!r,format:{"code-block":!0},handler(t,e){let{event:s}=e;const n=this.quill.scroll.query("code-block"),{TAB:i}=n;if(t.length===0&&!s.shiftKey){this.quill.insertText(t.index,i,w.sources.USER),this.quill.setSelection(t.index+i.length,w.sources.SILENT);return}const o=t.length===0?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:a,length:u}=t;o.forEach((h,p)=>{r?(h.insertAt(0,i),p===0?a+=i.length:u+=i.length):h.domNode.textContent.startsWith(i)&&(h.deleteAt(0,i.length),p===0?a-=i.length:u-=i.length)}),this.quill.update(w.sources.USER),this.quill.setSelection(a,u,w.sources.SILENT)}}}function zs(r,t){return{key:r,shiftKey:t,altKey:null,[r==="ArrowLeft"?"prefix":"suffix"]:/^$/,handler(s){let{index:n}=s;r==="ArrowRight"&&(n+=s.length+1);const[i]=this.quill.getLeaf(n);return i instanceof lt?(r==="ArrowLeft"?t?this.quill.setSelection(s.index-1,s.length+1,w.sources.USER):this.quill.setSelection(s.index-1,w.sources.USER):t?this.quill.setSelection(s.index,s.length+1,w.sources.USER):this.quill.setSelection(s.index+s.length+1,w.sources.USER),!1):!0}}}function ur(r){return{key:r[0],shortKey:!0,handler(t,e){this.quill.format(r,!e.format[r],w.sources.USER)}}}function pi(r){return{key:r?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,e){const s=r?"prev":"next",n=e.line,i=n.parent[s];if(i!=null){if(i.statics.blotName==="table-row"){let o=i.children.head,a=n;for(;a.prev!=null;)a=a.prev,o=o.next;const u=o.offset(this.quill.scroll)+Math.min(e.offset,o.length()-1);this.quill.setSelection(u,0,w.sources.USER)}}else{const o=n.table()[s];o!=null&&(r?this.quill.setSelection(o.offset(this.quill.scroll)+o.length()-1,0,w.sources.USER):this.quill.setSelection(o.offset(this.quill.scroll),0,w.sources.USER))}return!1}}}function xo(r){if(typeof r=="string"||typeof r=="number")r={key:r};else if(typeof r=="object")r=_e(r);else return null;return r.shortKey&&(r[Ao]=r.shortKey,delete r.shortKey),r}function Fr(r){let{quill:t,range:e}=r;const s=t.getLines(e);let n={};if(s.length>1){const i=s[0].formats(),o=s[s.length-1].formats();n=ft.AttributeMap.diff(o,i)||{}}t.deleteText(e,w.sources.USER),Object.keys(n).length>0&&t.formatLine(e.index,1,n,w.sources.USER),t.setSelection(e.index,w.sources.SILENT)}function To(r,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 qo=/font-weight:\s*normal/,Lo=["P","OL","UL"],gi=r=>r&&Lo.includes(r.tagName),_o=r=>{Array.from(r.querySelectorAll("br")).filter(t=>gi(t.previousElementSibling)&&gi(t.nextElementSibling)).forEach(t=>{var e;(e=t.parentNode)==null||e.removeChild(t)})},So=r=>{Array.from(r.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return(e=t.getAttribute("style"))==null?void 0:e.match(qo)}).forEach(t=>{var s;const e=r.createDocumentFragment();e.append(...t.childNodes),(s=t.parentNode)==null||s.replaceChild(e,t)})};function ko(r){r.querySelector('[id^="docs-internal-guid-"]')&&(So(r),_o(r))}const Co=/\bmso-list:[^;]*ignore/i,Oo=/\bmso-list:[^;]*\bl(\d+)/i,Io=/\bmso-list:[^;]*\blevel(\d+)/i,Ro=(r,t)=>{const e=r.getAttribute("style"),s=e==null?void 0:e.match(Oo);if(!s)return null;const n=Number(s[1]),i=e==null?void 0:e.match(Io),o=i?Number(i[1]):1,a=new RegExp(`@list l${n}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),u=t.match(a),h=u&&u[1]==="bullet"?"bullet":"ordered";return{id:n,indent:o,type:h,element:r}},Bo=r=>{var o,a;const t=Array.from(r.querySelectorAll("[style*=mso-list]")),e=[],s=[];t.forEach(u=>{(u.getAttribute("style")||"").match(Co)?e.push(u):s.push(u)}),e.forEach(u=>{var h;return(h=u.parentNode)==null?void 0:h.removeChild(u)});const n=r.documentElement.innerHTML,i=s.map(u=>Ro(u,n)).filter(u=>u);for(;i.length;){const u=[];let h=i.shift();for(;h;)u.push(h),h=i.length&&((o=i[0])==null?void 0:o.element)===h.element.nextElementSibling&&i[0].id===h.id?i.shift():null;const p=document.createElement("ul");u.forEach(g=>{const m=document.createElement("li");m.setAttribute("data-list",g.type),g.indent>1&&m.setAttribute("class",`ql-indent-${g.indent-1}`),m.innerHTML=g.element.innerHTML,p.appendChild(m)});const b=(a=u[0])==null?void 0:a.element,{parentNode:d}=b??{};b&&(d==null||d.replaceChild(p,b)),u.slice(1).forEach(g=>{let{element:m}=g;d==null||d.removeChild(m)})}};function Mo(r){r.documentElement.getAttribute("xmlns:w")==="urn:schemas-microsoft-com:office:word"&&Bo(r)}const Do=[Mo,ko],Uo=r=>{r.documentElement&&Do.forEach(t=>{t(r)})},jo=$t("quill:clipboard"),Po=[[Node.TEXT_NODE,Qo],[Node.TEXT_NODE,bi],["br",zo],[Node.ELEMENT_NODE,bi],[Node.ELEMENT_NODE,Vo],[Node.ELEMENT_NODE,Fo],[Node.ELEMENT_NODE,Yo],["li",Zo],["ol, ul",Wo],["pre",Ko],["tr",Xo],["b",hr("bold")],["i",hr("italic")],["strike",hr("strike")],["style",Go]],Ho=[bo,zi].reduce((r,t)=>(r[t.keyName]=t,r),{}),mi=[Fi,Pr,jr,Gi,Yi,Qi].reduce((r,t)=>(r[t.keyName]=t,r),{});class Ji extends Tt{constructor(t,e){super(t,e),this.quill.root.addEventListener("copy",s=>this.onCaptureCopy(s,!1)),this.quill.root.addEventListener("cut",s=>this.onCaptureCopy(s,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Po.concat(this.options.matchers??[]).forEach(s=>{let[n,i]=s;this.addMatcher(n,i)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:s}=t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n[tt.blotName])return new S().insert(s||"",{[tt.blotName]:n[tt.blotName]});if(!e)return new S().insert(s||"",n);const i=this.convertHTML(e);return us(i,` `)&&(i.ops[i.ops.length-1].attributes==null||n.table)?i.compose(new S().retain(i.length()-1).delete(1)):i}normalizeHTML(t){Uo(t)}convertHTML(t){const e=new DOMParser().parseFromString(t,"text/html");this.normalizeHTML(e);const s=e.body,n=new WeakMap,[i,o]=this.prepareMatching(s,n);return Vr(this.quill.scroll,s,i,o,n)}dangerouslyPasteHTML(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w.sources.API;if(typeof t=="string"){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,w.sources.SILENT)}else{const n=this.convert({html:e,text:""});this.quill.updateContents(new S().retain(t).concat(n),s),this.quill.setSelection(t+n.length(),w.sources.SILENT)}}onCaptureCopy(t){var o,a;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:n,text:i}=this.onCopy(s,e);(o=t.clipboardData)==null||o.setData("text/plain",i),(a=t.clipboardData)==null||a.setData("text/html",n),e&&Fr({range:s,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(e=>e[0]!=="#").join(` `)}onCapturePaste(t){var o,a,u,h,p;if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(e==null)return;const s=(o=t.clipboardData)==null?void 0:o.getData("text/html");let n=(a=t.clipboardData)==null?void 0:a.getData("text/plain");if(!s&&!n){const b=(u=t.clipboardData)==null?void 0:u.getData("text/uri-list");b&&(n=this.normalizeURIList(b))}const i=Array.from(((h=t.clipboardData)==null?void 0:h.files)||[]);if(!s&&i.length>0){this.quill.uploader.upload(e,i);return}if(s&&i.length>0){const b=new DOMParser().parseFromString(s,"text/html");if(b.body.childElementCount===1&&((p=b.body.firstElementChild)==null?void 0:p.tagName)==="IMG"){this.quill.uploader.upload(e,i);return}}this.onPaste(e,{html:s,text:n})}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:s,html:n}=e;const i=this.quill.getFormat(t.index),o=this.convert({text:s,html:n},i);jo.log("onPaste",o,{text:s,html:n});const a=new S().retain(t.index).delete(t.length).concat(o);this.quill.updateContents(a,w.sources.USER),this.quill.setSelection(a.length()-t.length,w.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const s=[],n=[];return this.matchers.forEach(i=>{const[o,a]=i;switch(o){case Node.TEXT_NODE:n.push(a);break;case Node.ELEMENT_NODE:s.push(a);break;default:Array.from(t.querySelectorAll(o)).forEach(u=>{if(e.has(u)){const h=e.get(u);h==null||h.push(a)}else e.set(u,[a])});break}}),[s,n]}}q(Ji,"DEFAULTS",{matchers:[]});function ue(r,t,e,s){return s.query(t)?r.reduce((n,i)=>{if(!i.insert)return n;if(i.attributes&&i.attributes[t])return n.push(i);const o=e?{[t]:e}:{};return n.insert(i.insert,{...o,...i.attributes})},new S):r}function us(r,t){let e="";for(let s=r.ops.length-1;s>=0&&e.lengtho(t,i,r),new S):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((i,o)=>{let a=Vr(r,o,e,s,n);return o.nodeType===t.ELEMENT_NODE&&(a=e.reduce((u,h)=>h(o,u,r),a),a=(n.get(o)||[]).reduce((u,h)=>h(o,u,r),a)),i.concat(a)},new S):new S}function hr(r){return(t,e,s)=>ue(e,r,!0,s)}function Fo(r,t,e){const s=It.keys(r),n=wt.keys(r),i=Xt.keys(r),o={};return s.concat(n).concat(i).forEach(a=>{let u=e.query(a,C.ATTRIBUTE);u!=null&&(o[u.attrName]=u.value(r),o[u.attrName])||(u=Ho[a],u!=null&&(u.attrName===a||u.keyName===a)&&(o[u.attrName]=u.value(r)||void 0),u=mi[a],u!=null&&(u.attrName===a||u.keyName===a)&&(u=mi[a],o[u.attrName]=u.value(r)||void 0))}),Object.entries(o).reduce((a,u)=>{let[h,p]=u;return ue(a,h,p,e)},t)}function Vo(r,t,e){const s=e.query(r);if(s==null)return t;if(s.prototype instanceof lt){const n={},i=s.value(r);if(i!=null)return n[s.blotName]=i,new S().insert(n,s.formats(r,e))}else if(s.prototype instanceof is&&!us(t,` `)&&t.insert(` `),"blotName"in s&&"formats"in s&&typeof s.formats=="function")return ue(t,s.blotName,s.formats(r,e),e);return t}function zo(r,t){return us(t,` `)||t.insert(` `),t}function Ko(r,t,e){const s=e.query("code-block"),n=s&&"formats"in s&&typeof s.formats=="function"?s.formats(r,e):!0;return ue(t,"code-block",n,e)}function Go(){return new S}function Zo(r,t,e){const s=e.query(r);if(s==null||s.blotName!=="list"||!us(t,` `))return t;let n=-1,i=r.parentNode;for(;i!=null;)["OL","UL"].includes(i.tagName)&&(n+=1),i=i.parentNode;return n<=0?t:t.reduce((o,a)=>a.insert?a.attributes&&typeof a.attributes.indent=="number"?o.push(a):o.insert(a.insert,{indent:n,...a.attributes||{}}):o,new S)}function Wo(r,t,e){const s=r;let n=s.tagName==="OL"?"ordered":"bullet";const i=s.getAttribute("data-checked");return i&&(n=i==="true"?"checked":"unchecked"),ue(t,"list",n,e)}function bi(r,t,e){if(!us(t,` `)){if(Zt(r,e)&&(r.childNodes.length>0||r instanceof HTMLParagraphElement))return t.insert(` `);if(t.length()>0&&r.nextSibling){let s=r.nextSibling;for(;s!=null;){if(Zt(s,e))return t.insert(` `);const n=e.query(s);if(n&&n.prototype instanceof ht)return t.insert(` `);s=s.firstChild}}}return t}function Yo(r,t,e){var i;const s={},n=r.style||{};return n.fontStyle==="italic"&&(s.italic=!0),n.textDecoration==="underline"&&(s.underline=!0),n.textDecoration==="line-through"&&(s.strike=!0),((i=n.fontWeight)!=null&&i.startsWith("bold")||parseInt(n.fontWeight,10)>=700)&&(s.bold=!0),t=Object.entries(s).reduce((o,a)=>{let[u,h]=a;return ue(o,u,h,e)},t),parseFloat(n.textIndent||0)>0?new S().insert(" ").concat(t):t}function Xo(r,t,e){var n,i;const s=((n=r.parentElement)==null?void 0:n.tagName)==="TABLE"?r.parentElement:(i=r.parentElement)==null?void 0:i.parentElement;if(s!=null){const a=Array.from(s.querySelectorAll("tr")).indexOf(r)+1;return ue(t,"table",a,e)}return t}function Qo(r,t,e){var n;let s=r.data;if(((n=r.parentElement)==null?void 0:n.tagName)==="O:P")return t.insert(s.trim());if(!tl(r)){if(s.trim().length===0&&s.includes(` `)&&!$o(r,e))return t;s=s.replace(/[^\S\u00a0]/g," "),s=s.replace(/ {2,}/g," "),(r.previousSibling==null&&r.parentElement!=null&&Zt(r.parentElement,e)||r.previousSibling instanceof Element&&Zt(r.previousSibling,e))&&(s=s.replace(/^ /,"")),(r.nextSibling==null&&r.parentElement!=null&&Zt(r.parentElement,e)||r.nextSibling instanceof Element&&Zt(r.nextSibling,e))&&(s=s.replace(/ $/,"")),s=s.replaceAll(" "," ")}return t.insert(s)}class el extends Tt{constructor(e,s){super(e,s);q(this,"lastRecorded",0);q(this,"ignoreChange",!1);q(this,"stack",{undo:[],redo:[]});q(this,"currentRange",null);this.quill.on(w.events.EDITOR_CHANGE,(n,i,o,a)=>{n===w.events.SELECTION_CHANGE?i&&a!==w.sources.SILENT&&(this.currentRange=i):n===w.events.TEXT_CHANGE&&(this.ignoreChange||(!this.options.userOnly||a===w.sources.USER?this.record(i,o):this.transform(i)),this.currentRange=Ar(this.currentRange,i))}),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",n=>{n.inputType==="historyUndo"?(this.undo(),n.preventDefault()):n.inputType==="historyRedo"&&(this.redo(),n.preventDefault())})}change(e,s){if(this.stack[e].length===0)return;const n=this.stack[e].pop();if(!n)return;const i=this.quill.getContents(),o=n.delta.invert(i);this.stack[s].push({delta:o,range:Ar(n.range,o)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,w.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,s){if(e.ops.length===0)return;this.stack.redo=[];let n=e.invert(s),i=this.currentRange;const o=Date.now();if(this.lastRecorded+this.options.delay>o&&this.stack.undo.length>0){const a=this.stack.undo.pop();a&&(n=n.compose(a.delta),i=a.range)}else this.lastRecorded=o;n.length()!==0&&(this.stack.undo.push({delta:n,range:i}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){yi(this.stack.undo,e),yi(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,w.sources.USER);else{const s=ta(this.quill.scroll,e.delta);this.quill.setSelection(s,w.sources.USER)}}}q(el,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});function yi(r,t){let e=t;for(let s=r.length-1;s>=0;s-=1){const n=r[s];r[s]={delta:e.transform(n.delta,!0),range:n.range&&Ar(n.range,e)},e=n.delta.transform(e),r[s].delta.length()===0&&r.splice(s,1)}}function Jo(r,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=>r.query(s,C.BLOCK)!=null):!1}function ta(r,t){const e=t.reduce((n,i)=>n+(i.delete||0),0);let s=t.length()-e;return Jo(r,t)&&(s-=1),s}function Ar(r,t){if(!r)return r;const e=t.transformPosition(r.index),s=t.transformPosition(r.index+r.length);return{index:e,length:s-e}}class sl extends Tt{constructor(t,e){super(t,e),t.root.addEventListener("drop",s=>{var o;s.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(s.clientX,s.clientY);else if(document.caretPositionFromPoint){const a=document.caretPositionFromPoint(s.clientX,s.clientY);n=document.createRange(),n.setStart(a.offsetNode,a.offset),n.setEnd(a.offsetNode,a.offset)}const i=n&&t.selection.normalizeNative(n);if(i){const a=t.selection.normalizedToRange(i);(o=s.dataTransfer)!=null&&o.files&&this.upload(a,s.dataTransfer.files)}})}upload(t,e){const s=[];Array.from(e).forEach(n=>{var i;n&&((i=this.options.mimetypes)!=null&&i.includes(n.type))&&s.push(n)}),s.length>0&&this.options.handler.call(this,t,s)}}sl.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(r,t){if(!this.quill.scroll.query("image"))return;const e=t.map(s=>new Promise(n=>{const i=new FileReader;i.onload=()=>{n(i.result)},i.readAsDataURL(s)}));Promise.all(e).then(s=>{const n=s.reduce((i,o)=>i.insert({image:o}),new S().retain(r.index).delete(r.length));this.quill.updateContents(n,_.sources.USER),this.quill.setSelection(r.index+s.length,_.sources.SILENT)})}};const ea=["insertText","insertReplacementText"];class sa extends Tt{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",s=>{this.handleBeforeInput(s)}),/Android/i.test(navigator.userAgent)||t.on(w.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){Fr({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 S().retain(t.index).insert(e,s),w.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,w.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!ea.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||e.collapsed===!0)return;const s=na(t);if(s==null)return;const n=this.quill.selection.normalizeNative(e),i=n?this.quill.selection.normalizedToRange(n):null;i&&this.replaceText(i,s)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}}function na(r){var t;return typeof r.data=="string"?r.data:(t=r.dataTransfer)!=null&&t.types.includes("text/plain")?r.dataTransfer.getData("text/plain"):null}const ra=/Mac/i.test(navigator.platform),ia=100,la=r=>!!(r.key==="ArrowLeft"||r.key==="ArrowRight"||r.key==="ArrowUp"||r.key==="ArrowDown"||r.key==="Home"||ra&&r.key==="a"&&r.ctrlKey===!0);class oa extends Tt{constructor(e,s){super(e,s);q(this,"isListening",!1);q(this,"selectionChangeDeadline",0);this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,s){let{line:n,event:i}=s;if(!(n instanceof Nt)||!n.uiNode)return!0;const o=getComputedStyle(n.domNode).direction==="rtl";return o&&i.key!=="ArrowRight"||!o&&i.key!=="ArrowLeft"?!0:(this.quill.setSelection(e.index-1,e.length+(i.shiftKey?1:0),w.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&la(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+ia,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 n=this.quill.scroll.find(s.startContainer);if(!(n instanceof Nt)||!n.uiNode)return;const i=document.createRange();i.setStartAfter(n.uiNode),i.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(i)}}w.register({"blots/block":W,"blots/block/embed":ht,"blots/break":xt,"blots/container":ae,"blots/cursor":Oe,"blots/embed":Dr,"blots/inline":Rt,"blots/scroll":Le,"blots/text":At,"modules/clipboard":Ji,"modules/history":el,"modules/keyboard":rn,"modules/uploader":sl,"modules/input":sa,"modules/uiNode":oa});class aa extends wt{add(t,e){let s=0;if(e==="+1"||e==="-1"){const n=this.value(t)||0;s=e==="+1"?n+1:n-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 ca=new aa("indent","ql-indent",{scope:C.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class wr extends W{}q(wr,"blotName","blockquote"),q(wr,"tagName","blockquote");class xr extends W{static formats(t){return this.tagName.indexOf(t.tagName)+1}}q(xr,"blotName","header"),q(xr,"tagName",["H1","H2","H3","H4","H5","H6"]);class hs extends ae{}hs.blotName="list-container";hs.tagName="OL";class fs 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(){w.register(hs)}constructor(t,e){super(t,e);const s=e.ownerDocument.createElement("span"),n=i=>{if(!t.isEnabled())return;const o=this.statics.formats(e,t);o==="checked"?(this.format("list","unchecked"),i.preventDefault()):o==="unchecked"&&(this.format("list","checked"),i.preventDefault())};s.addEventListener("mousedown",n),s.addEventListener("touchstart",n),this.attachUI(s)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}fs.blotName="list";fs.tagName="LI";hs.allowedChildren=[fs];fs.requiredContainer=hs;class as extends Rt{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)}}q(as,"blotName","bold"),q(as,"tagName",["STRONG","B"]);class Tr extends as{}q(Tr,"blotName","italic"),q(Tr,"tagName",["EM","I"]);class Wt extends Rt{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 nl(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))}}q(Wt,"blotName","link"),q(Wt,"tagName","A"),q(Wt,"SANITIZED_URL","about:blank"),q(Wt,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);function nl(r,t){const e=document.createElement("a");e.href=r;const s=e.href.slice(0,e.href.indexOf(":"));return t.indexOf(s)>-1}class qr extends Rt{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"}}q(qr,"blotName","script"),q(qr,"tagName",["SUB","SUP"]);class Lr extends as{}q(Lr,"blotName","strike"),q(Lr,"tagName",["S","STRIKE"]);class _r extends Rt{}q(_r,"blotName","underline"),q(_r,"tagName","U");class Gs extends Dr{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`${t}`}}q(Gs,"blotName","formula"),q(Gs,"className","ql-formula"),q(Gs,"tagName","SPAN");const vi=["alt","height","width"];class Sr extends lt{static create(t){const e=super.create(t);return typeof t=="string"&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return vi.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 nl(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){vi.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}q(Sr,"blotName","image"),q(Sr,"tagName","IMG");const Ei=["height","width"];class Zs extends ht{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 Ei.reduce((e,s)=>(t.hasAttribute(s)&&(e[s]=t.getAttribute(s)),e),{})}static sanitize(t){return Wt.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){Ei.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`${t}`}}q(Zs,"blotName","video"),q(Zs,"className","ql-video"),q(Zs,"tagName","IFRAME");const es=new wt("code-token","hljs",{scope:C.INLINE});class Pt extends Rt{static formats(t,e){for(;t!=null&&t!==e.domNode;){if(t.classList&&t.classList.contains(tt.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,s){super(t,e,s),es.add(this.domNode,s)}format(t,e){t!==Pt.blotName?super.format(t,e):e?es.add(this.domNode,e):(es.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),es.value(this.domNode)||this.unwrap()}}Pt.blotName="code-token";Pt.className="ql-token";class ut extends tt{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(),Pt.blotName,!1),super.replaceWith(t,e)}}class ss extends ce{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===ut.blotName&&(this.forceNext=!0,this.children.forEach(s=>{s.format(t,e)}))}formatAt(t,e,s,n){s===ut.blotName&&(this.forceNext=!0),super.formatAt(t,e,s,n)}highlight(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(this.children.head==null)return;const n=`${Array.from(this.domNode.childNodes).filter(o=>o!==this.uiNode).map(o=>o.textContent).join(` `)} `,i=ut.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||this.cachedText==null){const o=this.children.reduce((u,h)=>u.concat(ji(h,!1)),new S),a=t(n,i);o.diff(a).reduce((u,h)=>{let{retain:p,attributes:b}=h;return p?(b&&Object.keys(b).forEach(d=>{[ut.blotName,Pt.blotName].includes(d)&&this.formatAt(u,p,d,b[d])}),u+p):u},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[s]=this.children.find(t);return`
    ${nn(this.code(t,e))}
    
    `}optimize(t){if(super.optimize(t),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){const e=ut.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}ss.allowedChildren=[ut];ut.requiredContainer=ss;ut.allowedChildren=[Pt,Oe,At,xt];const ua=(r,t,e)=>{if(typeof r.versionString=="string"){const s=r.versionString.split(".")[0];if(parseInt(s,10)>=11)return r.highlight(e,{language:t}).value}return r.highlight(t,e).value};class rl extends Tt{static register(){w.register(Pt,!0),w.register(ut,!0),w.register(ss,!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,n)=>{let{key:i}=n;return s[i]=!0,s},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(w.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof ss))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(s=>{let{key:n,label:i}=s;const o=e.ownerDocument.createElement("option");o.textContent=i,o.setAttribute("value",n),e.appendChild(o)}),e.addEventListener("change",()=>{t.format(ut.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),t.uiNode==null&&(t.attachUI(e),t.children.head&&(e.value=ut.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(w.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(w.sources.USER);const s=this.quill.getSelection();(t==null?this.quill.scroll.descendants(ss):[t]).forEach(i=>{i.highlight(this.highlightBlot,e)}),this.quill.update(w.sources.SILENT),s!=null&&this.quill.setSelection(s,w.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 nn(t).split(` `).reduce((n,i,o)=>(o!==0&&n.insert(` `,{[tt.blotName]:e}),n.insert(i)),new S);const s=this.quill.root.ownerDocument.createElement("div");return s.classList.add(tt.className),s.innerHTML=ua(this.options.hljs,e,t),Vr(this.quill.scroll,s,[(n,i)=>{const o=es.value(n);return o?i.compose(new S().retain(i.length(),{[Pt.blotName]:o})):i}],[(n,i)=>n.data.split(` `).reduce((o,a,u)=>(u!==0&&o.insert(` `,{[tt.blotName]:e}),o.insert(a)),i)],new WeakMap)}}rl.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 rs=class rs extends W{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",zr()),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===rs.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()}};q(rs,"blotName","table"),q(rs,"tagName","TD");let Et=rs;class Ht extends ae{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(),n=this.next.children.tail.formats();return t.table===e.table&&t.table===s.table&&t.table===n.table}return!1}optimize(t){super.optimize(t),this.children.forEach(e=>{if(e.next==null)return;const s=e.formats(),n=e.next.formats();if(s.table!==n.table){const i=this.splitAfter(e);i&&i.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}q(Ht,"blotName","table-row"),q(Ht,"tagName","TR");class Ot extends ae{}q(Ot,"blotName","table-body"),q(Ot,"tagName","TBODY");class Re extends ae{balanceCells(){const t=this.descendants(Ht),e=t.reduce((s,n)=>Math.max(n.children.length,s),0);t.forEach(s=>{new Array(e-s.children.length).fill(0).forEach(()=>{let n;s.children.head!=null&&(n=Et.formats(s.children.head.domNode));const i=this.scroll.create(Et.blotName,n);s.appendChild(i),i.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(Ot);e==null||e.children.head==null||e.children.forEach(s=>{const n=s.children.at(t);n!=null&&n.remove()})}insertColumn(t){const[e]=this.descendant(Ot);e==null||e.children.head==null||e.children.forEach(s=>{const n=s.children.at(t),i=Et.formats(s.children.head.domNode),o=this.scroll.create(Et.blotName,i);s.insertBefore(o,n)})}insertRow(t){const[e]=this.descendant(Ot);if(e==null||e.children.head==null)return;const s=zr(),n=this.scroll.create(Ht.blotName);e.children.head.children.forEach(()=>{const o=this.scroll.create(Et.blotName,s);n.appendChild(o)});const i=e.children.at(t);e.insertBefore(n,i)}rows(){const t=this.children.head;return t==null?[]:t.children.map(e=>e)}}q(Re,"blotName","table-container"),q(Re,"tagName","TABLE");Re.allowedChildren=[Ot];Ot.requiredContainer=Re;Ot.allowedChildren=[Ht];Ht.requiredContainer=Ot;Ht.allowedChildren=[Et];Et.requiredContainer=Ht;function zr(){return`row-${Math.random().toString(36).slice(2,6)}`}class ha extends Tt{static register(){w.register(Et),w.register(Ht),w.register(Ot),w.register(Re)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Re).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();e!=null&&(t.deleteColumn(e.cellOffset()),this.quill.update(w.sources.USER))}deleteRow(){const[,t]=this.getTable();t!=null&&(t.remove(),this.quill.update(w.sources.USER))}deleteTable(){const[t]=this.getTable();if(t==null)return;const e=t.offset();t.remove(),this.quill.update(w.sources.USER),this.quill.setSelection(e,w.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!==Et.blotName)return[null,null,null,-1];const n=e.parent;return[n.parent.parent,n,e,s]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[s,n,i]=this.getTable(e);if(i==null)return;const o=i.cellOffset();s.insertColumn(o+t),this.quill.update(w.sources.USER);let a=n.rowOffset();t===0&&(a+=1),this.quill.setSelection(e.index+a,e.length,w.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[s,n,i]=this.getTable(e);if(i==null)return;const o=n.rowOffset();s.insertRow(o+t),this.quill.update(w.sources.USER),t>0?this.quill.setSelection(e,w.sources.SILENT):this.quill.setSelection(e.index+n.children.length,e.length,w.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const s=this.quill.getSelection();if(s==null)return;const n=new Array(t).fill(0).reduce(i=>{const o=new Array(e).fill(` `).join("");return i.insert(o,{table:zr()})},new S().retain(s.index));this.quill.updateContents(n,w.sources.USER),this.quill.setSelection(s.index,w.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(w.events.SCROLL_OPTIMIZE,t=>{t.some(e=>["TD","TR","TBODY","TABLE"].includes(e.target.tagName)?(this.quill.once(w.events.TEXT_CHANGE,(s,n,i)=>{i===w.sources.USER&&this.balanceTables()}),!0):!1)})}}const Ni=$t("quill:toolbar");class Kr extends Tt{constructor(t,e){var s,n;if(super(t,e),Array.isArray(this.options.container)){const i=document.createElement("div");i.setAttribute("role","toolbar"),fa(i,this.options.container),(n=(s=t.container)==null?void 0:s.parentNode)==null||n.insertBefore(i,t.container),this.container=i}else typeof this.options.container=="string"?this.container=document.querySelector(this.options.container):this.container=this.options.container;if(!(this.container instanceof HTMLElement)){Ni.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(i=>{var a;const o=(a=this.options.handlers)==null?void 0:a[i];o&&this.addHandler(i,o)}),Array.from(this.container.querySelectorAll("button, select")).forEach(i=>{this.attach(i)}),this.quill.on(w.events.EDITOR_CHANGE,()=>{const[i]=this.quill.selection.getRange();this.update(i)})}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find(n=>n.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){Ni.warn("ignoring attaching to nonexistent format",e,t);return}const s=t.tagName==="SELECT"?"change":"click";t.addEventListener(s,n=>{let i;if(t.tagName==="SELECT"){if(t.selectedIndex<0)return;const a=t.options[t.selectedIndex];a.hasAttribute("selected")?i=!1:i=a.value||!1}else t.classList.contains("ql-active")?i=!1:i=t.value||!t.hasAttribute("value"),n.preventDefault();this.quill.focus();const[o]=this.quill.selection.getRange();if(this.handlers[e]!=null)this.handlers[e].call(this,i);else if(this.quill.scroll.query(e).prototype instanceof lt){if(i=prompt(`Enter ${e}`),!i)return;this.quill.updateContents(new S().retain(o.index).delete(o.length).insert({[e]:i}),w.sources.USER)}else this.quill.format(e,i,w.sources.USER);this.update(o)}),this.controls.push([e,t])}update(t){const e=t==null?{}:this.quill.getFormat(t);this.controls.forEach(s=>{const[n,i]=s;if(i.tagName==="SELECT"){let o=null;if(t==null)o=null;else if(e[n]==null)o=i.querySelector("option[selected]");else if(!Array.isArray(e[n])){let a=e[n];typeof a=="string"&&(a=a.replace(/"/g,'\\"')),o=i.querySelector(`option[value="${a}"]`)}o==null?(i.value="",i.selectedIndex=-1):o.selected=!0}else if(t==null)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const o=e[n],a=o===i.getAttribute("value")||o!=null&&o.toString()===i.getAttribute("value")||o==null&&!i.getAttribute("value");i.classList.toggle("ql-active",a),i.setAttribute("aria-pressed",a.toString())}else{const o=e[n]!=null;i.classList.toggle("ql-active",o),i.setAttribute("aria-pressed",o.toString())}})}}Kr.DEFAULTS={};function Ai(r,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),r.appendChild(s)}function fa(r,t){Array.isArray(t[0])||(t=[t]),t.forEach(e=>{const s=document.createElement("span");s.classList.add("ql-formats"),e.forEach(n=>{if(typeof n=="string")Ai(s,n);else{const i=Object.keys(n)[0],o=n[i];Array.isArray(o)?da(s,i,o):Ai(s,i,o)}}),r.appendChild(s)})}function da(r,t,e){const s=document.createElement("select");s.classList.add(`ql-${t}`),e.forEach(n=>{const i=document.createElement("option");n!==!1?i.setAttribute("value",String(n)):i.setAttribute("selected","selected"),s.appendChild(i)}),r.appendChild(s)}Kr.DEFAULTS={container:null,handlers:{clean(){const r=this.quill.getSelection();if(r!=null)if(r.length===0){const t=this.quill.getFormat();Object.keys(t).forEach(e=>{this.quill.scroll.query(e,C.INLINE)!=null&&this.quill.format(e,!1,w.sources.USER)})}else this.quill.removeFormat(r.index,r.length,w.sources.USER)},direction(r){const{align:t}=this.quill.getFormat();r==="rtl"&&t==null?this.quill.format("align","right",w.sources.USER):!r&&t==="right"&&this.quill.format("align",!1,w.sources.USER),this.quill.format("direction",r,w.sources.USER)},indent(r){const t=this.quill.getSelection(),e=this.quill.getFormat(t),s=parseInt(e.indent||0,10);if(r==="+1"||r==="-1"){let n=r==="+1"?1:-1;e.direction==="rtl"&&(n*=-1),this.quill.format("indent",s+n,w.sources.USER)}},link(r){r===!0&&(r=prompt("Enter link URL:")),this.quill.format("link",r,w.sources.USER)},list(r){const t=this.quill.getSelection(),e=this.quill.getFormat(t);r==="check"?e.list==="checked"||e.list==="unchecked"?this.quill.format("list",!1,w.sources.USER):this.quill.format("list","unchecked",w.sources.USER):this.quill.format("list",r,w.sources.USER)}}};const pa='',ga='',ma='',ba='',ya='',va='',Ea='',Na='',wi='',Aa='',wa='',xa='',Ta='',qa='',La='',_a='',Sa='',ka='',Ca='',Oa='',Ia='',Ra='',Ba='',Ma='',Da='',Ua='',ja='',Pa='',Ha='',$a='',Fa='',Va='',za='',cs={align:{"":pa,center:ga,right:ma,justify:ba},background:ya,blockquote:va,bold:Ea,clean:Na,code:wi,"code-block":wi,color:Aa,direction:{"":wa,rtl:xa},formula:Ta,header:{1:qa,2:La,3:_a,4:Sa,5:ka,6:Ca},italic:Oa,image:Ia,indent:{"+1":Ra,"-1":Ba},link:Ma,list:{bullet:Da,check:Ua,ordered:ja},script:{sub:Pa,super:Ha},strike:$a,table:Fa,underline:Va,video:za},Ka='';let xi=0;function Ti(r,t){r.setAttribute(t,`${r.getAttribute(t)!=="true"}`)}class ln{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"),Ti(this.label,"aria-expanded"),Ti(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",n=>{switch(n.key){case"Enter":this.selectItem(e,!0),n.preventDefault();break;case"Escape":this.escape(),n.preventDefault();break}}),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML=Ka,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-${xi}`,xi+=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 il extends ln{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"),n=t&&t.getAttribute("data-value")||"";s&&(s.tagName==="line"?s.style.stroke=n:s.style.fill=n)}}class ll extends ln{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 Ga=r=>{const{overflowY:t}=getComputedStyle(r,null);return t!=="visible"&&t!=="clip"};class ol{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,Ga(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 n=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect();let o=0;if(i.right>n.right&&(o=n.right-i.right,this.root.style.left=`${e+o}px`),i.leftn.bottom){const a=i.bottom-i.top,u=t.bottom-t.top+a;this.root.style.top=`${s-u}px`,this.root.classList.add("ql-flip")}return o}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const Za=[!1,"center","right","justify"],Wa=["#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"],Ya=[!1,"serif","monospace"],Xa=["1","2","3",!1],Qa=["small",!1,"large","huge"];class ds extends Ie{constructor(t,e){super(t,e);const s=n=>{if(!document.body.contains(t.root)){document.body.removeEventListener("click",s);return}this.tooltip!=null&&!this.tooltip.root.contains(n.target)&&document.activeElement!==this.tooltip.textbox&&!this.quill.hasFocus()&&this.tooltip.hide(),this.pickers!=null&&this.pickers.forEach(i=>{i.container.contains(n.target)||i.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(i=>{if(i.startsWith("ql-")&&(i=i.slice(3),e[i]!=null))if(i==="direction")s.innerHTML=e[i][""]+e[i].rtl;else if(typeof e[i]=="string")s.innerHTML=e[i];else{const o=s.value||"";o!=null&&e[i][o]&&(s.innerHTML=e[i][o])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(n=>{if(n.classList.contains("ql-align")&&(n.querySelector("option")==null&&ts(n,Za),typeof e.align=="object"))return new ll(n,e.align);if(n.classList.contains("ql-background")||n.classList.contains("ql-color")){const i=n.classList.contains("ql-background")?"background":"color";return n.querySelector("option")==null&&ts(n,Wa,i==="background"?"#ffffff":"#000000"),new il(n,e[i])}return n.querySelector("option")==null&&(n.classList.contains("ql-font")?ts(n,Ya):n.classList.contains("ql-header")?ts(n,Xa):n.classList.contains("ql-size")&&ts(n,Qa)),new ln(n)});const s=()=>{this.pickers.forEach(n=>{n.update()})};this.quill.on(_.events.EDITOR_CHANGE,s)}}ds.DEFAULTS=Yt({},Ie.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let r=this.container.querySelector("input.ql-image[type=file]");r==null&&(r=document.createElement("input"),r.setAttribute("type","file"),r.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),r.classList.add("ql-image"),r.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,r.files),r.value=""}),this.container.appendChild(r)),r.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class al extends ol{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({preventScroll:!0})}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,_.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,_.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=Ja(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,_.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(s+1," ",_.sources.USER),this.quill.setSelection(s+2,_.sources.USER)}break}}this.textbox.value="",this.hide()}}function Ja(r){let t=r.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||r.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return t?`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`:(t=r.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`:r}function ts(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t.forEach(s=>{const n=document.createElement("option");s===e?n.setAttribute("selected","selected"):n.setAttribute("value",String(s)),r.appendChild(n)})}const tc=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class cl extends al{constructor(t,e){super(t,e),this.quill.on(_.events.EDITOR_CHANGE,(s,n,i,o)=>{if(s===_.events.SELECTION_CHANGE)if(n!=null&&n.length>0&&o===_.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const a=this.quill.getLines(n.index,n.length);if(a.length===1){const u=this.quill.getBounds(n);u!=null&&this.position(u)}else{const u=a[a.length-1],h=this.quill.getIndex(u),p=Math.min(u.length()-1,n.index+n.length-h),b=this.quill.getBounds(new oe(h,p));b!=null&&this.position(b)}}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(_.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}}q(cl,"TEMPLATE",['','
    ','','',"
    "].join(""));class ul extends ds{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=tc),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new cl(this.quill,this.options.bounds),t.container!=null&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),cs),this.buildPickers(t.container.querySelectorAll("select"),cs))}}ul.DEFAULTS=Yt({},ds.DEFAULTS,{modules:{toolbar:{handlers:{link(r){r?this.quill.theme.tooltip.edit():this.quill.format("link",!1,w.sources.USER)}}}}});const ec=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class hl extends al{constructor(){super(...arguments);q(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,_.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(_.events.SELECTION_CHANGE,(e,s,n)=>{if(e!=null){if(e.length===0&&n===_.sources.USER){const[i,o]=this.quill.scroll.descendant(Wt,e.index);if(i!=null){this.linkRange=new oe(e.index-o,i.length());const a=Wt.formats(i.domNode);this.preview.textContent=a,this.preview.setAttribute("href",a),this.show();const u=this.quill.getBounds(this.linkRange);u!=null&&this.position(u);return}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}q(hl,"TEMPLATE",['','','',''].join(""));class fl extends ds{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=ec),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"),cs),this.buildPickers(t.container.querySelectorAll("select"),cs),this.tooltip=new hl(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)}))}}fl.DEFAULTS=Yt({},ds.DEFAULTS,{modules:{toolbar:{handlers:{link(r){if(r){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,w.sources.USER)}}}}});w.register({"attributors/attribute/direction":zi,"attributors/class/align":$i,"attributors/class/background":vo,"attributors/class/color":yo,"attributors/class/direction":Ki,"attributors/class/font":Wi,"attributors/class/size":Xi,"attributors/style/align":Fi,"attributors/style/background":Pr,"attributors/style/color":jr,"attributors/style/direction":Gi,"attributors/style/font":Yi,"attributors/style/size":Qi},!0);w.register({"formats/align":$i,"formats/direction":Ki,"formats/indent":ca,"formats/background":Pr,"formats/color":jr,"formats/font":Wi,"formats/size":Xi,"formats/blockquote":wr,"formats/code-block":tt,"formats/header":xr,"formats/list":fs,"formats/bold":as,"formats/code":Hr,"formats/italic":Tr,"formats/link":Wt,"formats/script":qr,"formats/strike":Lr,"formats/underline":_r,"formats/formula":Gs,"formats/image":Sr,"formats/video":Zs,"modules/syntax":rl,"modules/table":ha,"modules/toolbar":Kr,"themes/bubble":ul,"themes/snow":fl,"ui/icons":cs,"ui/picker":ln,"ui/icon-picker":ll,"ui/color-picker":il,"ui/tooltip":ol},!0);const sc={class:"position-create-container"},nc={class:"header-container"},rc={class:"editor-container"},ic={class:"editor-container"},lc={class:"salary-range-container"},oc={class:"job-conditions-container"},ac=gl({__name:"index",setup(r){const t=ml(),e=er(),s=bl({title:"",job_category:"",job_type_display:"",city:"",location:[],address_detail:"",benefits:[],requirements:"",job_type:0,salary_type:"月薪",start_salary:"",end_salary:"",experience:"",education:"",salary_range:"",department:"",end_date:"",description:"",province:"",district:"",location_str:"",status:0}),n={title:[{required:!0,message:"职位名称必填",trigger:"blur"}],job_category:[{required:!0,message:"职位类别必填",trigger:"change"}],job_type_display:[{required:!0,message:"职位性质必填",trigger:"change"}],location:[{required:!0,message:"工作地点必填",trigger:"change"}],department:[{required:!0,message:"所属部门必填",trigger:"blur"}],job_type:[{required:!0,message:"职位状态必填",trigger:"change"}],end_date:[{required:!0,message:"截止日期必填",trigger:"change"}],requirements:[{required:!0,message:"职位要求必填",trigger:"blur"}],description:[{required:!0,message:"职位描述必填",trigger:"blur"}],salary_range:[{required:!0,message:"薪资范围必填",trigger:"blur"}]},i=er(null),o=er(null);let a=null,u=null;const h=[{value:"上海市",label:"上海市",children:[{value:"浦东新区",label:"浦东新区",children:[{value:"张江",label:"张江"},{value:"金桥",label:"金桥"},{value:"陆家嘴",label:"陆家嘴"}]},{value:"徐汇区",label:"徐汇区",children:[{value:"漕河泾",label:"漕河泾"},{value:"徐家汇",label:"徐家汇"}]}]},{value:"北京市",label:"北京市",children:[{value:"海淀区",label:"海淀区",children:[{value:"中关村",label:"中关村"},{value:"上地",label:"上地"}]},{value:"朝阳区",label:"朝阳区",children:[{value:"CBD",label:"CBD"},{value:"望京",label:"望京"}]}]}],p=g=>{console.log("地址选择变化:",g),g&&Array.isArray(g)&&g.length>0&&(s.province=g[0],s.city=g[1]||"",s.district=g[2]||"")};yl(()=>{i.value&&(a=new w(i.value,{theme:"snow",modules:{toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"]]},placeholder:"请输入职位要求"}),s.requirements&&a.clipboard.dangerouslyPasteHTML(s.requirements),a.on("text-change",()=>{s.requirements=a.root.innerHTML})),o.value&&(u=new w(o.value,{theme:"snow",modules:{toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"]]},placeholder:"请输入职位描述"}),s.description&&u.clipboard.dangerouslyPasteHTML(s.description),u.on("text-change",()=>{s.description=u.root.innerHTML}))}),vl(()=>{a=null,u=null});const b=()=>{t.push("/position/list")},d=async()=>{e.value&&(a&&(s.requirements=a.root.innerHTML),u&&(s.description=u.root.innerHTML),s.salary_type&&s.start_salary&&s.end_salary&&(s.salary_range=`${s.salary_type} ${s.start_salary}-${s.end_salary}`),await e.value.validate(async(g,m)=>{if(g)try{const y={...s};Array.isArray(y.location)&&y.location.length>0&&(y.province=y.location[0],y.city=y.location[1]||"",y.district=y.location[2]||"",y.location_str=y.location.join(" "));const N={...y,location:y.location_str};delete N.location_str;const v=await Al(N);Wr.success("职位添加成功"),t.push(`/position/detail?id=${v.data.id}`)}catch(y){console.error("保存失败:",y),Wr.error("保存失败,请重试")}else console.log("验证失败:",m)}))};return(g,m)=>{const y=kt("page-header"),N=kt("el-input"),v=kt("el-form-item"),E=kt("el-option"),x=kt("el-select"),k=kt("el-cascader"),L=kt("el-date-picker"),I=kt("el-button"),M=kt("el-form"),$=kt("el-card");return Nl(),El("div",sc,[bt("div",nc,[T(y,{title:"新增职位",onBack:b})]),T($,{class:"form-card"},{default:F(()=>[m[17]||(m[17]=bt("div",{class:"section-title"},[bt("div",{class:"section-line"}),bt("span",null,"职位详情")],-1)),T(M,{ref_key:"formRef",ref:e,model:s,rules:n,"label-width":"120px","label-position":"right"},{default:F(()=>[T(v,{label:"职位名称",prop:"title"},{default:F(()=>[T(N,{modelValue:s.title,"onUpdate:modelValue":m[0]||(m[0]=B=>s.title=B),placeholder:"请输入职位名称",maxlength:"20","show-word-limit":""},null,8,["modelValue"])]),_:1}),T(v,{label:"职位类别",prop:"job_category"},{default:F(()=>[T(x,{modelValue:s.job_category,"onUpdate:modelValue":m[1]||(m[1]=B=>s.job_category=B),placeholder:"请选择职位类别"},{default:F(()=>[T(E,{label:"技术",value:"技术"}),T(E,{label:"产品",value:"产品"}),T(E,{label:"设计",value:"设计"}),T(E,{label:"运营",value:"运营"}),T(E,{label:"市场",value:"市场"}),T(E,{label:"销售",value:"销售"}),T(E,{label:"行政",value:"行政"}),T(E,{label:"财务",value:"财务"}),T(E,{label:"人力资源",value:"人力资源"}),T(E,{label:"法务",value:"法务"}),T(E,{label:"其他",value:"其他"})]),_:1},8,["modelValue"])]),_:1}),T(v,{label:"职位性质",prop:"job_type_display"},{default:F(()=>[T(x,{modelValue:s.job_type_display,"onUpdate:modelValue":m[2]||(m[2]=B=>s.job_type_display=B),placeholder:"请选择职位性质"},{default:F(()=>[T(E,{label:"全职",value:"全职"}),T(E,{label:"兼职",value:"兼职"}),T(E,{label:"实习",value:"实习"}),T(E,{label:"其他",value:"其他"})]),_:1},8,["modelValue"])]),_:1}),T(v,{label:"工作地点",prop:"location"},{default:F(()=>[T(k,{modelValue:s.location,"onUpdate:modelValue":m[3]||(m[3]=B=>s.location=B),options:h,props:{expandTrigger:"hover",checkStrictly:!1},style:{width:"100%"},placeholder:"请选择工作地点",clearable:"",onChange:p},null,8,["modelValue"])]),_:1}),T(v,{label:"门牌号码",prop:"address_detail"},{default:F(()=>[T(N,{modelValue:s.address_detail,"onUpdate:modelValue":m[4]||(m[4]=B=>s.address_detail=B),placeholder:"请输入详细地址"},null,8,["modelValue"])]),_:1}),T(v,{label:"福利待遇",prop:"benefits"},{default:F(()=>[T(x,{modelValue:s.benefits,"onUpdate:modelValue":m[5]||(m[5]=B=>s.benefits=B),placeholder:"请选择福利待遇",multiple:""},{default:F(()=>[T(E,{label:"五险一金",value:"五险一金"}),T(E,{label:"年终奖",value:"年终奖"}),T(E,{label:"带薪年假",value:"带薪年假"}),T(E,{label:"定期体检",value:"定期体检"}),T(E,{label:"节日福利",value:"节日福利"}),T(E,{label:"员工旅游",value:"员工旅游"}),T(E,{label:"弹性工作",value:"弹性工作"}),T(E,{label:"免费班车",value:"免费班车"}),T(E,{label:"餐补",value:"餐补"}),T(E,{label:"交通补贴",value:"交通补贴"})]),_:1},8,["modelValue"])]),_:1}),T(v,{label:"职位要求",prop:"requirements"},{default:F(()=>[bt("div",rc,[bt("div",{ref_key:"quillEditor",ref:i,class:"quill-editor"},null,512)])]),_:1}),T(v,{label:"职位描述",prop:"description"},{default:F(()=>[bt("div",ic,[bt("div",{ref_key:"descriptionEditor",ref:o,class:"quill-editor"},null,512)])]),_:1}),T(v,{label:"职位薪资",prop:"salary_range"},{default:F(()=>[bt("div",lc,[T(x,{modelValue:s.salary_type,"onUpdate:modelValue":m[6]||(m[6]=B=>s.salary_type=B),placeholder:"薪资类型",class:"salary-type-select"},{default:F(()=>[T(E,{label:"月薪",value:"月薪"}),T(E,{label:"年薪",value:"年薪"}),T(E,{label:"日薪",value:"日薪"}),T(E,{label:"时薪",value:"时薪"})]),_:1},8,["modelValue"]),T(N,{modelValue:s.start_salary,"onUpdate:modelValue":m[7]||(m[7]=B=>s.start_salary=B),placeholder:"起始薪资",class:"salary-input"},null,8,["modelValue"]),m[14]||(m[14]=bt("span",{class:"salary-separator"},"-",-1)),T(N,{modelValue:s.end_salary,"onUpdate:modelValue":m[8]||(m[8]=B=>s.end_salary=B),placeholder:"最高薪资",class:"salary-input"},null,8,["modelValue"])])]),_:1}),T(v,{label:"职位条件"},{default:F(()=>[bt("div",oc,[T(x,{modelValue:s.experience,"onUpdate:modelValue":m[9]||(m[9]=B=>s.experience=B),placeholder:"工作经验",class:"condition-select"},{default:F(()=>[T(E,{label:"不限",value:"不限"}),T(E,{label:"应届毕业生",value:"应届毕业生"}),T(E,{label:"1年以下",value:"1年以下"}),T(E,{label:"1-3年",value:"1-3年"}),T(E,{label:"3-5年",value:"3-5年"}),T(E,{label:"5-10年",value:"5-10年"}),T(E,{label:"10年以上",value:"10年以上"})]),_:1},8,["modelValue"]),T(x,{modelValue:s.education,"onUpdate:modelValue":m[10]||(m[10]=B=>s.education=B),placeholder:"学历要求",class:"condition-select"},{default:F(()=>[T(E,{label:"不限",value:"不限"}),T(E,{label:"高中",value:"高中"}),T(E,{label:"大专",value:"大专"}),T(E,{label:"本科",value:"本科"}),T(E,{label:"硕士",value:"硕士"}),T(E,{label:"博士",value:"博士"})]),_:1},8,["modelValue"])])]),_:1}),T(v,{label:"所属部门",prop:"department"},{default:F(()=>[T(N,{modelValue:s.department,"onUpdate:modelValue":m[11]||(m[11]=B=>s.department=B),placeholder:"请输入所属部门"},null,8,["modelValue"])]),_:1}),T(v,{label:"职位状态",prop:"job_type"},{default:F(()=>[T(x,{modelValue:s.job_type,"onUpdate:modelValue":m[12]||(m[12]=B=>s.job_type=B),placeholder:"请选择职位状态"},{default:F(()=>[T(E,{label:"未发布",value:0}),T(E,{label:"已发布",value:1}),T(E,{label:"已结束",value:2})]),_:1},8,["modelValue"])]),_:1}),T(v,{label:"截止日期",prop:"end_date"},{default:F(()=>[T(L,{modelValue:s.end_date,"onUpdate:modelValue":m[13]||(m[13]=B=>s.end_date=B),type:"datetime",placeholder:"请选择截止日期","value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["modelValue"])]),_:1}),T(v,null,{default:F(()=>[T(I,{type:"primary",onClick:d},{default:F(()=>m[15]||(m[15]=[Zr("保存")])),_:1}),T(I,{onClick:b},{default:F(()=>m[16]||(m[16]=[Zr("取消")])),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}}),vc=wl(ac,[["__scopeId","data-v-ff884f7b"]]);export{vc as default};