var mo=Object.defineProperty;var bo=(s,t,e)=>t in s?mo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var q=(s,t,e)=>bo(s,typeof t!="symbol"?t+"":t,e);import{j as b,r as H}from"./react-vendor-jWT2yUdV.js";import{t as yo,V as dt,v as il,x as vo,y as xo,z as wo,B as al,X as Xi,Y as No,D as Ao,E as Eo,b as lt,c as To,U as Co,O as Lo,Q as So,R as _o,S as Oo,T as qo}from"./index-DiaaLdUu.js";import{z as Er}from"./react-hot-toast-cGcFZPSt.js";import{c as Te,g as ll,l as Yi}from"./qface-BZLvZXJ8.js";import{t as xt}from"./chunk-6LIX6LVT-B246pOuK.js";import{u as Io}from"./use-dialog-CRIMuzeE.js";import{i as Kt}from"./chunk-2QAN2V2R-B2qCPZrG.js";import{p as $t,a as Ut,b as Ft}from"./chunk-2QQAR2RD-YG5LNmAk.js";import{d as Ro,e as jo}from"./index-_HIxriDC.js";import{t as Qi,u as ko,v as Mo}from"./index-FvTxWQTZ.js";import{n as Gs,o as Vs,p as Bo,q as Po,r as Do,s as $o}from"./index-DE7yoXMZ.js";import{g as Uo,h as Fo}from"./index-DPx4wqle.js";import{i as Ho}from"./chunk-MLPFQTYO-DSnBqIsb.js";import{p as zo}from"./index-BBhZPeTB.js";import{F as Go}from"./chunk-SLABUSGS-Cmz8sGrU.js";import{s as Vo,l as Ko}from"./chunk-KVDW62ZT-CGYYmJoP.js";import{t as Zo,a as Ji}from"./chunk-ML27DD5T-ZFWrMOn-.js";import{u as Wo,C as Ur}from"./react-hook-form-DTbqnRcd.js";import{e as ta,f as Xo}from"./code_editor-TFSnOENo.js";import{G as Yo}from"./iconBase-B7bT1FlI.js";var Hn=yo({slots:{base:"inline-flex items-center justify-between h-fit rounded-large gap-2",pre:"bg-transparent text-inherit font-mono font-normal inline-block whitespace-nowrap",content:"flex flex-col",symbol:"select-none",copyButton:["group","relative","z-10","text-large","text-inherit","data-[hover=true]:bg-transparent"],copyIcon:["absolute text-inherit opacity-100 scale-100 group-data-[copied=true]:opacity-0 group-data-[copied=true]:scale-50"],checkIcon:["absolute text-inherit opacity-0 scale-50 group-data-[copied=true]:opacity-100 group-data-[copied=true]:scale-100"]},variants:{variant:{flat:"",solid:"",bordered:"border-medium bg-transparent",shadow:""},color:{default:{},primary:{},secondary:{},success:{},warning:{},danger:{}},size:{sm:{base:"px-1.5 py-0.5 text-tiny rounded-small"},md:{base:"px-3 py-1.5 text-small rounded-medium"},lg:{base:"px-4 py-2 text-medium rounded-large"}},radius:{none:{base:"rounded-none"},sm:{base:"rounded-small"},md:{base:"rounded-medium"},lg:{base:"rounded-large"}},fullWidth:{true:{base:"w-full"}},disableAnimation:{true:{},false:{copyIcon:"transition-transform-opacity",checkIcon:"transition-transform-opacity"}}},defaultVariants:{color:"default",variant:"flat",size:"md",fullWidth:!1},compoundVariants:[{variant:["solid","shadow"],color:"default",class:{copyButton:"data-[focus-visible]:outline-default-foreground"}},{variant:["solid","shadow"],color:"primary",class:{copyButton:"data-[focus-visible]:outline-primary-foreground"}},{variant:["solid","shadow"],color:"secondary",class:{copyButton:"data-[focus-visible]:outline-secondary-foreground"}},{variant:["solid","shadow"],color:"success",class:{copyButton:"data-[focus-visible]:outline-success-foreground"}},{variant:["solid","shadow"],color:"warning",class:{copyButton:"data-[focus-visible]:outline-warning-foreground"}},{variant:["solid","shadow"],color:"danger",class:{copyButton:"data-[focus-visible]:outline-danger-foreground"}},{variant:"flat",color:"default",class:{base:dt.flat.default}},{variant:"flat",color:"primary",class:{base:dt.flat.primary}},{variant:"flat",color:"secondary",class:{base:dt.flat.secondary}},{variant:"flat",color:"success",class:{base:dt.flat.success}},{variant:"flat",color:"warning",class:{base:dt.flat.warning}},{variant:"flat",color:"danger",class:{base:dt.flat.danger}},{variant:"solid",color:"default",class:{base:dt.solid.default}},{variant:"solid",color:"primary",class:{base:dt.solid.primary}},{variant:"solid",color:"secondary",class:{base:dt.solid.secondary}},{variant:"solid",color:"success",class:{base:dt.solid.success}},{variant:"solid",color:"warning",class:{base:dt.solid.warning}},{variant:"solid",color:"danger",class:{base:dt.solid.danger}},{variant:"shadow",color:"default",class:{base:dt.shadow.default}},{variant:"shadow",color:"primary",class:{base:dt.shadow.primary}},{variant:"shadow",color:"secondary",class:{base:dt.shadow.secondary}},{variant:"shadow",color:"success",class:{base:dt.shadow.success}},{variant:"shadow",color:"warning",class:{base:dt.shadow.warning}},{variant:"shadow",color:"danger",class:{base:dt.shadow.danger}},{variant:"bordered",color:"default",class:{base:dt.bordered.default}},{variant:"bordered",color:"primary",class:{base:dt.bordered.primary}},{variant:"bordered",color:"secondary",class:{base:dt.bordered.secondary}},{variant:"bordered",color:"success",class:{base:dt.bordered.success}},{variant:"bordered",color:"warning",class:{base:dt.bordered.warning}},{variant:"bordered",color:"danger",class:{base:dt.bordered.danger}}]}),Qo=s=>b.jsxs("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:"1em",...s,children:[b.jsx("path",{d:"M16 17.1c0 3.5-1.4 4.9-4.9 4.9H6.9C3.4 22 2 20.6 2 17.1v-4.2C2 9.4 3.4 8 6.9 8h4.2c3.5 0 4.9 1.4 4.9 4.9Z"}),b.jsx("path",{d:"M8 8V6.9C8 3.4 9.4 2 12.9 2h4.2C20.6 2 22 3.4 22 6.9v4.2c0 3.5-1.4 4.9-4.9 4.9H16"}),b.jsx("path",{d:"M16 12.9C16 9.4 14.6 8 11.1 8"})]}),Jo=s=>b.jsx("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:"1em",...s,children:b.jsx("polyline",{points:"20 6 9 17 4 12"})}),tc=H.forwardRef(function(t,e){var r,n;const i=il(),l=(n=(r=t.validationBehavior)!=null?r:i==null?void 0:i.validationBehavior)!=null?n:"aria";return b.jsx(Go,{...t,ref:e,validationBehavior:l})}),ol=typeof global=="object"&&global&&global.Object===Object&&global,ec=typeof self=="object"&&self&&self.Object===Object&&self,ue=ol||ec||Function("return this")(),_e=ue.Symbol,cl=Object.prototype,rc=cl.hasOwnProperty,sc=cl.toString,Fr=_e?_e.toStringTag:void 0;function nc(s){var t=rc.call(s,Fr),e=s[Fr];try{s[Fr]=void 0;var r=!0}catch{}var n=sc.call(s);return r&&(t?s[Fr]=e:delete s[Fr]),n}var ic=Object.prototype,ac=ic.toString;function lc(s){return ac.call(s)}var oc="[object Null]",cc="[object Undefined]",ea=_e?_e.toStringTag:void 0;function Tr(s){return s==null?s===void 0?cc:oc:ea&&ea in Object(s)?nc(s):lc(s)}function me(s){return s!=null&&typeof s=="object"}var De=Array.isArray;function Oe(s){var t=typeof s;return s!=null&&(t=="object"||t=="function")}function ul(s){return s}var uc="[object AsyncFunction]",hc="[object Function]",fc="[object GeneratorFunction]",dc="[object Proxy]";function Oi(s){if(!Oe(s))return!1;var t=Tr(s);return t==hc||t==fc||t==uc||t==dc}var zn=ue["__core-js_shared__"],ra=(function(){var s=/[^.]+$/.exec(zn&&zn.keys&&zn.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function pc(s){return!!ra&&ra in s}var gc=Function.prototype,mc=gc.toString;function Fe(s){if(s!=null){try{return mc.call(s)}catch{}try{return s+""}catch{}}return""}var bc=/[\\^$.*+?()[\]{}|]/g,yc=/^\[object .+?Constructor\]$/,vc=Function.prototype,xc=Object.prototype,wc=vc.toString,Nc=xc.hasOwnProperty,Ac=RegExp("^"+wc.call(Nc).replace(bc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ec(s){if(!Oe(s)||pc(s))return!1;var t=Oi(s)?Ac:yc;return t.test(Fe(s))}function Tc(s,t){return s==null?void 0:s[t]}function He(s,t){var e=Tc(s,t);return Ec(e)?e:void 0}var ni=He(ue,"WeakMap"),sa=Object.create,Cc=(function(){function s(){}return function(t){if(!Oe(t))return{};if(sa)return sa(t);s.prototype=t;var e=new s;return s.prototype=void 0,e}})();function Lc(s,t,e){switch(e.length){case 0:return s.call(t);case 1:return s.call(t,e[0]);case 2:return s.call(t,e[0],e[1]);case 3:return s.call(t,e[0],e[1],e[2])}return s.apply(t,e)}function Sc(s,t){var e=-1,r=s.length;for(t||(t=Array(r));++e0){if(++t>=_c)return arguments[0]}else t=0;return s.apply(void 0,arguments)}}function Rc(s){return function(){return s}}var Us=(function(){try{var s=He(Object,"defineProperty");return s({},"",{}),s}catch{}})(),jc=Us?function(s,t){return Us(s,"toString",{configurable:!0,enumerable:!1,value:Rc(t),writable:!0})}:ul,kc=Ic(jc);function Mc(s,t){for(var e=-1,r=s==null?0:s.length;++e-1&&s%1==0&&s-1&&s%1==0&&s<=zc}function Ks(s){return s!=null&&dl(s.length)&&!Oi(s)}function Gc(s,t,e){if(!Oe(e))return!1;var r=typeof t;return(r=="number"?Ks(e)&&hl(t,e.length):r=="string"&&t in e)?ns(e[t],s):!1}function Vc(s){return Hc(function(t,e){var r=-1,n=e.length,i=n>1?e[n-1]:void 0,l=n>2?e[2]:void 0;for(i=s.length>3&&typeof i=="function"?(n--,i):void 0,l&&Gc(e[0],e[1],l)&&(i=n<3?void 0:i,n=1),t=Object(t);++r-1}function eh(s,t){var e=this.__data__,r=Zs(e,s);return r<0?(++this.size,e.push([s,t])):e[r][1]=t,this}function ve(s){var t=-1,e=s==null?0:s.length;for(this.clear();++to))return!1;var h=i.get(s),m=i.get(t);if(h&&m)return h==t&&m==s;var y=-1,f=!0,d=e&Vf?new Hs:void 0;for(i.set(s,t),i.set(t,s);++y(s[s.TYPE=3]="TYPE",s[s.LEVEL=12]="LEVEL",s[s.ATTRIBUTE=13]="ATTRIBUTE",s[s.BLOT=14]="BLOT",s[s.INLINE=7]="INLINE",s[s.BLOCK=11]="BLOCK",s[s.BLOCK_BLOT=10]="BLOCK_BLOT",s[s.INLINE_BLOT=6]="INLINE_BLOT",s[s.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",s[s.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",s[s.ANY=15]="ANY",s))(D||{});class oe{constructor(t,e,r={}){this.attrName=t,this.keyName=e;const n=D.TYPE&D.ATTRIBUTE;this.scope=r.scope!=null?r.scope&D.LEVEL|n:D.ATTRIBUTE,r.whitelist!=null&&(this.whitelist=r.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 mr extends Error{constructor(t){t="[Parchment] "+t,super(t),this.message=t,this.name=this.constructor.name}}const Il=class fi{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 r=null;try{r=t.parentNode}catch{return null}return this.find(r,e)}return null}create(t,e,r){const n=this.query(e);if(n==null)throw new mr(`Unable to create ${e} blot`);const i=n,l=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:i.create(r),o=new i(t,l,r);return fi.blots.set(o.domNode,o),o}find(t,e=!1){return fi.find(t,e)}query(t,e=D.ANY){let r;return typeof t=="string"?r=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?r=this.types.text:typeof t=="number"?t&D.LEVEL&D.BLOCK?r=this.types.block:t&D.LEVEL&D.INLINE&&(r=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(n=>(r=this.classes[n],!!r)),r=r||this.tags[t.tagName]),r==null?null:"scope"in r&&e&D.LEVEL&r.scope&&e&D.TYPE&r.scope?r:null}register(...t){return t.map(e=>{const r="blotName"in e,n="attrName"in e;if(!r&&!n)throw new mr("Invalid definition");if(r&&e.blotName==="abstract")throw new mr("Cannot register abstract class");const i=r?e.blotName:n?e.attrName:void 0;return this.types[i]=e,n?typeof e.keyName=="string"&&(this.attributes[e.keyName]=e):r&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(l=>l.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(l=>{(this.tags[l]==null||e.className==null)&&(this.tags[l]=e)}))),e})}};Il.blots=new WeakMap;let vr=Il;function Ca(s,t){return(s.getAttribute("class")||"").split(/\s+/).filter(e=>e.indexOf(`${t}-`)===0)}class wd extends oe{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){Ca(t,this.keyName).forEach(e=>{t.classList.remove(e)}),t.classList.length===0&&t.removeAttribute("class")}value(t){const e=(Ca(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}}const Qt=wd;function Kn(s){const t=s.split("-"),e=t.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("");return t[0]+e}class Nd extends oe{static keys(t){return(t.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(t,e){return this.canAdd(t,e)?(t.style[Kn(this.keyName)]=e,!0):!1}remove(t){t.style[Kn(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[Kn(this.keyName)];return this.canAdd(t,e)?e:""}}const qe=Nd;class Ad{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=vr.find(this.domNode);if(t==null)return;const e=oe.keys(this.domNode),r=Qt.keys(this.domNode),n=qe.keys(this.domNode);e.concat(r).concat(n).forEach(i=>{const l=t.scroll.query(i,D.ATTRIBUTE);l instanceof oe&&(this.attributes[l.attrName]=l)})}copy(t){Object.keys(this.attributes).forEach(e=>{const r=this.attributes[e].value(this.domNode);t.format(e,r)})}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 Xs=Ad,Rl=class{constructor(t,e){this.scroll=t,this.domNode=e,vr.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(this.tagName==null)throw new mr("Blot definition missing tagName");let e,r;return Array.isArray(this.tagName)?(typeof t=="string"?(r=t.toUpperCase(),parseInt(r,10).toString()===r&&(r=parseInt(r,10))):typeof t=="number"&&(r=t),typeof r=="number"?e=document.createElement(this.tagName[r-1]):r&&this.tagName.indexOf(r)>-1?e=document.createElement(r):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),vr.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,r,n){const i=this.isolate(t,e);if(this.scroll.query(r,D.BLOT)!=null&&n)i.wrap(r,n);else if(this.scroll.query(r,D.ATTRIBUTE)!=null){const l=this.scroll.create(this.statics.scope);i.wrap(l),l.format(r,n)}}insertAt(t,e,r){const n=r==null?this.scroll.create("text",e):this.scroll.create(e,r),i=this.split(t);this.parent.insertBefore(n,i||void 0)}isolate(t,e){const r=this.split(t);if(r==null)throw new Error("Attempt to isolate at end");return r.split(e),r}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 r=typeof t=="string"?this.scroll.create(t,e):t;return this.parent!=null&&(this.parent.insertBefore(r,this.next||void 0),this.remove()),r}split(t,e){return t===0?this:this.next}update(t,e){}wrap(t,e){const r=typeof t=="string"?this.scroll.create(t,e):t;if(this.parent!=null&&this.parent.insertBefore(r,this.next||void 0),typeof r.appendChild!="function")throw new mr(`Cannot wrap ${t}`);return r.appendChild(this),r}};Rl.blotName="abstract";let jl=Rl;const kl=class extends jl{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 r=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(r+=1),[this.parent.domNode,r]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};kl.scope=D.INLINE_BLOT;let Ed=kl;const Lt=Ed;class Td{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 r=e();for(;r&&t>0;)t-=1,r=e();return r}contains(t){const e=this.iterator();let r=e();for(;r;){if(r===t)return!0;r=e()}return!1}indexOf(t){const e=this.iterator();let r=e(),n=0;for(;r;){if(r===t)return n;n+=1,r=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,r=this.head;for(;r!=null;){if(r===t)return e;e+=r.length(),r=r.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 r=this.iterator();let n=r();for(;n;){const i=n.length();if(tl?r(c,t-l,Math.min(e,l+h-t)):r(c,0,Math.min(h,t+e-l)),l+=h,c=o()}}map(t){return this.reduce((e,r)=>(e.push(t(r)),e),[])}reduce(t,e){const r=this.iterator();let n=r();for(;n;)e=t(e,n),n=r();return e}}function La(s,t){const e=t.find(s);if(e)return e;try{return t.create(s)}catch{const r=t.create(D.INLINE);return Array.from(s.childNodes).forEach(n=>{r.domNode.appendChild(n)}),s.parentNode&&s.parentNode.replaceChild(r.domNode,s),r.attach(),r}}const Ml=class Ee extends jl{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,Ee.uiClass&&this.uiNode.classList.add(Ee.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new Td,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=La(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof mr)return;throw e}})}deleteAt(t,e){if(t===0&&e===this.length())return this.remove();this.children.forEachAt(t,e,(r,n,i)=>{r.deleteAt(n,i)})}descendant(t,e=0){const[r,n]=this.children.find(e);return t.blotName==null&&t(r)||t.blotName!=null&&r instanceof t?[r,n]:r instanceof Ee?r.descendant(t,n):[null,-1]}descendants(t,e=0,r=Number.MAX_VALUE){let n=[],i=r;return this.children.forEachAt(e,r,(l,o,c)=>{(t.blotName==null&&t(l)||t.blotName!=null&&l instanceof t)&&n.push(l),l instanceof Ee&&(n=n.concat(l.descendants(t,o,i))),i-=c}),n}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(e=>{t||this.statics.allowedChildren.some(r=>e instanceof r)||(e.statics.scope===D.BLOCK_BLOT?(e.next!=null&&this.splitAfter(e),e.prev!=null&&this.splitAfter(e.prev),e.parent.unwrap(),t=!0):e instanceof Ee?e.unwrap():e.remove())})}formatAt(t,e,r,n){this.children.forEachAt(t,e,(i,l,o)=>{i.formatAt(l,o,r,n)})}insertAt(t,e,r){const[n,i]=this.children.find(t);if(n)n.insertAt(i,e,r);else{const l=r==null?this.scroll.create("text",e):this.scroll.create(e,r);this.appendChild(l)}}insertBefore(t,e){t.parent!=null&&t.parent.children.remove(t);let r=null;this.children.insertBefore(t,e||null),t.parent=this,e!=null&&(r=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==r)&&this.domNode.insertBefore(t.domNode,r),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(r=>{t.insertBefore(r,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[r,n]=this.children.find(t,e),i=[[this,t]];return r instanceof Ee?i.concat(r.path(n,e)):(r!=null&&i.push([r,n]),i)}removeChild(t){this.children.remove(t)}replaceWith(t,e){const r=typeof t=="string"?this.scroll.create(t,e):t;return r instanceof Ee&&this.moveChildren(r),super.replaceWith(r)}split(t,e=!1){if(!e){if(t===0)return this;if(t===this.length())return this.next}const r=this.clone();return this.parent&&this.parent.insertBefore(r,this.next||void 0),this.children.forEachAt(t,this.length(),(n,i,l)=>{const o=n.split(i,e);o!=null&&r.appendChild(o)}),r}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 r=[],n=[];t.forEach(i=>{i.target===this.domNode&&i.type==="childList"&&(r.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 l=this.scroll.find(i);l!=null&&(l.domNode.parentNode==null||l.domNode.parentNode===this.domNode)&&l.detach()}),r.filter(i=>i.parentNode===this.domNode&&i!==this.uiNode).sort((i,l)=>i===l?0:i.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(i=>{let l=null;i.nextSibling!=null&&(l=this.scroll.find(i.nextSibling));const o=La(i,this.scroll);(o.next!==l||o.next==null)&&(o.parent!=null&&o.parent.removeChild(this),this.insertBefore(o,l||void 0))}),this.enforceAllowedChildren()}};Ml.uiClass="";let Cd=Ml;const Xt=Cd;function Ld(s,t){if(Object.keys(s).length!==Object.keys(t).length)return!1;for(const e in s)if(s[e]!==t[e])return!1;return!0}const ar=class lr extends Xt{static create(t){return super.create(t)}static formats(t,e){const r=e.query(lr.blotName);if(!(r!=null&&t.tagName===r.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 Xs(this.domNode)}format(t,e){if(t===this.statics.blotName&&!e)this.children.forEach(r=>{r instanceof lr||(r=r.wrap(lr.blotName,!0)),this.attributes.copy(r)}),this.unwrap();else{const r=this.scroll.query(t,D.INLINE);if(r==null)return;r instanceof oe?this.attributes.attribute(r,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,r,n){this.formats()[r]!=null||this.scroll.query(r,D.ATTRIBUTE)?this.isolate(t,e).format(r,n):super.formatAt(t,e,r,n)}optimize(t){super.optimize(t);const e=this.formats();if(Object.keys(e).length===0)return this.unwrap();const r=this.next;r instanceof lr&&r.prev===this&&Ld(e,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(t,e){const r=super.replaceWith(t,e);return this.attributes.copy(r),r}update(t,e){super.update(t,e),t.some(r=>r.target===this.domNode&&r.type==="attributes")&&this.attributes.build()}wrap(t,e){const r=super.wrap(t,e);return r instanceof lr&&this.attributes.move(r),r}};ar.allowedChildren=[ar,Lt],ar.blotName="inline",ar.scope=D.INLINE_BLOT,ar.tagName="SPAN";let Sd=ar;const Bi=Sd,or=class di extends Xt{static create(t){return super.create(t)}static formats(t,e){const r=e.query(di.blotName);if(!(r!=null&&t.tagName===r.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 Xs(this.domNode)}format(t,e){const r=this.scroll.query(t,D.BLOCK);r!=null&&(r instanceof oe?this.attributes.attribute(r,e):t===this.statics.blotName&&!e?this.replaceWith(di.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,r,n){this.scroll.query(r,D.BLOCK)!=null?this.format(r,n):super.formatAt(t,e,r,n)}insertAt(t,e,r){if(r==null||this.scroll.query(e,D.INLINE)!=null)super.insertAt(t,e,r);else{const n=this.split(t);if(n!=null){const i=this.scroll.create(e,r);n.parent.insertBefore(i,n)}else throw new Error("Attempt to insertAt after block boundaries")}}replaceWith(t,e){const r=super.replaceWith(t,e);return this.attributes.copy(r),r}update(t,e){super.update(t,e),t.some(r=>r.target===this.domNode&&r.type==="attributes")&&this.attributes.build()}};or.blotName="block",or.scope=D.BLOCK_BLOT,or.tagName="P",or.allowedChildren=[Bi,or,Lt];let _d=or;const ts=_d,pi=class extends Xt{checkMerge(){return this.next!==null&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,r,n){super.formatAt(t,e,r,n),this.enforceAllowedChildren()}insertAt(t,e,r){super.insertAt(t,e,r),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};pi.blotName="container",pi.scope=D.BLOCK_BLOT;let Od=pi;const Ys=Od;class qd extends Lt{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,r,n){t===0&&e===this.length()?this.format(r,n):super.formatAt(t,e,r,n)}formats(){return this.statics.formats(this.domNode,this.scroll)}}const Rt=qd,Id={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},Rd=100,cr=class extends Xt{constructor(t,e){super(null,e),this.registry=t,this.scroll=this,this.build(),this.observer=new MutationObserver(r=>{this.update(r)}),this.observer.observe(this.domNode,Id),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const r=this.registry.find(t,e);return r?r.scroll===this?r:e?this.find(r.scroll.domNode.parentNode,!0):null:null}query(t,e=D.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(r=>{r.remove()}):super.deleteAt(t,e)}formatAt(t,e,r,n){this.update(),super.formatAt(t,e,r,n)}insertAt(t,e,r){this.update(),super.insertAt(t,e,r)}optimize(t=[],e={}){super.optimize(e);const r=e.mutationsMap||new WeakMap;let n=Array.from(this.observer.takeRecords());for(;n.length>0;)t.push(n.pop());const i=(c,h=!0)=>{c==null||c===this||c.domNode.parentNode!=null&&(r.has(c.domNode)||r.set(c.domNode,[]),h&&i(c.parent))},l=c=>{r.has(c.domNode)&&(c instanceof Xt&&c.children.forEach(l),r.delete(c.domNode),c.optimize(e))};let o=t;for(let c=0;o.length>0;c+=1){if(c>=Rd)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(h=>{const m=this.find(h.target,!0);m!=null&&(m.domNode===h.target&&(h.type==="childList"?(i(this.find(h.previousSibling,!1)),Array.from(h.addedNodes).forEach(y=>{const f=this.find(y,!1);i(f,!1),f instanceof Xt&&f.children.forEach(d=>{i(d,!1)})})):h.type==="attributes"&&i(m.prev)),i(m))}),this.children.forEach(l),o=Array.from(this.observer.takeRecords()),n=o.slice();n.length>0;)t.push(n.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const r=new WeakMap;t.map(n=>{const i=this.find(n.target,!0);return i==null?null:r.has(i.domNode)?(r.get(i.domNode).push(n),null):(r.set(i.domNode,[n]),i)}).forEach(n=>{n!=null&&n!==this&&r.has(n.domNode)&&n.update(r.get(n.domNode)||[],e)}),e.mutationsMap=r,r.has(this.domNode)&&super.update(r.get(this.domNode),e),this.optimize(t,e)}};cr.blotName="scroll",cr.defaultChild=ts,cr.allowedChildren=[ts,Ys],cr.scope=D.BLOCK_BLOT,cr.tagName="DIV";let jd=cr;const Pi=jd,gi=class Bl extends Lt{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,r){r==null?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,r)}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 Bl&&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 r=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(r,this.next||void 0),this.text=this.statics.value(this.domNode),r}update(t,e){t.some(r=>r.type==="characterData"&&r.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};gi.blotName="text",gi.scope=D.INLINE_BLOT;let kd=gi;const zs=kd,Md=Object.freeze(Object.defineProperty({__proto__:null,Attributor:oe,AttributorStore:Xs,BlockBlot:ts,ClassAttributor:Qt,ContainerBlot:Ys,EmbedBlot:Rt,InlineBlot:Bi,LeafBlot:Lt,ParentBlot:Xt,Registry:vr,Scope:D,ScrollBlot:Pi,StyleAttributor:qe,TextBlot:zs},Symbol.toStringTag,{value:"Module"}));var _s={exports:{}},Zn,Sa;function Bd(){if(Sa)return Zn;Sa=1;var s=-1,t=1,e=0;function r(g,L,x,I,S){if(g===L)return g?[[e,g]]:[];if(x!=null){var C=pt(g,L,x);if(C)return C}var _=o(g,L),B=g.substring(0,_);g=g.substring(_),L=L.substring(_),_=h(g,L);var $=g.substring(g.length-_);g=g.substring(0,g.length-_),L=L.substring(0,L.length-_);var R=n(g,L);return B&&R.unshift([e,B]),$&&R.push([e,$]),O(R,S),I&&y(R),R}function n(g,L){var x;if(!g)return[[t,L]];if(!L)return[[s,g]];var I=g.length>L.length?g:L,S=g.length>L.length?L:g,C=I.indexOf(S);if(C!==-1)return x=[[t,I.substring(0,C)],[e,S],[t,I.substring(C+S.length)]],g.length>L.length&&(x[0][0]=x[2][0]=s),x;if(S.length===1)return[[s,g],[t,L]];var _=m(g,L);if(_){var B=_[0],$=_[1],R=_[2],K=_[3],G=_[4],Z=r(B,R),Y=r($,K);return Z.concat([[e,G]],Y)}return i(g,L)}function i(g,L){for(var x=g.length,I=L.length,S=Math.ceil((x+I)/2),C=S,_=2*S,B=new Array(_),$=new Array(_),R=0;R<_;R++)B[R]=-1,$[R]=-1;B[C+1]=0,$[C+1]=0;for(var K=x-I,G=K%2!==0,Z=0,Y=0,U=0,ct=0,ut=0;utx)Y+=2;else if(et>I)Z+=2;else if(G){var it=C+K-W;if(it>=0&&it<_&&$[it]!==-1){var rt=x-$[it];if(Q>=rt)return l(g,L,Q,et)}}}for(var mt=-ut+U;mt<=ut-ct;mt+=2){var it=C+mt,rt;mt===-ut||mt!==ut&&$[it-1]<$[it+1]?rt=$[it+1]:rt=$[it-1]+1;for(var yt=rt-mt;rtx)ct+=2;else if(yt>I)U+=2;else if(!G){var nt=C+K-mt;if(nt>=0&&nt<_&&B[nt]!==-1){var Q=B[nt],et=C+Q-nt;if(rt=x-rt,Q>=rt)return l(g,L,Q,et)}}}}return[[s,g],[t,L]]}function l(g,L,x,I){var S=g.substring(0,x),C=L.substring(0,I),_=g.substring(x),B=L.substring(I),$=r(S,C),R=r(_,B);return $.concat(R)}function o(g,L){if(!g||!L||g.charAt(0)!==L.charAt(0))return 0;for(var x=0,I=Math.min(g.length,L.length),S=I,C=0;xI?g=g.substring(x-I):xL.length?g:L,I=g.length>L.length?L:g;if(x.length<4||I.length*2=Y.length?[Q,et,it,rt,nt]:null}var C=S(x,I,Math.ceil(x.length/4)),_=S(x,I,Math.ceil(x.length/2)),B;if(!C&&!_)return null;_?C?B=C[4].length>_[4].length?C:_:B=_:B=C;var $,R,K,G;g.length>L.length?($=B[0],R=B[1],K=B[2],G=B[3]):(K=B[0],G=B[1],$=B[2],R=B[3]);var Z=B[4];return[$,R,K,G,Z]}function y(g){for(var L=!1,x=[],I=0,S=null,C=0,_=0,B=0,$=0,R=0;C0?x[I-1]:-1,_=0,B=0,$=0,R=0,S=null,L=!0)),C++;for(L&&O(g),T(g),C=1;C=Y?(Z>=K.length/2||Z>=G.length/2)&&(g.splice(C,0,[e,G.substring(0,Z)]),g[C-1][1]=K.substring(0,K.length-Z),g[C+1][1]=G.substring(Z),C++):(Y>=K.length/2||Y>=G.length/2)&&(g.splice(C,0,[e,K.substring(0,Y)]),g[C-1][0]=t,g[C-1][1]=G.substring(0,G.length-Y),g[C+1][0]=s,g[C+1][1]=K.substring(Y),C++),C++}C++}}var f=/[^a-zA-Z0-9]/,d=/\s/,v=/[\r\n]/,w=/\n\r?\n$/,N=/^\r?\n\r?\n/;function T(g){function L(Y,U){if(!Y||!U)return 6;var ct=Y.charAt(Y.length-1),ut=U.charAt(0),W=ct.match(f),nt=ut.match(f),Q=W&&ct.match(d),et=nt&&ut.match(d),it=Q&&ct.match(v),rt=et&&ut.match(v),mt=it&&Y.match(w),yt=rt&&U.match(N);return mt||yt?5:it||rt?4:W&&!Q&&et?3:Q||et?2:W||nt?1:0}for(var x=1;x=G&&(G=Z,$=I,R=S,K=C)}g[x-1][1]!=$&&($?g[x-1][1]=$:(g.splice(x-1,1),x--),g[x][1]=R,K?g[x+1][1]=K:(g.splice(x+1,1),x--))}x++}}function O(g,L){g.push([e,""]);for(var x=0,I=0,S=0,C="",_="",B;x=0&&V(g[$][1])){var R=g[$][1].slice(-1);if(g[$][1]=g[$][1].slice(0,-1),C=R+C,_=R+_,!g[$][1]){g.splice($,1),x--;var K=$-1;g[K]&&g[K][0]===t&&(S++,_=g[K][1]+_,K--),g[K]&&g[K][0]===s&&(I++,C=g[K][1]+C,K--),$=K}}if(j(g[x][1])){var R=g[x][1].charAt(0);g[x][1]=g[x][1].slice(1),C+=R,_+=R}}if(x0||_.length>0){C.length>0&&_.length>0&&(B=o(_,C),B!==0&&($>=0?g[$][1]+=_.substring(0,B):(g.splice(0,0,[e,_.substring(0,B)]),x++),_=_.substring(B),C=C.substring(B)),B=h(_,C),B!==0&&(g[x][1]=_.substring(_.length-B)+g[x][1],_=_.substring(0,_.length-B),C=C.substring(0,C.length-B)));var G=S+I;C.length===0&&_.length===0?(g.splice(x-G,G),x=x-G):C.length===0?(g.splice(x-G,G,[t,_]),x=x-G+1):_.length===0?(g.splice(x-G,G,[s,C]),x=x-G+1):(g.splice(x-G,G,[s,C],[t,_]),x=x-G+2)}x!==0&&g[x-1][0]===e?(g[x-1][1]+=g[x][1],g.splice(x,1)):x++,S=0,I=0,C="",_="";break}}g[g.length-1][1]===""&&g.pop();var Z=!1;for(x=1;x=55296&&g<=56319}function z(g){return g>=56320&&g<=57343}function j(g){return z(g.charCodeAt(0))}function V(g){return k(g.charCodeAt(g.length-1))}function tt(g){for(var L=[],x=0;x0&&L.push(g[x]);return L}function J(g,L,x,I){return V(g)||j(I)?null:tt([[e,g],[s,L],[t,x],[e,I]])}function pt(g,L,x){var I=typeof x=="number"?{index:x,length:0}:x.oldRange,S=typeof x=="number"?null:x.newRange,C=g.length,_=L.length;if(I.length===0&&(S===null||S.length===0)){var B=I.index,$=g.slice(0,B),R=g.slice(B),K=S?S.index:null;t:{var G=B+_-C;if(K!==null&&K!==G||G<0||G>_)break t;var Z=L.slice(0,G),Y=L.slice(G);if(Y!==R)break t;var U=Math.min(B,G),ct=$.slice(0,U),ut=Z.slice(0,U);if(ct!==ut)break t;var W=$.slice(U),nt=Z.slice(U);return J(ct,W,nt,R)}t:{if(K!==null&&K!==B)break t;var Q=B,Z=L.slice(0,Q),Y=L.slice(Q);if(Z!==$)break t;var et=Math.min(C-Q,_-Q),it=R.slice(R.length-et),rt=Y.slice(Y.length-et);if(it!==rt)break t;var W=R.slice(0,R.length-et),nt=Y.slice(0,Y.length-et);return J($,W,nt,it)}}if(I.length>0&&S&&S.length===0)t:{var ct=g.slice(0,I.index),it=g.slice(I.index+I.length),U=ct.length,et=it.length;if(_-1}function dn(a,u){var p=this.__data__,A=rr(p,a);return A<0?p.push([a,u]):p[A][1]=u,this}wt.prototype.clear=cn,wt.prototype.delete=un,wt.prototype.get=hn,wt.prototype.has=fn,wt.prototype.set=dn;function Et(a){var u=-1,p=a?a.length:0;for(this.clear();++u-1&&a%1==0&&a-1&&a%1==0&&a<=n}function ne(a){var u=typeof a;return!!a&&(u=="object"||u=="function")}function Ts(a){return!!a&&typeof a=="object"}function $r(a){return ir(a)?er(a):Sn(a)}function Un(){return[]}function Fn(){return!1}s.exports=ws})(zr,zr.exports)),zr.exports}var Gr={exports:{}};Gr.exports;var Oa;function Dl(){return Oa||(Oa=1,(function(s,t){var e=200,r="__lodash_hash_undefined__",n=1,i=2,l=9007199254740991,o="[object Arguments]",c="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",y="[object Date]",f="[object Error]",d="[object Function]",v="[object GeneratorFunction]",w="[object Map]",N="[object Number]",T="[object Null]",O="[object Object]",k="[object Promise]",z="[object Proxy]",j="[object RegExp]",V="[object Set]",tt="[object String]",J="[object Symbol]",pt="[object Undefined]",gt="[object WeakMap]",g="[object ArrayBuffer]",L="[object DataView]",x="[object Float32Array]",I="[object Float64Array]",S="[object Int8Array]",C="[object Int16Array]",_="[object Int32Array]",B="[object Uint8Array]",$="[object Uint8ClampedArray]",R="[object Uint16Array]",K="[object Uint32Array]",G=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,Y=/^(?:0|[1-9]\d*)$/,U={};U[x]=U[I]=U[S]=U[C]=U[_]=U[B]=U[$]=U[R]=U[K]=!0,U[o]=U[c]=U[g]=U[m]=U[L]=U[y]=U[f]=U[d]=U[w]=U[N]=U[O]=U[j]=U[V]=U[tt]=U[gt]=!1;var ct=typeof Te=="object"&&Te&&Te.Object===Object&&Te,ut=typeof self=="object"&&self&&self.Object===Object&&self,W=ct||ut||Function("return this")(),nt=t&&!t.nodeType&&t,Q=nt&&!0&&s&&!s.nodeType&&s,et=Q&&Q.exports===nt,it=et&&ct.process,rt=(function(){try{return it&&it.binding&&it.binding("util")}catch{}})(),mt=rt&&rt.isTypedArray;function yt(a,u){for(var p=-1,A=a==null?0:a.length,X=0,F=[];++p-1}function yn(a,u){var p=this.__data__,A=sr(p,a);return A<0?(++this.size,p.push([a,u])):p[A][1]=u,this}Et.prototype.clear=pn,Et.prototype.delete=gn,Et.prototype.get=mn,Et.prototype.has=bn,Et.prototype.set=yn;function Ot(a){var u=-1,p=a==null?0:a.length;for(this.clear();++ust))return!1;var ot=F.get(a);if(ot&&F.get(u))return ot==u;var Tt=-1,qt=!0,vt=p&i?new er:void 0;for(F.set(a,u),F.set(u,a);++Tt-1&&a%1==0&&a-1&&a%1==0&&a<=l}function Es(a){var u=typeof a;return a!=null&&(u=="object"||u=="function")}function ne(a){return a!=null&&typeof a=="object"}var Ts=mt?rn(mt):qn;function $r(a){return Pr(a)?Sn(a):In(a)}function Un(){return[]}function Fn(){return!1}s.exports=$n})(Gr,Gr.exports)),Gr.exports}var Os={},qa;function Pd(){if(qa)return Os;qa=1,Object.defineProperty(Os,"__esModule",{value:!0});const s=Pl(),t=Dl();var e;return(function(r){function n(c={},h={},m=!1){typeof c!="object"&&(c={}),typeof h!="object"&&(h={});let y=s(h);m||(y=Object.keys(y).reduce((f,d)=>(y[d]!=null&&(f[d]=y[d]),f),{}));for(const f in c)c[f]!==void 0&&h[f]===void 0&&(y[f]=c[f]);return Object.keys(y).length>0?y:void 0}r.compose=n;function i(c={},h={}){typeof c!="object"&&(c={}),typeof h!="object"&&(h={});const m=Object.keys(c).concat(Object.keys(h)).reduce((y,f)=>(t(c[f],h[f])||(y[f]=h[f]===void 0?null:h[f]),y),{});return Object.keys(m).length>0?m:void 0}r.diff=i;function l(c={},h={}){c=c||{};const m=Object.keys(h).reduce((y,f)=>(h[f]!==c[f]&&c[f]!==void 0&&(y[f]=h[f]),y),{});return Object.keys(c).reduce((y,f)=>(c[f]!==h[f]&&h[f]===void 0&&(y[f]=null),y),m)}r.invert=l;function o(c,h,m=!1){if(typeof c!="object")return h;if(typeof h!="object")return;if(!m)return h;const y=Object.keys(h).reduce((f,d)=>(c[d]===void 0&&(f[d]=h[d]),f),{});return Object.keys(y).length>0?y:void 0}r.transform=o})(e||(e={})),Os.default=e,Os}var qs={},Ia;function $l(){if(Ia)return qs;Ia=1,Object.defineProperty(qs,"__esModule",{value:!0});var s;return(function(t){function e(r){return typeof r.delete=="number"?r.delete:typeof r.retain=="number"?r.retain:typeof r.retain=="object"&&r.retain!==null?1:typeof r.insert=="string"?r.insert.length:1}t.length=e})(s||(s={})),qs.default=s,qs}var Is={},Ra;function Dd(){if(Ra)return Is;Ra=1,Object.defineProperty(Is,"__esModule",{value:!0});const s=$l();class t{constructor(r){this.ops=r,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(r){r||(r=1/0);const n=this.ops[this.index];if(n){const i=this.offset,l=s.default.length(n);if(r>=l-i?(r=l-i,this.index+=1,this.offset=0):this.offset+=r,typeof n.delete=="number")return{delete:r};{const o={};return n.attributes&&(o.attributes=n.attributes),typeof n.retain=="number"?o.retain=r:typeof n.retain=="object"&&n.retain!==null?o.retain=n.retain:typeof n.insert=="string"?o.insert=n.insert.substr(i,r):o.insert=n.insert,o}}else return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?s.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const r=this.ops[this.index];return r?typeof r.delete=="number"?"delete":typeof r.retain=="number"||typeof r.retain=="object"&&r.retain!==null?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);{const r=this.offset,n=this.index,i=this.next(),l=this.ops.slice(this.index);return this.offset=r,this.index=n,[i].concat(l)}}else return[]}}return Is.default=t,Is}var ja;function $d(){return ja||(ja=1,(function(s,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const e=Bd(),r=Pl(),n=Dl(),i=Pd();t.AttributeMap=i.default;const l=$l();t.Op=l.default;const o=Dd();t.OpIterator=o.default;const c="\0",h=(y,f)=>{if(typeof y!="object"||y===null)throw new Error(`cannot retain a ${typeof y}`);if(typeof f!="object"||f===null)throw new Error(`cannot retain a ${typeof f}`);const d=Object.keys(y)[0];if(!d||d!==Object.keys(f)[0])throw new Error(`embed types not matched: ${d} != ${Object.keys(f)[0]}`);return[d,y[d],f[d]]};class m{constructor(f){Array.isArray(f)?this.ops=f:f!=null&&Array.isArray(f.ops)?this.ops=f.ops:this.ops=[]}static registerEmbed(f,d){this.handlers[f]=d}static unregisterEmbed(f){delete this.handlers[f]}static getHandler(f){const d=this.handlers[f];if(!d)throw new Error(`no handlers for embed type "${f}"`);return d}insert(f,d){const v={};return typeof f=="string"&&f.length===0?this:(v.insert=f,d!=null&&typeof d=="object"&&Object.keys(d).length>0&&(v.attributes=d),this.push(v))}delete(f){return f<=0?this:this.push({delete:f})}retain(f,d){if(typeof f=="number"&&f<=0)return this;const v={retain:f};return d!=null&&typeof d=="object"&&Object.keys(d).length>0&&(v.attributes=d),this.push(v)}push(f){let d=this.ops.length,v=this.ops[d-1];if(f=r(f),typeof v=="object"){if(typeof f.delete=="number"&&typeof v.delete=="number")return this.ops[d-1]={delete:v.delete+f.delete},this;if(typeof v.delete=="number"&&f.insert!=null&&(d-=1,v=this.ops[d-1],typeof v!="object"))return this.ops.unshift(f),this;if(n(f.attributes,v.attributes)){if(typeof f.insert=="string"&&typeof v.insert=="string")return this.ops[d-1]={insert:v.insert+f.insert},typeof f.attributes=="object"&&(this.ops[d-1].attributes=f.attributes),this;if(typeof f.retain=="number"&&typeof v.retain=="number")return this.ops[d-1]={retain:v.retain+f.retain},typeof f.attributes=="object"&&(this.ops[d-1].attributes=f.attributes),this}}return d===this.ops.length?this.ops.push(f):this.ops.splice(d,0,f),this}chop(){const f=this.ops[this.ops.length-1];return f&&typeof f.retain=="number"&&!f.attributes&&this.ops.pop(),this}filter(f){return this.ops.filter(f)}forEach(f){this.ops.forEach(f)}map(f){return this.ops.map(f)}partition(f){const d=[],v=[];return this.forEach(w=>{(f(w)?d:v).push(w)}),[d,v]}reduce(f,d){return this.ops.reduce(f,d)}changeLength(){return this.reduce((f,d)=>d.insert?f+l.default.length(d):d.delete?f-d.delete:f,0)}length(){return this.reduce((f,d)=>f+l.default.length(d),0)}slice(f=0,d=1/0){const v=[],w=new o.default(this.ops);let N=0;for(;N0&&v.next(N.retain-O)}const T=new m(w);for(;d.hasNext()||v.hasNext();)if(v.peekType()==="insert")T.push(v.next());else if(d.peekType()==="delete")T.push(d.next());else{const O=Math.min(d.peekLength(),v.peekLength()),k=d.next(O),z=v.next(O);if(z.retain){const j={};if(typeof k.retain=="number")j.retain=typeof z.retain=="number"?O:z.retain;else if(typeof z.retain=="number")k.retain==null?j.insert=k.insert:j.retain=k.retain;else{const tt=k.retain==null?"insert":"retain",[J,pt,gt]=h(k[tt],z.retain),g=m.getHandler(J);j[tt]={[J]:g.compose(pt,gt,tt==="retain")}}const V=i.default.compose(k.attributes,z.attributes,typeof k.retain=="number");if(V&&(j.attributes=V),T.push(j),!v.hasNext()&&n(T.ops[T.ops.length-1],j)){const tt=new m(d.rest());return T.concat(tt).chop()}}else typeof z.delete=="number"&&(typeof k.retain=="number"||typeof k.retain=="object"&&k.retain!==null)&&T.push(z)}return T.chop()}concat(f){const d=new m(this.ops.slice());return f.ops.length>0&&(d.push(f.ops[0]),d.ops=d.ops.concat(f.ops.slice(1))),d}diff(f,d){if(this.ops===f.ops)return new m;const v=[this,f].map(k=>k.map(z=>{if(z.insert!=null)return typeof z.insert=="string"?z.insert:c;const j=k===f?"on":"with";throw new Error("diff() called "+j+" non-document")}).join("")),w=new m,N=e(v[0],v[1],d,!0),T=new o.default(this.ops),O=new o.default(f.ops);return N.forEach(k=>{let z=k[1].length;for(;z>0;){let j=0;switch(k[0]){case e.INSERT:j=Math.min(O.peekLength(),z),w.push(O.next(j));break;case e.DELETE:j=Math.min(z,T.peekLength()),T.next(j),w.delete(j);break;case e.EQUAL:j=Math.min(T.peekLength(),O.peekLength(),z);const V=T.next(j),tt=O.next(j);n(V.insert,tt.insert)?w.retain(j,i.default.diff(V.attributes,tt.attributes)):w.push(tt).delete(j);break}z-=j}}),w.chop()}eachLine(f,d=` `){const v=new o.default(this.ops);let w=new m,N=0;for(;v.hasNext();){if(v.peekType()!=="insert")return;const T=v.peek(),O=l.default.length(T)-v.peekLength(),k=typeof T.insert=="string"?T.insert.indexOf(d,O)-O:-1;if(k<0)w.push(v.next());else if(k>0)w.push(v.next(k));else{if(f(w,v.next(1).attributes||{},N)===!1)return;N+=1,w=new m}}w.length()>0&&f(w,{},N)}invert(f){const d=new m;return this.reduce((v,w)=>{if(w.insert)d.delete(l.default.length(w));else{if(typeof w.retain=="number"&&w.attributes==null)return d.retain(w.retain),v+w.retain;if(w.delete||typeof w.retain=="number"){const N=w.delete||w.retain;return f.slice(v,v+N).forEach(O=>{w.delete?d.push(O):w.retain&&w.attributes&&d.retain(l.default.length(O),i.default.invert(w.attributes,O.attributes))}),v+N}else if(typeof w.retain=="object"&&w.retain!==null){const N=f.slice(v,v+1),T=new o.default(N.ops).next(),[O,k,z]=h(w.retain,T.insert),j=m.getHandler(O);return d.retain({[O]:j.invert(k,z)},i.default.invert(w.attributes,T.attributes)),v+1}}return v},0),d.chop()}transform(f,d=!1){if(d=!!d,typeof f=="number")return this.transformPosition(f,d);const v=f,w=new o.default(this.ops),N=new o.default(v.ops),T=new m;for(;w.hasNext()||N.hasNext();)if(w.peekType()==="insert"&&(d||N.peekType()!=="insert"))T.retain(l.default.length(w.next()));else if(N.peekType()==="insert")T.push(N.next());else{const O=Math.min(w.peekLength(),N.peekLength()),k=w.next(O),z=N.next(O);if(k.delete)continue;if(z.delete)T.push(z);else{const j=k.retain,V=z.retain;let tt=typeof V=="object"&&V!==null?V:O;if(typeof j=="object"&&j!==null&&typeof V=="object"&&V!==null){const J=Object.keys(j)[0];if(J===Object.keys(V)[0]){const pt=m.getHandler(J);pt&&(tt={[J]:pt.transform(j[J],V[J],d)})}}T.retain(tt,i.default.transform(k.attributes,z.attributes,d))}}return T.chop()}transformPosition(f,d=!1){d=!!d;const v=new o.default(this.ops);let w=0;for(;v.hasNext()&&w<=f;){const N=v.peekLength(),T=v.peekType();if(v.next(),T==="delete"){f-=Math.min(N,f-w);continue}else T==="insert"&&(w":">",'"':""","'":"'"};function Qs(s){return s.replace(/[&<>"']/g,t=>Ud[t])}const ie=class ie extends Bi{static compare(t,e){const r=ie.order.indexOf(t),n=ie.order.indexOf(e);return r>=0||n>=0?r-n:t===e?0:t0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};q(ie,"allowedChildren",[ie,Jt,Rt,Yt]),q(ie,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let ce=ie;const ka=1;class At extends ts{constructor(){super(...arguments);q(this,"cache",{})}delta(){return this.cache.delta==null&&(this.cache.delta=Ul(this)),this.cache.delta}deleteAt(e,r){super.deleteAt(e,r),this.cache={}}formatAt(e,r,n,i){r<=0||(this.scroll.query(n,D.BLOCK)?e+r===this.length()&&this.format(n,i):super.formatAt(e,Math.min(r,this.length()-e-1),n,i),this.cache={})}insertAt(e,r,n){if(n!=null){super.insertAt(e,r,n),this.cache={};return}if(r.length===0)return;const i=r.split(` `),l=i.shift();l.length>0&&(e(o=o.split(c,!0),o.insertAt(0,h),h.length),e+l.length)}insertBefore(e,r){const{head:n}=this.children;super.insertBefore(e,r),n instanceof Jt&&n.remove(),this.cache={}}length(){return this.cache.length==null&&(this.cache.length=super.length()+ka),this.cache.length}moveChildren(e,r){super.moveChildren(e,r),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 r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(r&&(e===0||e>=this.length()-ka)){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,r);return this.cache={},n}}At.blotName="block";At.tagName="P";At.defaultChild=Jt;At.allowedChildren=[Jt,ce,Rt,Yt];let Pt=class extends Rt{attach(){super.attach(),this.attributes=new Xs(this.domNode)}delta(){return new P().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const r=this.scroll.query(t,D.BLOCK_ATTRIBUTE);r!=null&&this.attributes.attribute(r,e)}formatAt(t,e,r,n){this.format(r,n)}insertAt(t,e,r){if(r!=null){super.insertAt(t,e,r);return}const n=e.split(` `),i=n.pop(),l=n.map(c=>{const h=this.scroll.create(At.blotName);return h.insertAt(0,c),h}),o=this.split(t);l.forEach(c=>{this.parent.insertBefore(c,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}};Pt.scope=D.BLOCK_BLOT;function Ul(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return s.descendants(Lt).reduce((e,r)=>r.length()===0?e:e.insert(r.value(),Mt(r,{},t)),new P).insert(` `,Mt(s))}function Mt(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return s==null||("formats"in s&&typeof s.formats=="function"&&(t={...t,...s.formats()},e&&delete t["code-token"]),s.parent==null||s.parent.statics.blotName==="scroll"||s.parent.statics.scope!==s.statics.scope)?t:Mt(s.parent,t,e)}const kt=class kt extends Rt{static value(){}constructor(t,e,r){super(t,e),this.selection=r,this.textNode=document.createTextNode(kt.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 r=this,n=0;for(;r!=null&&r.statics.scope!==D.BLOCK_BLOT;)n+=r.offset(r.parent),r=r.parent;r!=null&&(this.savedLength=kt.CONTENTS.length,r.optimize(),r.formatAt(n,kt.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 Yt?this.prev:null,r=e?e.length():0,n=this.next instanceof Yt?this.next:null,i=n?n.text:"",{textNode:l}=this,o=l.data.split(kt.CONTENTS).join("");l.data=kt.CONTENTS;let c;if(e)c=e,(o||n)&&(e.insertAt(e.length(),o+i),n&&n.remove());else if(n)c=n,n.insertAt(0,o);else{const h=document.createTextNode(o);c=this.scroll.create(h),this.parent.insertBefore(c,this)}if(this.remove(),t){const h=(f,d)=>e&&f===e.domNode?d:f===l?r+d-1:n&&f===n.domNode?r+o.length+d:null,m=h(t.start.node,t.start.offset),y=h(t.end.node,t.end.offset);if(m!==null&&y!==null)return{startNode:c.domNode,startOffset:m,endNode:c.domNode,endOffset:y}}return null}update(t,e){if(t.some(r=>r.type==="characterData"&&r.target===this.textNode)){const r=this.restore();r&&(e.range=r)}}optimize(t){super.optimize(t);let{parent:e}=this;for(;e;){if(e.domNode.tagName==="A"){this.savedLength=kt.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}};q(kt,"blotName","cursor"),q(kt,"className","ql-cursor"),q(kt,"tagName","span"),q(kt,"CONTENTS","\uFEFF");let xr=kt;var Wn={exports:{}},Ma;function Fd(){return Ma||(Ma=1,(function(s){var t=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function n(c,h,m){this.fn=c,this.context=h,this.once=m||!1}function i(c,h,m,y,f){if(typeof m!="function")throw new TypeError("The listener must be a function");var d=new n(m,y||c,f),v=e?e+h:h;return c._events[v]?c._events[v].fn?c._events[v]=[c._events[v],d]:c._events[v].push(d):(c._events[v]=d,c._eventsCount++),c}function l(c,h){--c._eventsCount===0?c._events=new r:delete c._events[h]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var h=[],m,y;if(this._eventsCount===0)return h;for(y in m=this._events)t.call(m,y)&&h.push(e?y.slice(1):y);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(m)):h},o.prototype.listeners=function(h){var m=e?e+h:h,y=this._events[m];if(!y)return[];if(y.fn)return[y.fn];for(var f=0,d=y.length,v=new Array(d);f1?t-1:0),r=1;r(t[e]=Fl.bind(console,e,s),t),{})}xe.level=s=>{yi=s};Fl.level=xe.level;const Xn=xe("quill:events"),Gd=["selectionchange","mousedown","mouseup","click"];Gd.forEach(s=>{document.addEventListener(s,function(){for(var t=arguments.length,e=new Array(t),r=0;r{const i=mi.get(n);i&&i.emitter&&i.emitter.handleDOM(...e)})})});class M extends zd{constructor(){super(),this.domListeners={},this.on("error",Xn.error)}emit(){for(var t=arguments.length,e=new Array(t),r=0;r1?e-1:0),n=1;n{let{node:l,handler:o}=i;(t.target===l||l.contains(t.target))&&o(t,...r)})}listenDOM(t,e,r){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:r})}}q(M,"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(M,"sources",{API:"api",SILENT:"silent",USER:"user"});const Yn=xe("quill:selection");class Ue{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=t,this.length=e}}class Vd{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 Ue(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,M.sources.USER),1)}),this.emitter.on(M.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const r=this.getNativeRange();r!=null&&r.start.node!==this.cursor.textNode&&this.emitter.once(M.events.SCROLL_UPDATE,(n,i)=>{try{this.root.contains(r.start.node)&&this.root.contains(r.end.node)&&this.setNativeRange(r.start.node,r.start.offset,r.end.node,r.end.offset);const l=i.some(o=>o.type==="characterData"||o.type==="childList"||o.type==="attributes"&&o.target===this.root);this.update(l?M.sources.SILENT:n)}catch{}})}),this.emitter.on(M.events.SCROLL_OPTIMIZE,(r,n)=>{if(n.range){const{startNode:i,startOffset:l,endNode:o,endOffset:c}=n.range;this.setNativeRange(i,l,o,c),this.update(M.sources.SILENT)}}),this.update(M.sources.SILENT)}handleComposition(){this.emitter.on(M.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(M.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(M.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const r=this.getNativeRange();if(!(r==null||!r.native.collapsed||this.scroll.query(t,D.BLOCK))){if(r.start.node!==this.cursor.textNode){const n=this.scroll.find(r.start.node,!1);if(n==null)return;if(n instanceof Lt){const i=n.split(r.start.offset);n.parent.insertBefore(this.cursor,i)}else n.insertBefore(this.cursor,r.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 r=this.scroll.length();t=Math.min(t,r-1),e=Math.min(t+e,r-1)-t;let n,[i,l]=this.scroll.leaf(t);if(i==null)return null;if(e>0&&l===i.length()){const[m]=this.scroll.leaf(t+1);if(m){const[y]=this.scroll.line(t),[f]=this.scroll.line(t+1);y===f&&(i=m,l=0)}}[n,l]=i.position(l,!0);const o=document.createRange();if(e>0)return o.setStart(n,l),[i,l]=this.scroll.leaf(t+e),i==null?null:([n,l]=i.position(l,!0),o.setEnd(n,l),o.getBoundingClientRect());let c="left",h;if(n instanceof Text){if(!n.data.length)return null;l0&&(c="right")}return{bottom:h.top+h.height,height:h.height,left:h[c],right:h[c],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 r=this.normalizeNative(e);return Yn.info("getNativeRange",r),r}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&&Qn(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 r=e.map(l=>{const[o,c]=l,h=this.scroll.find(o,!0),m=h.offset(this.scroll);return c===0?m:h instanceof Lt?m+h.index(o,c):m+h.length()}),n=Math.min(Math.max(...r),this.scroll.length()-1),i=Math.min(n,...r);return new Ue(i,n-i)}normalizeNative(t){if(!Qn(this.root,t.startContainer)||!t.collapsed&&!Qn(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(r=>{let{node:n,offset:i}=r;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;r.node=n,r.offset=i}),e}rangeToNative(t){const e=this.scroll.length(),r=(n,i)=>{n=Math.min(e-1,n);const[l,o]=this.scroll.leaf(n);return l?l.position(o,i):[null,-1]};return[...r(t.index,!1),...r(t.index+t.length,!0)]}setNativeRange(t,e){let r=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(Yn.info("setNativeRange",t,e,r,n),t!=null&&(this.root.parentNode==null||t.parentNode==null||r.parentNode==null))return;const l=document.getSelection();if(l!=null)if(t!=null){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(o==null||i||t!==o.startContainer||e!==o.startOffset||r!==o.endContainer||n!==o.endOffset){t instanceof Element&&t.tagName==="BR"&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),r instanceof Element&&r.tagName==="BR"&&(n=Array.from(r.parentNode.childNodes).indexOf(r),r=r.parentNode);const c=document.createRange();c.setStart(t,e),c.setEnd(r,n),l.removeAllRanges(),l.addRange(c)}}else l.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:M.sources.API;if(typeof e=="string"&&(r=e,e=!1),Yn.info("setRange",t),t!=null){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(r)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M.sources.USER;const e=this.lastRange,[r,n]=this.getRange();if(this.lastRange=r,this.lastNative=n,this.lastRange!=null&&(this.savedRange=this.lastRange),!Mi(e,this.lastRange)){if(!this.composing&&n!=null&&n.native.collapsed&&n.start.node!==this.cursor.textNode){const l=this.cursor.restore();l&&this.setNativeRange(l.startNode,l.startOffset,l.endNode,l.endOffset)}const i=[M.events.SELECTION_CHANGE,gr(this.lastRange),gr(e),t];this.emitter.emit(M.events.EDITOR_CHANGE,...i),t!==M.sources.SILENT&&this.emitter.emit(...i)}}}function Qn(s,t){try{t.parentNode}catch{return!1}return s.contains(t)}const Kd=/^[ -~]*$/;class Zd{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const r=Ba(t),n=new P;return Xd(r.ops.slice()).reduce((l,o)=>{const c=Dt.Op.length(o);let h=o.attributes||{},m=!1,y=!1;if(o.insert!=null){if(n.retain(c),typeof o.insert=="string"){const v=o.insert;y=!v.endsWith(` `)&&(e<=l||!!this.scroll.descendant(Pt,l)[0]),this.scroll.insertAt(l,v);const[w,N]=this.scroll.line(l);let T=Se({},Mt(w));if(w instanceof At){const[O]=w.descendant(Lt,N);O&&(T=Se(T,Mt(O)))}h=Dt.AttributeMap.diff(T,h)||{}}else if(typeof o.insert=="object"){const v=Object.keys(o.insert)[0];if(v==null)return l;const w=this.scroll.query(v,D.INLINE)!=null;if(w)(e<=l||this.scroll.descendant(Pt,l)[0])&&(y=!0);else if(l>0){const[N,T]=this.scroll.descendant(Lt,l-1);N instanceof Yt?N.value()[T]!==` `&&(m=!0):N instanceof Rt&&N.statics.scope===D.INLINE_BLOT&&(m=!0)}if(this.scroll.insertAt(l,v,o.insert[v]),w){const[N]=this.scroll.descendant(Lt,l);if(N){const T=Se({},Mt(N));h=Dt.AttributeMap.diff(T,h)||{}}}}e+=c}else if(n.push(o),o.retain!==null&&typeof o.retain=="object"){const v=Object.keys(o.retain)[0];if(v==null)return l;this.scroll.updateEmbedAt(l,v,o.retain[v])}Object.keys(h).forEach(v=>{this.scroll.formatAt(l,c,v,h[v])});const f=m?1:0,d=y?1:0;return e+=f+d,n.retain(f),n.delete(d),l+c+f+d},0),n.reduce((l,o)=>typeof o.delete=="number"?(this.scroll.deleteAt(l,o.delete),l):l+Dt.Op.length(o),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(r)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update(new P().retain(t).delete(e))}formatLine(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.scroll.update(),Object.keys(r).forEach(i=>{this.scroll.lines(t,Math.max(e,1)).forEach(l=>{l.format(i,r[i])})}),this.scroll.optimize();const n=new P().retain(t).retain(e,gr(r));return this.update(n)}formatText(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(r).forEach(i=>{this.scroll.formatAt(t,e,i,r[i])});const n=new P().retain(t).retain(e,gr(r));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 P)}getFormat(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=[],n=[];e===0?this.scroll.path(t).forEach(o=>{const[c]=o;c instanceof At?r.push(c):c instanceof Lt&&n.push(c)}):(r=this.scroll.lines(t,e),n=this.scroll.descendants(Lt,t,e));const[i,l]=[r,n].map(o=>{const c=o.shift();if(c==null)return{};let h=Mt(c);for(;Object.keys(h).length>0;){const m=o.shift();if(m==null)return h;h=Wd(Mt(m),h)}return h});return{...i,...l}}getHTML(t,e){const[r,n]=this.scroll.line(t);if(r){const i=r.length();return r.length()>=n+e&&!(n===0&&e===i)?es(r,n,e,!0):es(this.scroll,t,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(r=>typeof r.insert=="string").map(r=>r.insert).join("")}insertContents(t,e){const r=Ba(e),n=new P().retain(t).concat(r);return this.scroll.insertContents(t,r),this.update(n)}insertEmbed(t,e,r){return this.scroll.insertAt(t,e,r),this.update(new P().retain(t).insert({[e]:r}))}insertText(t,e){let r=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(r).forEach(n=>{this.scroll.formatAt(t,e.length,n,r[n])}),this.update(new P().retain(t).insert(e,gr(r)))}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)!==At.blotName)return!1;const e=t;return e.children.length>1?!1:e.children.head instanceof Jt}removeFormat(t,e){const r=this.getText(t,e),[n,i]=this.scroll.line(t+e);let l=0,o=new P;n!=null&&(l=n.length()-i,o=n.delta().slice(i,i+l-1).insert(` `));const h=this.getContents(t,e+l).diff(new P().insert(r).concat(o)),m=new P().retain(t).concat(h);return this.applyDelta(m)}update(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=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(Kd)&&this.scroll.find(e[0].target)){const i=this.scroll.find(e[0].target),l=Mt(i),o=i.offset(this.scroll),c=e[0].oldValue.replace(xr.CONTENTS,""),h=new P().insert(c),m=new P().insert(i.value()),y=r&&{oldRange:Pa(r.oldRange,-o),newRange:Pa(r.newRange,-o)};t=new P().retain(o).concat(h.diff(m,y)).reduce((d,v)=>v.insert?d.insert(v.insert,l):d.push(v),new P),this.delta=n.compose(t)}else this.delta=this.getDelta(),(!t||!Mi(n.compose(t),this.delta))&&(t=n.diff(this.delta,r));return t}}function ur(s,t,e){if(s.length===0){const[d]=Jn(e.pop());return t<=0?``:`${ur([],t-1,e)}`}const[{child:r,offset:n,length:i,indent:l,type:o},...c]=s,[h,m]=Jn(o);if(l>t)return e.push(o),l===t+1?`<${h}>${es(r,n,i)}${ur(c,l,e)}`:`<${h}>
  • ${ur(s,t+1,e)}`;const y=e[e.length-1];if(l===t&&o===y)return`
  • ${es(r,n,i)}${ur(c,l,e)}`;const[f]=Jn(e.pop());return`${ur(s,t-1,e)}`}function es(s,t,e){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if("html"in s&&typeof s.html=="function")return s.html(t,e);if(s instanceof Yt)return Qs(s.value().slice(t,t+e)).replaceAll(" "," ");if(s instanceof Xt){if(s.statics.blotName==="list-container"){const h=[];return s.children.forEachAt(t,e,(m,y,f)=>{const d="formats"in m&&typeof m.formats=="function"?m.formats():{};h.push({child:m,offset:y,length:f,indent:d.indent||0,type:d.list})}),ur(h,-1,[])}const n=[];if(s.children.forEachAt(t,e,(h,m,y)=>{n.push(es(h,m,y))}),r||s.statics.blotName==="list")return n.join("");const{outerHTML:i,innerHTML:l}=s.domNode,[o,c]=i.split(`>${l}<`);return o==="${n.join("")}<${c}`:`${o}>${n.join("")}<${c}`}return s.domNode instanceof Element?s.domNode.outerHTML:""}function Wd(s,t){return Object.keys(t).reduce((e,r)=>{if(s[r]==null)return e;const n=t[r];return n===s[r]?e[r]=n:Array.isArray(n)?n.indexOf(s[r])<0?e[r]=n.concat([s[r]]):e[r]=n:e[r]=[n,s[r]],e},{})}function Jn(s){const t=s==="ordered"?"ol":"ul";switch(s){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function Ba(s){return s.reduce((t,e)=>{if(typeof e.insert=="string"){const r=e.insert.replace(/\r\n/g,` `).replace(/\r/g,` `);return t.insert(r,e.attributes)}return t.push(e)},new P)}function Pa(s,t){let{index:e,length:r}=s;return new Ue(e+t,r)}function Xd(s){const t=[];return s.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 te{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=t,this.options=e}}q(te,"DEFAULTS",{});const Rs="\uFEFF";let Di=class extends Rt{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(r=>{this.contentNode.appendChild(r)}),this.leftGuard=document.createTextNode(Rs),this.rightGuard=document.createTextNode(Rs),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,r;const n=t.data.split(Rs).join("");if(t===this.leftGuard)if(this.prev instanceof Yt){const i=this.prev.length();this.prev.insertAt(i,n),e={startNode:this.prev.domNode,startOffset:i+n.length}}else r=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(r),this),e={startNode:r,startOffset:n.length};else t===this.rightGuard&&(this.next instanceof Yt?(this.next.insertAt(0,n),e={startNode:this.next.domNode,startOffset:n.length}):(r=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(r),this.next),e={startNode:r,startOffset:n.length}));return t.data=Rs,e}update(t,e){t.forEach(r=>{if(r.type==="characterData"&&(r.target===this.leftGuard||r.target===this.rightGuard)){const n=this.restore(r.target);n&&(e.range=n)}})}};class Yd{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 Di)&&(this.emitter.emit(M.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(M.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(M.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(M.events.COMPOSITION_END,t),this.isComposing=!1}}const Wr=class Wr{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(Wr,"DEFAULTS",{modules:{}}),q(Wr,"themes",{default:Wr});let wr=Wr;const Qd=s=>s.parentElement||s.getRootNode().host||null,Jd=s=>{const t=s.getBoundingClientRect(),e="offsetWidth"in s&&Math.abs(t.width)/s.offsetWidth||1,r="offsetHeight"in s&&Math.abs(t.height)/s.offsetHeight||1;return{top:t.top,right:t.left+s.clientWidth*e,bottom:t.top+s.clientHeight*r,left:t.left}},js=s=>{const t=parseInt(s,10);return Number.isNaN(t)?0:t},Da=(s,t,e,r,n,i)=>sr?0:sr?t-s>r-e?s+n-e:t-r+i:0,tp=(s,t)=>{var i,l,o;const e=s.ownerDocument;let r=t,n=s;for(;n;){const c=n===e.body,h=c?{top:0,right:((i=window.visualViewport)==null?void 0:i.width)??e.documentElement.clientWidth,bottom:((l=window.visualViewport)==null?void 0:l.height)??e.documentElement.clientHeight,left:0}:Jd(n),m=getComputedStyle(n),y=Da(r.left,r.right,h.left,h.right,js(m.scrollPaddingLeft),js(m.scrollPaddingRight)),f=Da(r.top,r.bottom,h.top,h.bottom,js(m.scrollPaddingTop),js(m.scrollPaddingBottom));if(y||f)if(c)(o=e.defaultView)==null||o.scrollBy(y,f);else{const{scrollLeft:d,scrollTop:v}=n;f&&(n.scrollTop+=f),y&&(n.scrollLeft+=y);const w=n.scrollLeft-d,N=n.scrollTop-v;r={left:r.left-w,top:r.top-N,right:r.right-w,bottom:r.bottom-N}}n=c||m.position==="fixed"?null:Qd(n)}},ep=100,rp=["block","break","cursor","inline","scroll","text"],sp=(s,t,e)=>{const r=new vr;return rp.forEach(n=>{const i=t.query(n);i&&r.register(i)}),s.forEach(n=>{let i=t.query(n);i||e.error(`Cannot register "${n}" specified in "formats" config. Are you sure it was registered?`);let l=0;for(;i;)if(r.register(i),i="blotName"in i?i.requiredContainer??null:null,l+=1,l>ep){e.error(`Cycle detected in registering blot requiredContainer: "${n}"`);break}}),r},br=xe("quill"),ks=new vr;Xt.uiClass="ql-ui";const Vt=class Vt{static debug(t){t===!0&&(t="log"),xe.level(t)}static find(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return mi.get(t)||ks.find(t,e)}static import(t){return this.imports[t]==null&&br.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]),r="attrName"in t?t.attrName:t.blotName;typeof r=="string"?this.register(`formats/${r}`,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],r=!!(!(arguments.length<=2)&&arguments[2]);this.imports[t]!=null&&!r&&br.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&typeof e!="boolean"&&e.blotName!=="abstract"&&ks.register(e),typeof e.register=="function"&&e.register(ks)}}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=np(t,e),this.container=this.options.container,this.container==null){br.error("Invalid Quill container",t);return}this.options.debug&&Vt.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",mi.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new M;const n=Pi.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 Zd(this.scroll),this.selection=new Vd(this.scroll,this.emitter),this.composition=new Yd(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(M.events.EDITOR_CHANGE,l=>{l===M.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(M.events.SCROLL_UPDATE,(l,o)=>{const c=this.selection.lastRange,[h]=this.selection.getRange(),m=c&&h?{oldRange:c,newRange:h}:void 0;Gt.call(this,()=>this.editor.update(null,o,m),l)}),this.emitter.on(M.events.SCROLL_EMBED_UPDATE,(l,o)=>{const c=this.selection.lastRange,[h]=this.selection.getRange(),m=c&&h?{oldRange:c,newRange:h}:void 0;Gt.call(this,()=>{const y=new P().retain(l.offset(this)).retain({[l.statics.blotName]:o});return this.editor.update(y,[],m)},Vt.sources.USER)}),r){const l=this.clipboard.convert({html:`${r}


    `,text:` `});this.setContents(l)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof t=="string"){const r=t;t=document.createElement("div"),t.classList.add(r)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,r){return[t,e,,r]=ge(t,e,r),Gt.call(this,()=>this.editor.deleteText(t,e),r,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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:M.sources.API;return Gt.call(this,()=>{const n=this.getSelection(!0);let i=new P;if(n==null)return i;if(this.scroll.query(t,D.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,M.sources.SILENT),i},r)}formatLine(t,e,r,n,i){let l;return[t,e,l,i]=ge(t,e,r,n,i),Gt.call(this,()=>this.editor.formatLine(t,e,l),i,t,0)}formatText(t,e,r,n,i){let l;return[t,e,l,i]=ge(t,e,r,n,i),Gt.call(this,()=>this.editor.formatText(t,e,l),i,t,0)}getBounds(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=null;if(typeof t=="number"?r=this.selection.getBounds(t,e):r=this.selection.getBounds(t.index,t.length),!r)return null;const n=this.container.getBoundingClientRect();return{bottom:r.bottom-n.top,height:r.height,left:r.left-n.left,right:r.right-n.left,top:r.top-n.top,width:r.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]=ge(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]=ge(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]=ge(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Vt.sources.API;return Gt.call(this,()=>this.editor.insertEmbed(t,e,r),n,t)}insertText(t,e,r,n,i){let l;return[t,,l,i]=ge(t,0,r,n,i),Gt.call(this,()=>this.editor.insertText(t,e,l),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,r){return[t,e,,r]=ge(t,e,r),Gt.call(this,()=>this.editor.removeFormat(t,e),r,t)}scrollRectIntoView(t){tp(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]:M.sources.API;return Gt.call(this,()=>{t=new P(t);const r=this.getLength(),n=this.editor.deleteText(0,r),i=this.editor.insertContents(0,t),l=this.editor.deleteText(this.getLength()-1,1);return n.compose(i).compose(l)},e)}setSelection(t,e,r){t==null?this.selection.setRange(null,e||Vt.sources.API):([t,e,,r]=ge(t,e,r),this.selection.setRange(new Ue(Math.max(0,t),e),r),r!==M.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:M.sources.API;const r=new P().insert(t);return this.setContents(r,e)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M.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]:M.sources.API;return Gt.call(this,()=>(t=new P(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:ks,theme:"default"}),q(Vt,"events",M.events),q(Vt,"sources",M.sources),q(Vt,"version","2.0.3"),q(Vt,"imports",{delta:P,parchment:Md,"core/module":te,"core/theme":wr});let E=Vt;function $a(s){return typeof s=="string"?document.querySelector(s):s}function ti(s){return Object.entries(s??{}).reduce((t,e)=>{let[r,n]=e;return{...t,[r]:n===!0?{}:n}},{})}function Ua(s){return Object.fromEntries(Object.entries(s).filter(t=>t[1]!==void 0))}function np(s,t){const e=$a(s);if(!e)throw new Error("Invalid Quill container");const n=!t.theme||t.theme===E.DEFAULTS.theme?wr:E.import(`themes/${t.theme}`);if(!n)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:i,...l}=E.DEFAULTS,{modules:o,...c}=n.DEFAULTS;let h=ti(t.modules);h!=null&&h.toolbar&&h.toolbar.constructor!==Object&&(h={...h,toolbar:{container:h.toolbar}});const m=Se({},ti(i),ti(o),h),y={...l,...Ua(c),...Ua(t)};let f=t.registry;return f?t.formats&&br.warn('Ignoring "formats" option because "registry" is specified'):f=t.formats?sp(t.formats,y.registry,br):y.registry,{...y,registry:f,container:e,theme:n,modules:Object.entries(m).reduce((d,v)=>{let[w,N]=v;if(!N)return d;const T=E.import(`modules/${w}`);return T==null?(br.error(`Cannot load ${w} module. Are you sure you registered it?`),d):{...d,[w]:Se({},T.DEFAULTS||{},N)}},{}),bounds:$a(y.bounds)}}function Gt(s,t,e,r){if(!this.isEnabled()&&t===M.sources.USER&&!this.allowReadOnlyEdits)return new P;let n=e==null?null:this.getSelection();const i=this.editor.delta,l=s();if(n!=null&&(e===!0&&(e=n.index),r==null?n=Fa(n,l,t):r!==0&&(n=Fa(n,e,r,t)),this.setSelection(n,M.sources.SILENT)),l.length()>0){const o=[M.events.TEXT_CHANGE,l,i,t];this.emitter.emit(M.events.EDITOR_CHANGE,...o),t!==M.sources.SILENT&&this.emitter.emit(...o)}return l}function ge(s,t,e,r,n){let i={};return typeof s.index=="number"&&typeof s.length=="number"?typeof t!="number"?(n=r,r=e,e=t,t=s.length,s=s.index):(t=s.length,s=s.index):typeof t!="number"&&(n=r,r=e,e=t,t=0),typeof e=="object"?(i=e,n=r):typeof e=="string"&&(r!=null?i[e]=r:n=e),n=n||M.sources.API,[s,t,i,n]}function Fa(s,t,e,r){const n=typeof e=="number"?e:0;if(s==null)return null;let i,l;return t&&typeof t.transformPosition=="function"?[i,l]=[s.index,s.index+s.length].map(o=>t.transformPosition(o,r!==M.sources.USER)):[i,l]=[s.index,s.index+s.length].map(o=>o=0?o+n:Math.max(t,o+n)),new Ue(i,l-i)}class Ge extends Ys{}function Ha(s){return s instanceof At||s instanceof Pt}function za(s){return typeof s.updateContent=="function"}class hr extends Pi{constructor(t,e,r){let{emitter:n}=r;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(M.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(M.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(M.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[r,n]=this.line(t),[i]=this.line(t+e);if(super.deleteAt(t,e),i!=null&&r!==i&&n>0){if(r instanceof Pt||i instanceof Pt){this.optimize();return}const l=i.children.head instanceof Jt?null:i.children.head;r.moveChildren(i,l),r.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,r,n){super.formatAt(t,e,r,n),this.optimize()}insertAt(t,e,r){if(t>=this.length())if(r==null||this.scroll.query(e,D.BLOCK)==null){const n=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(n),r==null&&e.endsWith(` `)?n.insertAt(0,e.slice(0,-1),r):n.insertAt(0,e,r)}else{const n=this.scroll.create(e,r);this.appendChild(n)}else super.insertAt(t,e,r);this.optimize()}insertBefore(t,e){if(t.statics.scope===D.INLINE_BLOT){const r=this.scroll.create(this.statics.defaultChild.blotName);r.appendChild(t),super.insertBefore(r,e)}else super.insertBefore(t,e)}insertContents(t,e){const r=this.deltaToRenderBlocks(e.concat(new P().insert(` `))),n=r.pop();if(n==null)return;this.batchStart();const i=r.shift();if(i){const c=i.type==="block"&&(i.delta.length()===0||!this.descendant(Pt,t)[0]&&t{this.formatAt(y-1,1,v,d[v])}),t=y}let[l,o]=this.children.find(t);if(r.length&&(l&&(l=l.split(o),o=0),r.forEach(c=>{if(c.type==="block"){const h=this.createBlock(c.attributes,l||void 0);ei(h,0,c.delta)}else{const h=this.create(c.key,c.value);this.insertBefore(h,l||void 0),Object.keys(c.attributes).forEach(m=>{h.format(m,c.attributes[m])})}})),n.type==="block"&&n.delta.length()){const c=l?l.offset(l.scroll)+o:this.length();ei(this,c,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[r,n]=e;return r instanceof Lt?[r,n]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(Ha,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 r=(n,i,l)=>{let o=[],c=l;return n.children.forEachAt(i,l,(h,m,y)=>{Ha(h)?o.push(h):h instanceof Ys&&(o=o.concat(r(h,m,c))),c-=y}),o};return r(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(M.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=M.sources.USER;typeof t=="string"&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),t=t.filter(r=>{let{target:n}=r;const i=this.find(n,!0);return i&&!za(i)}),t.length>0&&this.emitter.emit(M.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(M.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,r){const[n]=this.descendant(i=>i instanceof Pt,t);n&&n.statics.blotName===e&&za(n)&&n.updateContent(r)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let r=new P;return t.forEach(n=>{const i=n==null?void 0:n.insert;if(i)if(typeof i=="string"){const l=i.split(` `);l.slice(0,-1).forEach(c=>{r.insert(c,n.attributes),e.push({type:"block",delta:r,attributes:n.attributes??{}}),r=new P});const o=l[l.length-1];o&&r.insert(o,n.attributes)}else{const l=Object.keys(i)[0];if(!l)return;this.query(l,D.INLINE)?r.push(n):(r.length()&&e.push({type:"block",delta:r,attributes:{}}),r=new P,e.push({type:"blockEmbed",key:l,value:i[l],attributes:n.attributes??{}}))}}),r.length()&&e.push({type:"block",delta:r,attributes:{}}),e}createBlock(t,e){let r;const n={};Object.entries(t).forEach(o=>{let[c,h]=o;this.query(c,D.BLOCK&D.BLOT)!=null?r=c:n[c]=h});const i=this.create(r||this.statics.defaultChild.blotName,r?t[r]:void 0);this.insertBefore(i,e||void 0);const l=i.length();return Object.entries(n).forEach(o=>{let[c,h]=o;i.formatAt(0,l,c,h)}),i}}q(hr,"blotName","scroll"),q(hr,"className","ql-editor"),q(hr,"tagName","DIV"),q(hr,"defaultChild",At),q(hr,"allowedChildren",[At,Pt,Ge]);function ei(s,t,e){e.reduce((r,n)=>{const i=Dt.Op.length(n);let l=n.attributes||{};if(n.insert!=null){if(typeof n.insert=="string"){const o=n.insert;s.insertAt(r,o);const[c]=s.descendant(Lt,r),h=Mt(c);l=Dt.AttributeMap.diff(h,l)||{}}else if(typeof n.insert=="object"){const o=Object.keys(n.insert)[0];if(o==null)return r;if(s.insertAt(r,o,n.insert[o]),s.scroll.query(o,D.INLINE)!=null){const[h]=s.descendant(Lt,r),m=Mt(h);l=Dt.AttributeMap.diff(m,l)||{}}}}return Object.keys(l).forEach(o=>{s.formatAt(r,i,o,l[o])}),r+i},t)}const $i={scope:D.BLOCK,whitelist:["right","center","justify"]},ip=new oe("align","align",$i),Hl=new Qt("align","ql-align",$i),zl=new qe("align","text-align",$i);class Gl extends qe{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 ap=new Qt("color","ql-color",{scope:D.INLINE}),Ui=new Gl("color","color",{scope:D.INLINE}),lp=new Qt("background","ql-bg",{scope:D.INLINE}),Fi=new Gl("background","background-color",{scope:D.INLINE});class Ve extends Ge{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(r=>r.length()<=1?"":r.domNode.innerText).join(` `).slice(t,t+e)}html(t,e){return`
    ${Qs(this.code(t,e))}
    
    `}}class St extends At{static register(){E.register(Ve)}}q(St,"TAB"," ");class Hi extends ce{}Hi.blotName="code";Hi.tagName="CODE";St.blotName="code-block";St.className="ql-code-block";St.tagName="DIV";Ve.blotName="code-block-container";Ve.className="ql-code-block-container";Ve.tagName="DIV";Ve.allowedChildren=[St];St.allowedChildren=[Yt,Jt,xr];St.requiredContainer=Ve;const zi={scope:D.BLOCK,whitelist:["rtl"]},Vl=new oe("direction","dir",zi),Kl=new Qt("direction","ql-direction",zi),Zl=new qe("direction","direction",zi),Wl={scope:D.INLINE,whitelist:["serif","monospace"]},Xl=new Qt("font","ql-font",Wl);class op extends qe{value(t){return super.value(t).replace(/["']/g,"")}}const Yl=new op("font","font-family",Wl),Ql=new Qt("size","ql-size",{scope:D.INLINE,whitelist:["small","large","huge"]}),Jl=new qe("size","font-size",{scope:D.INLINE,whitelist:["10px","18px","32px"]}),cp=xe("quill:keyboard"),up=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Js extends te{static match(t,e){return["altKey","ctrlKey","metaKey","shiftKey"].some(r=>!!e[r]!==t[r]&&e[r]!==null)?!1:e.key===t.key||e.key===t.which}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(r=>{this.options.bindings[r]&&this.addBinding(this.options.bindings[r])}),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]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=fp(t);if(n==null){cp.warn("Attempted to add invalid keyboard binding",n);return}typeof e=="function"&&(e={handler:e}),typeof r=="function"&&(r={handler:r}),(Array.isArray(n.key)?n.key:[n.key]).forEach(l=>{const o={...n,key:l,...e,...r};this.bindings[o.key]=this.bindings[o.key]||[],this.bindings[o.key].push(o)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing||t.keyCode===229&&(t.key==="Enter"||t.key==="Backspace"))return;const n=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(T=>Js.match(t,T));if(n.length===0)return;const i=E.find(t.target,!0);if(i&&i.scroll!==this.quill.scroll)return;const l=this.quill.getSelection();if(l==null||!this.quill.hasFocus())return;const[o,c]=this.quill.getLine(l.index),[h,m]=this.quill.getLeaf(l.index),[y,f]=l.length===0?[h,m]:this.quill.getLeaf(l.index+l.length),d=h instanceof zs?h.value().slice(0,m):"",v=y instanceof zs?y.value().slice(f):"",w={collapsed:l.length===0,empty:l.length===0&&o.length()<=1,format:this.quill.getFormat(l),line:o,offset:c,prefix:d,suffix:v,event:t};n.some(T=>{if(T.collapsed!=null&&T.collapsed!==w.collapsed||T.empty!=null&&T.empty!==w.empty||T.offset!=null&&T.offset!==w.offset)return!1;if(Array.isArray(T.format)){if(T.format.every(O=>w.format[O]==null))return!1}else if(typeof T.format=="object"&&!Object.keys(T.format).every(O=>T.format[O]===!0?w.format[O]!=null:T.format[O]===!1?w.format[O]==null:Mi(T.format[O],w.format[O])))return!1;return T.prefix!=null&&!T.prefix.test(w.prefix)||T.suffix!=null&&!T.suffix.test(w.suffix)?!1:T.handler.call(this,l,w,T)!==!0})&&t.preventDefault()})}handleBackspace(t,e){const r=/[\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 l=new P().retain(t.index-r).delete(r);if(e.offset===0){const[o]=this.quill.getLine(t.index-1);if(o&&!(o.statics.blotName==="block"&&o.length()<=1)){const h=i.formats(),m=this.quill.getFormat(t.index-1,1);if(n=Dt.AttributeMap.diff(h,m)||{},Object.keys(n).length>0){const y=new P().retain(t.index+i.length()-2).retain(1,n);l=l.compose(y)}}}this.quill.updateContents(l,E.sources.USER),this.quill.focus()}handleDelete(t,e){const r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-r)return;let n={};const[i]=this.quill.getLine(t.index);let l=new P().retain(t.index).delete(r);if(e.offset>=i.length()-1){const[o]=this.quill.getLine(t.index+1);if(o){const c=i.formats(),h=this.quill.getFormat(t.index,1);n=Dt.AttributeMap.diff(c,h)||{},Object.keys(n).length>0&&(l=l.retain(o.length()-1).retain(1,n))}}this.quill.updateContents(l,E.sources.USER),this.quill.focus()}handleDeleteRange(t){Gi({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const r=Object.keys(e.format).reduce((i,l)=>(this.quill.scroll.query(l,D.BLOCK)&&!Array.isArray(e.format[l])&&(i[l]=e.format[l]),i),{}),n=new P().retain(t.index).delete(t.length).insert(` `,r);this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(t.index+1,E.sources.SILENT),this.quill.focus()}}const hp={bindings:{bold:ri("bold"),italic:ri("italic"),underline:ri("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(s,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","+1",E.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(s,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","-1",E.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(s,t){t.format.indent!=null?this.quill.format("indent","-1",E.sources.USER):t.format.list!=null&&this.quill.format("list",!1,E.sources.USER)}},"indent code-block":Ga(!0),"outdent code-block":Ga(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(s){this.quill.deleteText(s.index-1,1,E.sources.USER)}},tab:{key:"Tab",handler(s,t){if(t.format.table)return!0;this.quill.history.cutoff();const e=new P().retain(s.index).delete(s.length).insert(" ");return this.quill.updateContents(e,E.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(s.index+1,E.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,E.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(s,t){const e={list:!1};t.format.indent&&(e.indent=!1),this.quill.formatLine(s.index,s.length,e,E.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(s){const[t,e]=this.quill.getLine(s.index),r={...t.formats(),list:"checked"},n=new P().retain(s.index).insert(` `,r).retain(t.length()-e-1).retain(1,{list:"unchecked"});this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(s.index+1,E.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(s,t){const[e,r]=this.quill.getLine(s.index),n=new P().retain(s.index).insert(` `,t.format).retain(e.length()-r-1).retain(1,{header:null});this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(s.index+1,E.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(s){const t=this.quill.getModule("table");if(t){const[e,r,n,i]=t.getTable(s),l=dp(e,r,n,i);if(l==null)return;let o=e.offset();if(l<0){const c=new P().retain(o).insert(` `);this.quill.updateContents(c,E.sources.USER),this.quill.setSelection(s.index+1,s.length,E.sources.SILENT)}else if(l>0){o+=e.length();const c=new P().retain(o).insert(` `);this.quill.updateContents(c,E.sources.USER),this.quill.setSelection(o,E.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(s,t){const{event:e,line:r}=t,n=r.offset(this.quill.scroll);e.shiftKey?this.quill.setSelection(n-1,E.sources.USER):this.quill.setSelection(n+r.length(),E.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(s,t){if(this.quill.scroll.query("list")==null)return!0;const{length:e}=t.prefix,[r,n]=this.quill.getLine(s.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(s.index," ",E.sources.USER),this.quill.history.cutoff();const l=new P().retain(s.index-n).delete(e+1).retain(r.length()-2-n).retain(1,{list:i});return this.quill.updateContents(l,E.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(s.index-e,E.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(s){const[t,e]=this.quill.getLine(s.index);let r=2,n=t;for(;n!=null&&n.length()<=1&&n.formats()["code-block"];)if(n=n.prev,r-=1,r<=0){const i=new P().retain(s.index+t.length()-e-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(i,E.sources.USER),this.quill.setSelection(s.index-1,E.sources.SILENT),!1}return!0}},"embed left":Ms("ArrowLeft",!1),"embed left shift":Ms("ArrowLeft",!0),"embed right":Ms("ArrowRight",!1),"embed right shift":Ms("ArrowRight",!0),"table down":Va(!1),"table up":Va(!0)}};Js.DEFAULTS=hp;function Ga(s){return{key:"Tab",shiftKey:!s,format:{"code-block":!0},handler(t,e){let{event:r}=e;const n=this.quill.scroll.query("code-block"),{TAB:i}=n;if(t.length===0&&!r.shiftKey){this.quill.insertText(t.index,i,E.sources.USER),this.quill.setSelection(t.index+i.length,E.sources.SILENT);return}const l=t.length===0?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:o,length:c}=t;l.forEach((h,m)=>{s?(h.insertAt(0,i),m===0?o+=i.length:c+=i.length):h.domNode.textContent.startsWith(i)&&(h.deleteAt(0,i.length),m===0?o-=i.length:c-=i.length)}),this.quill.update(E.sources.USER),this.quill.setSelection(o,c,E.sources.SILENT)}}}function Ms(s,t){return{key:s,shiftKey:t,altKey:null,[s==="ArrowLeft"?"prefix":"suffix"]:/^$/,handler(r){let{index:n}=r;s==="ArrowRight"&&(n+=r.length+1);const[i]=this.quill.getLeaf(n);return i instanceof Rt?(s==="ArrowLeft"?t?this.quill.setSelection(r.index-1,r.length+1,E.sources.USER):this.quill.setSelection(r.index-1,E.sources.USER):t?this.quill.setSelection(r.index,r.length+1,E.sources.USER):this.quill.setSelection(r.index+r.length+1,E.sources.USER),!1):!0}}}function ri(s){return{key:s[0],shortKey:!0,handler(t,e){this.quill.format(s,!e.format[s],E.sources.USER)}}}function Va(s){return{key:s?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,e){const r=s?"prev":"next",n=e.line,i=n.parent[r];if(i!=null){if(i.statics.blotName==="table-row"){let l=i.children.head,o=n;for(;o.prev!=null;)o=o.prev,l=l.next;const c=l.offset(this.quill.scroll)+Math.min(e.offset,l.length()-1);this.quill.setSelection(c,0,E.sources.USER)}}else{const l=n.table()[r];l!=null&&(s?this.quill.setSelection(l.offset(this.quill.scroll)+l.length()-1,0,E.sources.USER):this.quill.setSelection(l.offset(this.quill.scroll),0,E.sources.USER))}return!1}}}function fp(s){if(typeof s=="string"||typeof s=="number")s={key:s};else if(typeof s=="object")s=gr(s);else return null;return s.shortKey&&(s[up]=s.shortKey,delete s.shortKey),s}function Gi(s){let{quill:t,range:e}=s;const r=t.getLines(e);let n={};if(r.length>1){const i=r[0].formats(),l=r[r.length-1].formats();n=Dt.AttributeMap.diff(l,i)||{}}t.deleteText(e,E.sources.USER),Object.keys(n).length>0&&t.formatLine(e.index,1,n,E.sources.USER),t.setSelection(e.index,E.sources.SILENT)}function dp(s,t,e,r){return t.prev==null&&t.next==null?e.prev==null&&e.next==null?r===0?-1:1:e.prev==null?-1:1:t.prev==null?-1:t.next==null?1:null}const pp=/font-weight:\s*normal/,gp=["P","OL","UL"],Ka=s=>s&&gp.includes(s.tagName),mp=s=>{Array.from(s.querySelectorAll("br")).filter(t=>Ka(t.previousElementSibling)&&Ka(t.nextElementSibling)).forEach(t=>{var e;(e=t.parentNode)==null||e.removeChild(t)})},bp=s=>{Array.from(s.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return(e=t.getAttribute("style"))==null?void 0:e.match(pp)}).forEach(t=>{var r;const e=s.createDocumentFragment();e.append(...t.childNodes),(r=t.parentNode)==null||r.replaceChild(e,t)})};function yp(s){s.querySelector('[id^="docs-internal-guid-"]')&&(bp(s),mp(s))}const vp=/\bmso-list:[^;]*ignore/i,xp=/\bmso-list:[^;]*\bl(\d+)/i,wp=/\bmso-list:[^;]*\blevel(\d+)/i,Np=(s,t)=>{const e=s.getAttribute("style"),r=e==null?void 0:e.match(xp);if(!r)return null;const n=Number(r[1]),i=e==null?void 0:e.match(wp),l=i?Number(i[1]):1,o=new RegExp(`@list l${n}:level${l}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),c=t.match(o),h=c&&c[1]==="bullet"?"bullet":"ordered";return{id:n,indent:l,type:h,element:s}},Ap=s=>{var l,o;const t=Array.from(s.querySelectorAll("[style*=mso-list]")),e=[],r=[];t.forEach(c=>{(c.getAttribute("style")||"").match(vp)?e.push(c):r.push(c)}),e.forEach(c=>{var h;return(h=c.parentNode)==null?void 0:h.removeChild(c)});const n=s.documentElement.innerHTML,i=r.map(c=>Np(c,n)).filter(c=>c);for(;i.length;){const c=[];let h=i.shift();for(;h;)c.push(h),h=i.length&&((l=i[0])==null?void 0:l.element)===h.element.nextElementSibling&&i[0].id===h.id?i.shift():null;const m=document.createElement("ul");c.forEach(d=>{const v=document.createElement("li");v.setAttribute("data-list",d.type),d.indent>1&&v.setAttribute("class",`ql-indent-${d.indent-1}`),v.innerHTML=d.element.innerHTML,m.appendChild(v)});const y=(o=c[0])==null?void 0:o.element,{parentNode:f}=y??{};y&&(f==null||f.replaceChild(m,y)),c.slice(1).forEach(d=>{let{element:v}=d;f==null||f.removeChild(v)})}};function Ep(s){s.documentElement.getAttribute("xmlns:w")==="urn:schemas-microsoft-com:office:word"&&Ap(s)}const Tp=[Ep,yp],Cp=s=>{s.documentElement&&Tp.forEach(t=>{t(s)})},Lp=xe("quill:clipboard"),Sp=[[Node.TEXT_NODE,$p],[Node.TEXT_NODE,Wa],["br",Rp],[Node.ELEMENT_NODE,Wa],[Node.ELEMENT_NODE,Ip],[Node.ELEMENT_NODE,qp],[Node.ELEMENT_NODE,Pp],["li",Mp],["ol, ul",Bp],["pre",jp],["tr",Dp],["b",si("bold")],["i",si("italic")],["strike",si("strike")],["style",kp]],_p=[ip,Vl].reduce((s,t)=>(s[t.keyName]=t,s),{}),Za=[zl,Fi,Ui,Zl,Yl,Jl].reduce((s,t)=>(s[t.keyName]=t,s),{});class to extends te{constructor(t,e){super(t,e),this.quill.root.addEventListener("copy",r=>this.onCaptureCopy(r,!1)),this.quill.root.addEventListener("cut",r=>this.onCaptureCopy(r,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Sp.concat(this.options.matchers??[]).forEach(r=>{let[n,i]=r;this.addMatcher(n,i)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:r}=t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n[St.blotName])return new P().insert(r||"",{[St.blotName]:n[St.blotName]});if(!e)return new P().insert(r||"",n);const i=this.convertHTML(e);return is(i,` `)&&(i.ops[i.ops.length-1].attributes==null||n.table)?i.compose(new P().retain(i.length()-1).delete(1)):i}normalizeHTML(t){Cp(t)}convertHTML(t){const e=new DOMParser().parseFromString(t,"text/html");this.normalizeHTML(e);const r=e.body,n=new WeakMap,[i,l]=this.prepareMatching(r,n);return Vi(this.quill.scroll,r,i,l,n)}dangerouslyPasteHTML(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:E.sources.API;if(typeof t=="string"){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,E.sources.SILENT)}else{const n=this.convert({html:e,text:""});this.quill.updateContents(new P().retain(t).concat(n),r),this.quill.setSelection(t+n.length(),E.sources.SILENT)}}onCaptureCopy(t){var l,o;let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(t.defaultPrevented)return;t.preventDefault();const[r]=this.quill.selection.getRange();if(r==null)return;const{html:n,text:i}=this.onCopy(r,e);(l=t.clipboardData)==null||l.setData("text/plain",i),(o=t.clipboardData)==null||o.setData("text/html",n),e&&Gi({range:r,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(e=>e[0]!=="#").join(` `)}onCapturePaste(t){var l,o,c,h,m;if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(e==null)return;const r=(l=t.clipboardData)==null?void 0:l.getData("text/html");let n=(o=t.clipboardData)==null?void 0:o.getData("text/plain");if(!r&&!n){const y=(c=t.clipboardData)==null?void 0:c.getData("text/uri-list");y&&(n=this.normalizeURIList(y))}const i=Array.from(((h=t.clipboardData)==null?void 0:h.files)||[]);if(!r&&i.length>0){this.quill.uploader.upload(e,i);return}if(r&&i.length>0){const y=new DOMParser().parseFromString(r,"text/html");if(y.body.childElementCount===1&&((m=y.body.firstElementChild)==null?void 0:m.tagName)==="IMG"){this.quill.uploader.upload(e,i);return}}this.onPaste(e,{html:r,text:n})}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:r,html:n}=e;const i=this.quill.getFormat(t.index),l=this.convert({text:r,html:n},i);Lp.log("onPaste",l,{text:r,html:n});const o=new P().retain(t.index).delete(t.length).concat(l);this.quill.updateContents(o,E.sources.USER),this.quill.setSelection(o.length()-t.length,E.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const r=[],n=[];return this.matchers.forEach(i=>{const[l,o]=i;switch(l){case Node.TEXT_NODE:n.push(o);break;case Node.ELEMENT_NODE:r.push(o);break;default:Array.from(t.querySelectorAll(l)).forEach(c=>{if(e.has(c)){const h=e.get(c);h==null||h.push(o)}else e.set(c,[o])});break}}),[r,n]}}q(to,"DEFAULTS",{matchers:[]});function Ke(s,t,e,r){return r.query(t)?s.reduce((n,i)=>{if(!i.insert)return n;if(i.attributes&&i.attributes[t])return n.push(i);const l=e?{[t]:e}:{};return n.insert(i.insert,{...l,...i.attributes})},new P):s}function is(s,t){let e="";for(let r=s.ops.length-1;r>=0&&e.lengthl(t,i,s),new P):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((i,l)=>{let o=Vi(s,l,e,r,n);return l.nodeType===t.ELEMENT_NODE&&(o=e.reduce((c,h)=>h(l,c,s),o),o=(n.get(l)||[]).reduce((c,h)=>h(l,c,s),o)),i.concat(o)},new P):new P}function si(s){return(t,e,r)=>Ke(e,s,!0,r)}function qp(s,t,e){const r=oe.keys(s),n=Qt.keys(s),i=qe.keys(s),l={};return r.concat(n).concat(i).forEach(o=>{let c=e.query(o,D.ATTRIBUTE);c!=null&&(l[c.attrName]=c.value(s),l[c.attrName])||(c=_p[o],c!=null&&(c.attrName===o||c.keyName===o)&&(l[c.attrName]=c.value(s)||void 0),c=Za[o],c!=null&&(c.attrName===o||c.keyName===o)&&(c=Za[o],l[c.attrName]=c.value(s)||void 0))}),Object.entries(l).reduce((o,c)=>{let[h,m]=c;return Ke(o,h,m,e)},t)}function Ip(s,t,e){const r=e.query(s);if(r==null)return t;if(r.prototype instanceof Rt){const n={},i=r.value(s);if(i!=null)return n[r.blotName]=i,new P().insert(n,r.formats(s,e))}else if(r.prototype instanceof ts&&!is(t,` `)&&t.insert(` `),"blotName"in r&&"formats"in r&&typeof r.formats=="function")return Ke(t,r.blotName,r.formats(s,e),e);return t}function Rp(s,t){return is(t,` `)||t.insert(` `),t}function jp(s,t,e){const r=e.query("code-block"),n=r&&"formats"in r&&typeof r.formats=="function"?r.formats(s,e):!0;return Ke(t,"code-block",n,e)}function kp(){return new P}function Mp(s,t,e){const r=e.query(s);if(r==null||r.blotName!=="list"||!is(t,` `))return t;let n=-1,i=s.parentNode;for(;i!=null;)["OL","UL"].includes(i.tagName)&&(n+=1),i=i.parentNode;return n<=0?t:t.reduce((l,o)=>o.insert?o.attributes&&typeof o.attributes.indent=="number"?l.push(o):l.insert(o.insert,{indent:n,...o.attributes||{}}):l,new P)}function Bp(s,t,e){const r=s;let n=r.tagName==="OL"?"ordered":"bullet";const i=r.getAttribute("data-checked");return i&&(n=i==="true"?"checked":"unchecked"),Ke(t,"list",n,e)}function Wa(s,t,e){if(!is(t,` `)){if(Ce(s,e)&&(s.childNodes.length>0||s instanceof HTMLParagraphElement))return t.insert(` `);if(t.length()>0&&s.nextSibling){let r=s.nextSibling;for(;r!=null;){if(Ce(r,e))return t.insert(` `);const n=e.query(r);if(n&&n.prototype instanceof Pt)return t.insert(` `);r=r.firstChild}}}return t}function Pp(s,t,e){var i;const r={},n=s.style||{};return n.fontStyle==="italic"&&(r.italic=!0),n.textDecoration==="underline"&&(r.underline=!0),n.textDecoration==="line-through"&&(r.strike=!0),((i=n.fontWeight)!=null&&i.startsWith("bold")||parseInt(n.fontWeight,10)>=700)&&(r.bold=!0),t=Object.entries(r).reduce((l,o)=>{let[c,h]=o;return Ke(l,c,h,e)},t),parseFloat(n.textIndent||0)>0?new P().insert(" ").concat(t):t}function Dp(s,t,e){var n,i;const r=((n=s.parentElement)==null?void 0:n.tagName)==="TABLE"?s.parentElement:(i=s.parentElement)==null?void 0:i.parentElement;if(r!=null){const o=Array.from(r.querySelectorAll("tr")).indexOf(s)+1;return Ke(t,"table",o,e)}return t}function $p(s,t,e){var n;let r=s.data;if(((n=s.parentElement)==null?void 0:n.tagName)==="O:P")return t.insert(r.trim());if(!eo(s)){if(r.trim().length===0&&r.includes(` `)&&!Op(s,e))return t;r=r.replace(/[^\S\u00a0]/g," "),r=r.replace(/ {2,}/g," "),(s.previousSibling==null&&s.parentElement!=null&&Ce(s.parentElement,e)||s.previousSibling instanceof Element&&Ce(s.previousSibling,e))&&(r=r.replace(/^ /,"")),(s.nextSibling==null&&s.parentElement!=null&&Ce(s.parentElement,e)||s.nextSibling instanceof Element&&Ce(s.nextSibling,e))&&(r=r.replace(/ $/,"")),r=r.replaceAll(" "," ")}return t.insert(r)}class ro extends te{constructor(e,r){super(e,r);q(this,"lastRecorded",0);q(this,"ignoreChange",!1);q(this,"stack",{undo:[],redo:[]});q(this,"currentRange",null);this.quill.on(E.events.EDITOR_CHANGE,(n,i,l,o)=>{n===E.events.SELECTION_CHANGE?i&&o!==E.sources.SILENT&&(this.currentRange=i):n===E.events.TEXT_CHANGE&&(this.ignoreChange||(!this.options.userOnly||o===E.sources.USER?this.record(i,l):this.transform(i)),this.currentRange=vi(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,r){if(this.stack[e].length===0)return;const n=this.stack[e].pop();if(!n)return;const i=this.quill.getContents(),l=n.delta.invert(i);this.stack[r].push({delta:l,range:vi(n.range,l)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,E.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,r){if(e.ops.length===0)return;this.stack.redo=[];let n=e.invert(r),i=this.currentRange;const l=Date.now();if(this.lastRecorded+this.options.delay>l&&this.stack.undo.length>0){const o=this.stack.undo.pop();o&&(n=n.compose(o.delta),i=o.range)}else this.lastRecorded=l;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){Xa(this.stack.undo,e),Xa(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,E.sources.USER);else{const r=Fp(this.quill.scroll,e.delta);this.quill.setSelection(r,E.sources.USER)}}}q(ro,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});function Xa(s,t){let e=t;for(let r=s.length-1;r>=0;r-=1){const n=s[r];s[r]={delta:e.transform(n.delta,!0),range:n.range&&vi(n.range,e)},e=n.delta.transform(e),s[r].delta.length()===0&&s.splice(r,1)}}function Up(s,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(r=>s.query(r,D.BLOCK)!=null):!1}function Fp(s,t){const e=t.reduce((n,i)=>n+(i.delete||0),0);let r=t.length()-e;return Up(s,t)&&(r-=1),r}function vi(s,t){if(!s)return s;const e=t.transformPosition(s.index),r=t.transformPosition(s.index+s.length);return{index:e,length:r-e}}class so extends te{constructor(t,e){super(t,e),t.root.addEventListener("drop",r=>{var l;r.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(r.clientX,r.clientY);else if(document.caretPositionFromPoint){const o=document.caretPositionFromPoint(r.clientX,r.clientY);n=document.createRange(),n.setStart(o.offsetNode,o.offset),n.setEnd(o.offsetNode,o.offset)}const i=n&&t.selection.normalizeNative(n);if(i){const o=t.selection.normalizedToRange(i);(l=r.dataTransfer)!=null&&l.files&&this.upload(o,r.dataTransfer.files)}})}upload(t,e){const r=[];Array.from(e).forEach(n=>{var i;n&&((i=this.options.mimetypes)!=null&&i.includes(n.type))&&r.push(n)}),r.length>0&&this.options.handler.call(this,t,r)}}so.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(s,t){if(!this.quill.scroll.query("image"))return;const e=t.map(r=>new Promise(n=>{const i=new FileReader;i.onload=()=>{n(i.result)},i.readAsDataURL(r)}));Promise.all(e).then(r=>{const n=r.reduce((i,l)=>i.insert({image:l}),new P().retain(s.index).delete(s.length));this.quill.updateContents(n,M.sources.USER),this.quill.setSelection(s.index+r.length,M.sources.SILENT)})}};const Hp=["insertText","insertReplacementText"];class zp extends te{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",r=>{this.handleBeforeInput(r)}),/Android/i.test(navigator.userAgent)||t.on(E.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){Gi({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 r=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents(new P().retain(t.index).insert(e,r),E.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,E.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!Hp.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||e.collapsed===!0)return;const r=Gp(t);if(r==null)return;const n=this.quill.selection.normalizeNative(e),i=n?this.quill.selection.normalizedToRange(n):null;i&&this.replaceText(i,r)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}}function Gp(s){var t;return typeof s.data=="string"?s.data:(t=s.dataTransfer)!=null&&t.types.includes("text/plain")?s.dataTransfer.getData("text/plain"):null}const Vp=/Mac/i.test(navigator.platform),Kp=100,Zp=s=>!!(s.key==="ArrowLeft"||s.key==="ArrowRight"||s.key==="ArrowUp"||s.key==="ArrowDown"||s.key==="Home"||Vp&&s.key==="a"&&s.ctrlKey===!0);class Wp extends te{constructor(e,r){super(e,r);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,r){let{line:n,event:i}=r;if(!(n instanceof Xt)||!n.uiNode)return!0;const l=getComputedStyle(n.domNode).direction==="rtl";return l&&i.key!=="ArrowRight"||!l&&i.key!=="ArrowLeft"?!0:(this.quill.setSelection(e.index-1,e.length+(i.shiftKey?1:0),E.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&Zp(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+Kp,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 r=e.getRangeAt(0);if(r.collapsed!==!0||r.startOffset!==0)return;const n=this.quill.scroll.find(r.startContainer);if(!(n instanceof Xt)||!n.uiNode)return;const i=document.createRange();i.setStartAfter(n.uiNode),i.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(i)}}E.register({"blots/block":At,"blots/block/embed":Pt,"blots/break":Jt,"blots/container":Ge,"blots/cursor":xr,"blots/embed":Di,"blots/inline":ce,"blots/scroll":hr,"blots/text":Yt,"modules/clipboard":to,"modules/history":ro,"modules/keyboard":Js,"modules/uploader":so,"modules/input":zp,"modules/uiNode":Wp});class Xp extends Qt{add(t,e){let r=0;if(e==="+1"||e==="-1"){const n=this.value(t)||0;r=e==="+1"?n+1:n-1}else typeof e=="number"&&(r=e);return r===0?(this.remove(t),!0):super.add(t,r.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 Yp=new Xp("indent","ql-indent",{scope:D.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class xi extends At{}q(xi,"blotName","blockquote"),q(xi,"tagName","blockquote");class wi extends At{static formats(t){return this.tagName.indexOf(t.tagName)+1}}q(wi,"blotName","header"),q(wi,"tagName",["H1","H2","H3","H4","H5","H6"]);class as extends Ge{}as.blotName="list-container";as.tagName="OL";class ls extends At{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(){E.register(as)}constructor(t,e){super(t,e);const r=e.ownerDocument.createElement("span"),n=i=>{if(!t.isEnabled())return;const l=this.statics.formats(e,t);l==="checked"?(this.format("list","unchecked"),i.preventDefault()):l==="unchecked"&&(this.format("list","checked"),i.preventDefault())};r.addEventListener("mousedown",n),r.addEventListener("touchstart",n),this.attachUI(r)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}ls.blotName="list";ls.tagName="LI";as.allowedChildren=[ls];ls.requiredContainer=as;class rs extends ce{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(rs,"blotName","bold"),q(rs,"tagName",["STRONG","B"]);class Ni extends rs{}q(Ni,"blotName","italic"),q(Ni,"tagName",["EM","I"]);class Le extends ce{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 no(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(Le,"blotName","link"),q(Le,"tagName","A"),q(Le,"SANITIZED_URL","about:blank"),q(Le,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);function no(s,t){const e=document.createElement("a");e.href=s;const r=e.href.slice(0,e.href.indexOf(":"));return t.indexOf(r)>-1}class Ai extends ce{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(Ai,"blotName","script"),q(Ai,"tagName",["SUB","SUP"]);class Ei extends rs{}q(Ei,"blotName","strike"),q(Ei,"tagName",["S","STRIKE"]);class Ti extends ce{}q(Ti,"blotName","underline"),q(Ti,"tagName","U");class Ds extends Di{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(Ds,"blotName","formula"),q(Ds,"className","ql-formula"),q(Ds,"tagName","SPAN");const Ya=["alt","height","width"];class Ci extends Rt{static create(t){const e=super.create(t);return typeof t=="string"&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return Ya.reduce((e,r)=>(t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return no(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){Ya.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}q(Ci,"blotName","image"),q(Ci,"tagName","IMG");const Qa=["height","width"];class $s extends Pt{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 Qa.reduce((e,r)=>(t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e),{})}static sanitize(t){return Le.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){Qa.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($s,"blotName","video"),q($s,"className","ql-video"),q($s,"tagName","IFRAME");const Vr=new Qt("code-token","hljs",{scope:D.INLINE});class be extends ce{static formats(t,e){for(;t!=null&&t!==e.domNode;){if(t.classList&&t.classList.contains(St.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,r){super(t,e,r),Vr.add(this.domNode,r)}format(t,e){t!==be.blotName?super.format(t,e):e?Vr.add(this.domNode,e):(Vr.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),Vr.value(this.domNode)||this.unwrap()}}be.blotName="code-token";be.className="ql-token";class Bt extends St{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(),be.blotName,!1),super.replaceWith(t,e)}}class Zr extends Ve{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===Bt.blotName&&(this.forceNext=!0,this.children.forEach(r=>{r.format(t,e)}))}formatAt(t,e,r,n){r===Bt.blotName&&(this.forceNext=!0),super.formatAt(t,e,r,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(l=>l!==this.uiNode).map(l=>l.textContent).join(` `)} `,i=Bt.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||this.cachedText==null){const l=this.children.reduce((c,h)=>c.concat(Ul(h,!1)),new P),o=t(n,i);l.diff(o).reduce((c,h)=>{let{retain:m,attributes:y}=h;return m?(y&&Object.keys(y).forEach(f=>{[Bt.blotName,be.blotName].includes(f)&&this.formatAt(c,m,f,y[f])}),c+m):c},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[r]=this.children.find(t);return`
    ${Qs(this.code(t,e))}
    
    `}optimize(t){if(super.optimize(t),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){const e=Bt.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}Zr.allowedChildren=[Bt];Bt.requiredContainer=Zr;Bt.allowedChildren=[be,xr,Yt,Jt];const Qp=(s,t,e)=>{if(typeof s.versionString=="string"){const r=s.versionString.split(".")[0];if(parseInt(r,10)>=11)return s.highlight(e,{language:t}).value}return s.highlight(t,e).value};class io extends te{static register(){E.register(be,!0),E.register(Bt,!0),E.register(Zr,!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((r,n)=>{let{key:i}=n;return r[i]=!0,r},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(E.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof Zr))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(r=>{let{key:n,label:i}=r;const l=e.ownerDocument.createElement("option");l.textContent=i,l.setAttribute("value",n),e.appendChild(l)}),e.addEventListener("change",()=>{t.format(Bt.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),t.uiNode==null&&(t.attachUI(e),t.children.head&&(e.value=Bt.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(E.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(E.sources.USER);const r=this.quill.getSelection();(t==null?this.quill.scroll.descendants(Zr):[t]).forEach(i=>{i.highlight(this.highlightBlot,e)}),this.quill.update(E.sources.SILENT),r!=null&&this.quill.setSelection(r,E.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 Qs(t).split(` `).reduce((n,i,l)=>(l!==0&&n.insert(` `,{[St.blotName]:e}),n.insert(i)),new P);const r=this.quill.root.ownerDocument.createElement("div");return r.classList.add(St.className),r.innerHTML=Qp(this.options.hljs,e,t),Vi(this.quill.scroll,r,[(n,i)=>{const l=Vr.value(n);return l?i.compose(new P().retain(i.length(),{[be.blotName]:l})):i}],[(n,i)=>n.data.split(` `).reduce((l,o,c)=>(c!==0&&l.insert(` `,{[St.blotName]:e}),l.insert(o)),i)],new WeakMap)}}io.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 Xr=class Xr extends At{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",Ki()),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===Xr.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(Xr,"blotName","table"),q(Xr,"tagName","TD");let Wt=Xr;class ye extends Ge{checkMerge(){if(super.checkMerge()&&this.next.children.head!=null){const t=this.children.head.formats(),e=this.children.tail.formats(),r=this.next.children.head.formats(),n=this.next.children.tail.formats();return t.table===e.table&&t.table===r.table&&t.table===n.table}return!1}optimize(t){super.optimize(t),this.children.forEach(e=>{if(e.next==null)return;const r=e.formats(),n=e.next.formats();if(r.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(ye,"blotName","table-row"),q(ye,"tagName","TR");class le extends Ge{}q(le,"blotName","table-body"),q(le,"tagName","TBODY");class Nr extends Ge{balanceCells(){const t=this.descendants(ye),e=t.reduce((r,n)=>Math.max(n.children.length,r),0);t.forEach(r=>{new Array(e-r.children.length).fill(0).forEach(()=>{let n;r.children.head!=null&&(n=Wt.formats(r.children.head.domNode));const i=this.scroll.create(Wt.blotName,n);r.appendChild(i),i.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(le);e==null||e.children.head==null||e.children.forEach(r=>{const n=r.children.at(t);n!=null&&n.remove()})}insertColumn(t){const[e]=this.descendant(le);e==null||e.children.head==null||e.children.forEach(r=>{const n=r.children.at(t),i=Wt.formats(r.children.head.domNode),l=this.scroll.create(Wt.blotName,i);r.insertBefore(l,n)})}insertRow(t){const[e]=this.descendant(le);if(e==null||e.children.head==null)return;const r=Ki(),n=this.scroll.create(ye.blotName);e.children.head.children.forEach(()=>{const l=this.scroll.create(Wt.blotName,r);n.appendChild(l)});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(Nr,"blotName","table-container"),q(Nr,"tagName","TABLE");Nr.allowedChildren=[le];le.requiredContainer=Nr;le.allowedChildren=[ye];ye.requiredContainer=le;ye.allowedChildren=[Wt];Wt.requiredContainer=ye;function Ki(){return`row-${Math.random().toString(36).slice(2,6)}`}class Jp extends te{static register(){E.register(Wt),E.register(ye),E.register(le),E.register(Nr)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Nr).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();e!=null&&(t.deleteColumn(e.cellOffset()),this.quill.update(E.sources.USER))}deleteRow(){const[,t]=this.getTable();t!=null&&(t.remove(),this.quill.update(E.sources.USER))}deleteTable(){const[t]=this.getTable();if(t==null)return;const e=t.offset();t.remove(),this.quill.update(E.sources.USER),this.quill.setSelection(e,E.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,r]=this.quill.getLine(t.index);if(e==null||e.statics.blotName!==Wt.blotName)return[null,null,null,-1];const n=e.parent;return[n.parent.parent,n,e,r]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[r,n,i]=this.getTable(e);if(i==null)return;const l=i.cellOffset();r.insertColumn(l+t),this.quill.update(E.sources.USER);let o=n.rowOffset();t===0&&(o+=1),this.quill.setSelection(e.index+o,e.length,E.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[r,n,i]=this.getTable(e);if(i==null)return;const l=n.rowOffset();r.insertRow(l+t),this.quill.update(E.sources.USER),t>0?this.quill.setSelection(e,E.sources.SILENT):this.quill.setSelection(e.index+n.children.length,e.length,E.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const r=this.quill.getSelection();if(r==null)return;const n=new Array(t).fill(0).reduce(i=>{const l=new Array(e).fill(` `).join("");return i.insert(l,{table:Ki()})},new P().retain(r.index));this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(r.index,E.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(E.events.SCROLL_OPTIMIZE,t=>{t.some(e=>["TD","TR","TBODY","TABLE"].includes(e.target.tagName)?(this.quill.once(E.events.TEXT_CHANGE,(r,n,i)=>{i===E.sources.USER&&this.balanceTables()}),!0):!1)})}}const Ja=xe("quill:toolbar");class Zi extends te{constructor(t,e){var r,n;if(super(t,e),Array.isArray(this.options.container)){const i=document.createElement("div");i.setAttribute("role","toolbar"),t1(i,this.options.container),(n=(r=t.container)==null?void 0:r.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)){Ja.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 o;const l=(o=this.options.handlers)==null?void 0:o[i];l&&this.addHandler(i,l)}),Array.from(this.container.querySelectorAll("button, select")).forEach(i=>{this.attach(i)}),this.quill.on(E.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){Ja.warn("ignoring attaching to nonexistent format",e,t);return}const r=t.tagName==="SELECT"?"change":"click";t.addEventListener(r,n=>{let i;if(t.tagName==="SELECT"){if(t.selectedIndex<0)return;const o=t.options[t.selectedIndex];o.hasAttribute("selected")?i=!1:i=o.value||!1}else t.classList.contains("ql-active")?i=!1:i=t.value||!t.hasAttribute("value"),n.preventDefault();this.quill.focus();const[l]=this.quill.selection.getRange();if(this.handlers[e]!=null)this.handlers[e].call(this,i);else if(this.quill.scroll.query(e).prototype instanceof Rt){if(i=prompt(`Enter ${e}`),!i)return;this.quill.updateContents(new P().retain(l.index).delete(l.length).insert({[e]:i}),E.sources.USER)}else this.quill.format(e,i,E.sources.USER);this.update(l)}),this.controls.push([e,t])}update(t){const e=t==null?{}:this.quill.getFormat(t);this.controls.forEach(r=>{const[n,i]=r;if(i.tagName==="SELECT"){let l=null;if(t==null)l=null;else if(e[n]==null)l=i.querySelector("option[selected]");else if(!Array.isArray(e[n])){let o=e[n];typeof o=="string"&&(o=o.replace(/"/g,'\\"')),l=i.querySelector(`option[value="${o}"]`)}l==null?(i.value="",i.selectedIndex=-1):l.selected=!0}else if(t==null)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const l=e[n],o=l===i.getAttribute("value")||l!=null&&l.toString()===i.getAttribute("value")||l==null&&!i.getAttribute("value");i.classList.toggle("ql-active",o),i.setAttribute("aria-pressed",o.toString())}else{const l=e[n]!=null;i.classList.toggle("ql-active",l),i.setAttribute("aria-pressed",l.toString())}})}}Zi.DEFAULTS={};function tl(s,t,e){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),e!=null?(r.value=e,r.setAttribute("aria-label",`${t}: ${e}`)):r.setAttribute("aria-label",t),s.appendChild(r)}function t1(s,t){Array.isArray(t[0])||(t=[t]),t.forEach(e=>{const r=document.createElement("span");r.classList.add("ql-formats"),e.forEach(n=>{if(typeof n=="string")tl(r,n);else{const i=Object.keys(n)[0],l=n[i];Array.isArray(l)?e1(r,i,l):tl(r,i,l)}}),s.appendChild(r)})}function e1(s,t,e){const r=document.createElement("select");r.classList.add(`ql-${t}`),e.forEach(n=>{const i=document.createElement("option");n!==!1?i.setAttribute("value",String(n)):i.setAttribute("selected","selected"),r.appendChild(i)}),s.appendChild(r)}Zi.DEFAULTS={container:null,handlers:{clean(){const s=this.quill.getSelection();if(s!=null)if(s.length===0){const t=this.quill.getFormat();Object.keys(t).forEach(e=>{this.quill.scroll.query(e,D.INLINE)!=null&&this.quill.format(e,!1,E.sources.USER)})}else this.quill.removeFormat(s.index,s.length,E.sources.USER)},direction(s){const{align:t}=this.quill.getFormat();s==="rtl"&&t==null?this.quill.format("align","right",E.sources.USER):!s&&t==="right"&&this.quill.format("align",!1,E.sources.USER),this.quill.format("direction",s,E.sources.USER)},indent(s){const t=this.quill.getSelection(),e=this.quill.getFormat(t),r=parseInt(e.indent||0,10);if(s==="+1"||s==="-1"){let n=s==="+1"?1:-1;e.direction==="rtl"&&(n*=-1),this.quill.format("indent",r+n,E.sources.USER)}},link(s){s===!0&&(s=prompt("Enter link URL:")),this.quill.format("link",s,E.sources.USER)},list(s){const t=this.quill.getSelection(),e=this.quill.getFormat(t);s==="check"?e.list==="checked"||e.list==="unchecked"?this.quill.format("list",!1,E.sources.USER):this.quill.format("list","unchecked",E.sources.USER):this.quill.format("list",s,E.sources.USER)}}};const r1='',s1='',n1='',i1='',a1='',l1='',o1='',c1='',el='',u1='',h1='',f1='',d1='',p1='',g1='',m1='',b1='',y1='',v1='',x1='',w1='',N1='',A1='',E1='',T1='',C1='',L1='',S1='',_1='',O1='',q1='',I1='',R1='',ss={align:{"":r1,center:s1,right:n1,justify:i1},background:a1,blockquote:l1,bold:o1,clean:c1,code:el,"code-block":el,color:u1,direction:{"":h1,rtl:f1},formula:d1,header:{1:p1,2:g1,3:m1,4:b1,5:y1,6:v1},italic:x1,image:w1,indent:{"+1":N1,"-1":A1},link:E1,list:{bullet:T1,check:C1,ordered:L1},script:{sub:S1,super:_1},strike:O1,table:q1,underline:I1,video:R1},j1='';let rl=0;function sl(s,t){s.setAttribute(t,`${s.getAttribute(t)!=="true"}`)}class tn{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"),sl(this.label,"aria-expanded"),sl(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 r=t.getAttribute("value");return r&&e.setAttribute("data-value",r),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=j1,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-${rl}`,rl+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{const r=this.buildItem(e);t.appendChild(r),e.selected===!0&&this.selectItem(r)}),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 r=this.container.querySelector(".ql-selected");t!==r&&(r!=null&&r.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 r=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(r)}else this.selectItem(null);const e=t!=null&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}class ao extends tn{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(r=>{r.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 r=this.label.querySelector(".ql-color-label"),n=t&&t.getAttribute("data-value")||"";r&&(r.tagName==="line"?r.style.stroke=n:r.style.fill=n)}}class lo extends tn{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(r=>{r.innerHTML=e[r.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const r=t||this.defaultItem;if(r!=null){if(this.label.innerHTML===r.innerHTML)return;this.label.innerHTML=r.innerHTML}}}const k1=s=>{const{overflowY:t}=getComputedStyle(s,null);return t!=="visible"&&t!=="clip"};class oo{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,k1(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,r=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}px`,this.root.style.top=`${r}px`,this.root.classList.remove("ql-flip");const n=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect();let l=0;if(i.right>n.right&&(l=n.right-i.right,this.root.style.left=`${e+l}px`),i.leftn.bottom){const o=i.bottom-i.top,c=t.bottom-t.top+o;this.root.style.top=`${r-c}px`,this.root.classList.add("ql-flip")}return l}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const M1=[!1,"center","right","justify"],B1=["#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"],P1=[!1,"serif","monospace"],D1=["1","2","3",!1],$1=["small",!1,"large","huge"];class os extends wr{constructor(t,e){super(t,e);const r=n=>{if(!document.body.contains(t.root)){document.body.removeEventListener("click",r);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,r)}addModule(t){const e=super.addModule(t);return t==="toolbar"&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach(r=>{(r.getAttribute("class")||"").split(/\s+/).forEach(i=>{if(i.startsWith("ql-")&&(i=i.slice(3),e[i]!=null))if(i==="direction")r.innerHTML=e[i][""]+e[i].rtl;else if(typeof e[i]=="string")r.innerHTML=e[i];else{const l=r.value||"";l!=null&&e[i][l]&&(r.innerHTML=e[i][l])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(n=>{if(n.classList.contains("ql-align")&&(n.querySelector("option")==null&&Hr(n,M1),typeof e.align=="object"))return new lo(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&&Hr(n,B1,i==="background"?"#ffffff":"#000000"),new ao(n,e[i])}return n.querySelector("option")==null&&(n.classList.contains("ql-font")?Hr(n,P1):n.classList.contains("ql-header")?Hr(n,D1):n.classList.contains("ql-size")&&Hr(n,$1)),new tn(n)});const r=()=>{this.pickers.forEach(n=>{n.update()})};this.quill.on(M.events.EDITOR_CHANGE,r)}}os.DEFAULTS=Se({},wr.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let s=this.container.querySelector("input.ql-image[type=file]");s==null&&(s=document.createElement("input"),s.setAttribute("type","file"),s.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),s.classList.add("ql-image"),s.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,s.files),s.value=""}),this.container.appendChild(s)),s.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class co extends oo{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 r=this.quill.getBounds(this.quill.selection.savedRange);r!=null&&this.position(r),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,M.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,M.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=U1(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(e!=null){const r=e.index+e.length;this.quill.insertEmbed(r,this.root.getAttribute("data-mode"),t,M.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(r+1," ",M.sources.USER),this.quill.setSelection(r+2,M.sources.USER)}break}}this.textbox.value="",this.hide()}}function U1(s){let t=s.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||s.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return t?`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`:(t=s.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`:s}function Hr(s,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t.forEach(r=>{const n=document.createElement("option");r===e?n.setAttribute("selected","selected"):n.setAttribute("value",String(r)),s.appendChild(n)})}const F1=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class uo extends co{constructor(t,e){super(t,e),this.quill.on(M.events.EDITOR_CHANGE,(r,n,i,l)=>{if(r===M.events.SELECTION_CHANGE)if(n!=null&&n.length>0&&l===M.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const o=this.quill.getLines(n.index,n.length);if(o.length===1){const c=this.quill.getBounds(n);c!=null&&this.position(c)}else{const c=o[o.length-1],h=this.quill.getIndex(c),m=Math.min(c.length()-1,n.index+n.length-h),y=this.quill.getBounds(new Ue(h,m));y!=null&&this.position(y)}}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(M.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),r=this.root.querySelector(".ql-tooltip-arrow");return r.style.marginLeft="",e!==0&&(r.style.marginLeft=`${-1*e-r.offsetWidth/2}px`),e}}q(uo,"TEMPLATE",['','
    ','','',"
    "].join(""));class ho extends os{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=F1),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new uo(this.quill,this.options.bounds),t.container!=null&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),ss),this.buildPickers(t.container.querySelectorAll("select"),ss))}}ho.DEFAULTS=Se({},os.DEFAULTS,{modules:{toolbar:{handlers:{link(s){s?this.quill.theme.tooltip.edit():this.quill.format("link",!1,E.sources.USER)}}}}});const H1=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class fo extends co{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 r=this.linkRange;this.restoreFocus(),this.quill.formatText(r,"link",!1,M.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(M.events.SELECTION_CHANGE,(e,r,n)=>{if(e!=null){if(e.length===0&&n===M.sources.USER){const[i,l]=this.quill.scroll.descendant(Le,e.index);if(i!=null){this.linkRange=new Ue(e.index-l,i.length());const o=Le.formats(i.domNode);this.preview.textContent=o,this.preview.setAttribute("href",o),this.show();const c=this.quill.getBounds(this.linkRange);c!=null&&this.position(c);return}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}q(fo,"TEMPLATE",['','','',''].join(""));class po extends os{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=H1),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"),ss),this.buildPickers(t.container.querySelectorAll("select"),ss),this.tooltip=new fo(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,r)=>{t.handlers.link.call(t,!r.format.link)}))}}po.DEFAULTS=Se({},os.DEFAULTS,{modules:{toolbar:{handlers:{link(s){if(s){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:r}=this.quill.theme;r.edit("link",e)}else this.quill.format("link",!1,E.sources.USER)}}}}});E.register({"attributors/attribute/direction":Vl,"attributors/class/align":Hl,"attributors/class/background":lp,"attributors/class/color":ap,"attributors/class/direction":Kl,"attributors/class/font":Xl,"attributors/class/size":Ql,"attributors/style/align":zl,"attributors/style/background":Fi,"attributors/style/color":Ui,"attributors/style/direction":Zl,"attributors/style/font":Yl,"attributors/style/size":Jl},!0);E.register({"formats/align":Hl,"formats/direction":Kl,"formats/indent":Yp,"formats/background":Fi,"formats/color":Ui,"formats/font":Xl,"formats/size":Ql,"formats/blockquote":xi,"formats/code-block":St,"formats/header":wi,"formats/list":ls,"formats/bold":rs,"formats/code":Hi,"formats/italic":Ni,"formats/link":Le,"formats/script":Ai,"formats/strike":Ei,"formats/underline":Ti,"formats/formula":Ds,"formats/image":Ci,"formats/video":$s,"modules/syntax":io,"modules/table":Jp,"modules/toolbar":Zi,"themes/bubble":ho,"themes/snow":po,"ui/icons":ss,"ui/picker":tn,"ui/icon-picker":lo,"ui/color-picker":ao,"ui/tooltip":oo},!0);const z1=({modules:s,formats:t,placeholder:e})=>{const r=H.useRef(null),[n,i]=H.useState(null);return H.useEffect(()=>{if(r.current){const l=new E(r.current,{modules:s,formats:t,placeholder:e});i(l)}},[]),{quillRef:r,quill:n,Quill:E}};var G1=s=>s.replace(/[\u00A0]/g," ");function V1({timeout:s=2e3}={}){const[t,e]=H.useState(null),[r,n]=H.useState(!1),[i,l]=H.useState(null),o=H.useCallback(()=>{i&&clearTimeout(i)},[i]),c=H.useCallback(y=>{o(),l(setTimeout(()=>n(!1),s)),n(y)},[o,s]),h=H.useCallback(y=>{if("clipboard"in navigator){const f=typeof y=="string"?G1(y):y;navigator.clipboard.writeText(f).then(()=>c(!0)).catch(d=>e(d))}else e(new Error("useClipboard: navigator.clipboard is not supported"))},[c]),m=H.useCallback(()=>{n(!1),e(null),o()},[o]);return{copy:h,reset:m,error:t,copied:r}}function K1(s){var t,e,r,n;const i=il(),[l,o]=vo(s,Hn.variantKeys),{ref:c,as:h,children:m,symbol:y="$",classNames:f,timeout:d,copyIcon:v,checkIcon:w,codeString:N,disableCopy:T=!1,disableTooltip:O=!1,hideCopyButton:k=!1,autoFocus:z=!1,hideSymbol:j=!1,onCopy:V,tooltipProps:tt={},copyButtonProps:J={},className:pt,...gt}=l,g=h||"div",L=typeof g=="string",x=(e=(t=s==null?void 0:s.disableAnimation)!=null?t:i==null?void 0:i.disableAnimation)!=null?e:!1,I={offset:15,delay:1e3,content:"Copy to clipboard",color:(n=s==null?void 0:s.color)!=null?n:(r=Hn.defaultVariants)==null?void 0:r.color,isDisabled:l.disableCopy,...tt},S=xo(c),C=H.useRef(null),{copy:_,copied:B}=V1({timeout:d}),$=m&&Array.isArray(m),{isFocusVisible:R,isFocused:K,focusProps:G}=wo({autoFocus:z}),Z=H.useMemo(()=>Hn({...o,disableAnimation:x}),[al(o),x]),Y=H.useMemo(()=>{if(!y||typeof y!="string")return y;const Q=y.trim();return Q?`${Q} `:""},[y]),U=Xi(f==null?void 0:f.base,pt),ct=H.useCallback(()=>({className:Z.base({class:U}),...No(gt,{enabled:L})}),[Z,U,$,gt]),ut=H.useCallback(()=>{var Q;if(T)return;let et="";typeof m=="string"?et=m:Array.isArray(m)&&m.forEach(rt=>{var mt,yt;const we=typeof rt=="string"?rt:(yt=(mt=rt==null?void 0:rt.props)==null?void 0:mt.children)==null?void 0:yt.toString();we&&(et+=we+` `)});const it=N||et||((Q=C.current)==null?void 0:Q.textContent)||"";_(it),V==null||V(it)},[_,N,T,V,m]),W={"aria-label":typeof I.content=="string"?I.content:"Copy to clipboard",size:"sm",variant:"light",isDisabled:T,onPress:ut,isIconOnly:!0,...J},nt=H.useCallback(()=>({...W,"data-copied":Ao(B),className:Z.copyButton({class:Xi(f==null?void 0:f.copyButton)})}),[Z,R,K,T,f==null?void 0:f.copyButton,W,G]);return{Component:g,as:h,domRef:S,preRef:C,children:m,slots:Z,classNames:f,copied:B,onCopy:ut,copyIcon:v,checkIcon:w,symbolBefore:Y,isMultiLine:$,isFocusVisible:R,hideCopyButton:k,disableCopy:T,disableTooltip:O,hideSymbol:j,tooltipProps:I,getSnippetProps:ct,getCopyButtonProps:nt}}var go=Eo((s,t)=>{const{Component:e,domRef:r,preRef:n,children:i,slots:l,classNames:o,copied:c,copyIcon:h=b.jsx(Qo,{}),checkIcon:m=b.jsx(Jo,{}),symbolBefore:y,disableCopy:f,disableTooltip:d,hideSymbol:v,hideCopyButton:w,tooltipProps:N,isMultiLine:T,onCopy:O,getSnippetProps:k,getCopyButtonProps:z}=K1({...s,ref:t}),j=H.useCallback(({children:J})=>b.jsx(xt,{...N,isDisabled:c||N.isDisabled,children:J}),[al(N)]),V=H.useMemo(()=>{if(w)return null;const J=m&&H.cloneElement(m,{className:l.checkIcon()}),pt=h&&H.cloneElement(h,{className:l.copyIcon()}),gt=b.jsxs(lt,{...z(),children:[J,pt]});return d?gt:b.jsx(j,{children:gt})},[l,o==null?void 0:o.copyButton,c,m,h,O,j,f,d,w]),tt=H.useMemo(()=>T&&i&&Array.isArray(i)?b.jsx("div",{className:l.content({class:o==null?void 0:o.content}),children:i.map((J,pt)=>b.jsxs("pre",{className:l.pre({class:o==null?void 0:o.pre}),children:[!v&&b.jsx("span",{className:l.symbol({class:o==null?void 0:o.symbol}),children:y}),J]},`${pt}-${J}`))}):b.jsxs("pre",{ref:n,className:l.pre({class:o==null?void 0:o.pre}),children:[!v&&b.jsx("span",{className:l.symbol({class:o==null?void 0:o.symbol}),children:y}),i]}),[i,v,T,y,o==null?void 0:o.pre,l]);return b.jsxs(e,{ref:r,...k(),children:[tt,V]})});go.displayName="HeroUI.Snippet";var Z1=go;const W1=({messages:s})=>b.jsx(Z1,{hideSymbol:!0,codeString:JSON.stringify(s,null,2),tooltipProps:{content:"点击复制"},classNames:{copyButton:"self-start sticky top-0 right-0"},className:"bg-content1 h-96 overflow-y-scroll items-start",children:JSON.stringify(s,null,2).split(` `).map((t,e)=>b.jsx("span",{className:"whitespace-pre-wrap break-all",children:t},e))}),Ze=()=>{const s=Io();return e=>{s.alert({title:"消息内容",size:"3xl",content:H.createElement(W1,{messages:e})})}};var It=(s=>(s.GroupUpload="group_upload",s.GroupAdmin="group_admin",s.GroupDecrease="group_decrease",s.GroupIncrease="group_increase",s.GroupBan="group_ban",s.FriendAdd="friend_add",s.GroupRecall="group_recall",s.FriendRecall="friend_recall",s.Notify="notify",s.GroupMsgEmojiLike="group_msg_emoji_like",s.GroupMsgEmojiLikeLagrange="reaction",s.GroupEssence="essence",s.GroupCard="group_card",s))(It||{});const Dg=s=>{switch(s){case"message":return"消息";case"notice":return"通知";case"request":return"请求";case"meta_event":return"元事件";case"message_sent":return"消息上报";default:return"未知"}},$g=s=>{switch(s){case"enable":return"启用";case"disable":return"停用";case"connect":return"连接";default:return"未知"}},Ug=s=>{switch(s){case"enable":return"success";case"disable":return"danger";case"connect":return"success";default:return"default"}},Fg=s=>"post_type"in s,Hg=s=>"status"in s&&"retcode"in s,zg=s=>{switch(s){case"ok":return"成功";case"failed":return"失败";case"async":return"异步";default:return"未知"}},Gg=s=>{switch(s){case"ok":return"success";case"failed":return"danger";case"async":return"warning";default:return"default"}},Vg=s=>{switch(s){case It.GroupUpload:return"群文件上传";case It.GroupAdmin:return"群管理员变动";case It.GroupDecrease:return"群成员减少";case It.GroupIncrease:return"群成员增加";case It.GroupBan:return"群禁言";case It.FriendAdd:return"好友添加";case It.GroupRecall:return"群消息撤回";case It.FriendRecall:return"好友消息撤回";case It.Notify:return"通知";case It.GroupMsgEmojiLike:return"群消息表情回应";case It.GroupEssence:return"群消息精华";case It.GroupCard:return"群名片更新";default:return"未知"}},Kg=s=>s.message_type==="group",X1=s=>{var e,r,n;let t={type:"text",data:{text:s.insert}};return typeof s.insert!="string"&&((e=s.insert)!=null&&e.image?t={type:"image",data:{file:s.insert.image.src}}:(r=s.insert)!=null&&r.emoji?t={type:"face",data:{id:s.insert.emoji.id}}:(n=s.insert)!=null&&n.reply&&(t={type:"reply",data:{id:s.insert.reply.messageId}})),t},Ar=s=>/^(http|https|file):\/\/.*/.test(s),Y1=()=>{const[s,t]=H.useState(""),e=H.useRef(null),r=Ze(),n=j=>{r([{type:"record",data:{file:j}}])},[i,l]=H.useState(!1),o=H.useRef(null),c=H.useRef([]),[h,m]=H.useState(null),[y,f]=H.useState(!1),d=H.useRef(null),[v,w]=H.useState(0),N=H.useRef(null);H.useEffect(()=>{var j;i?(navigator.mediaDevices.getUserMedia({audio:!0}).then(V=>{d.current=V;const tt=new MediaRecorder(V);o.current=tt,tt.start(),tt.ondataavailable=J=>{J.data.size>0&&c.current.push(J.data)},tt.onstop=()=>{if(c.current.length>0){const J=new Blob(c.current,{type:"audio/wav"}),pt=new FileReader;pt.readAsDataURL(J),pt.onloadend=()=>{const gt=pt.result;m(gt),f(!0)},c.current=[]}V.getTracks().forEach(J=>J.stop())}}),N.current=setInterval(()=>{w(V=>V+1)},1e3)):((j=o.current)==null||j.stop(),N.current&&(clearInterval(N.current),N.current=null))},[i]);const T=()=>{m(null),f(!1),w(0),l(!0)},O=()=>{l(!1)},k=()=>{h&&n(h)},z=j=>{const V=Math.floor(j/60),tt=j%60;return`${V}:${tt.toString().padStart(2,"0")}`};return b.jsxs(b.Fragment,{children:[b.jsxs($t,{children:[b.jsx(xt,{content:"发送音频",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(Qi,{className:"text-xl"})})})})}),b.jsxs(Ft,{className:"flex-row gap-2 p-4",children:[b.jsx(xt,{content:"上传音频",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",onPress:()=>{var j;(j=e==null?void 0:e.current)==null||j.click()},children:b.jsx(Gs,{})})}),b.jsxs($t,{children:[b.jsx(xt,{content:"输入音频地址",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{tooltip:"输入音频地址",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",children:b.jsx(Vs,{})})})})}),b.jsxs(Ft,{className:"flex-row gap-1 p-2",children:[b.jsx(Kt,{value:s,onChange:j=>t(j.target.value),placeholder:"请输入音频地址"}),b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>{if(!Ar(s)){Er.error("请输入正确的音频地址");return}n(s),t("")},children:b.jsx(Ro,{})})]})]}),b.jsxs($t,{children:[b.jsx(xt,{content:"录制音频",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",children:b.jsx(Qi,{})})})})}),b.jsxs(Ft,{className:"flex-col gap-2 p-4",children:[b.jsxs("div",{className:"flex gap-2",children:[b.jsx(lt,{color:"primary",variant:"flat",onPress:i?O:T,children:i?"停止录制":"开始录制"}),y&&h&&b.jsx(lt,{color:"primary",variant:"flat",onPress:k,children:"查看消息"})]}),(i||h)&&b.jsxs("div",{className:"flex gap-1 items-center",children:[b.jsx("span",{className:To("w-4 h-4 rounded-full",i?"animate-pulse bg-primary-400":"bg-success-400")}),b.jsxs("span",{children:["录制时长: ",z(v)]})]}),y&&h&&b.jsx("audio",{controls:!0,src:h})]})]})]})]}),b.jsx("input",{type:"file",ref:e,hidden:!0,accept:"audio/*",className:"hidden",onChange:j=>{var J;const V=(J=j.target.files)==null?void 0:J[0];if(!V)return;const tt=new FileReader;tt.readAsDataURL(V),tt.onload=pt=>{var g;const gt=(g=pt.target)==null?void 0:g.result;n(gt),j.target.value=""}}})]})},Q1=()=>{const s=Ze();return b.jsx(xt,{content:"发送骰子",children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>{s([{type:"dice"}])},children:b.jsx(Uo,{className:"text-lg"})})})},nl=Yi.data.map(s=>({alt:s.QDes,src:Yi.getUrl(s.QSid),id:s.QSid})),J1=({onInsertEmoji:s,onOpenChange:t})=>{const[e,r]=H.useState([]),[n,i]=H.useState(!1),l=H.useRef(null);H.useEffect(()=>{n&&(r([]),requestAnimationFrame(()=>o()))},[n]);const o=(c=0,h=10)=>{c[...m,...nl.slice(c,c+h)]),requestAnimationFrame(()=>o(c+h,h)))};return b.jsx("div",{ref:l,children:b.jsxs($t,{portalContainer:l.current,shouldCloseOnScroll:!1,placement:"right-start",onOpenChange:c=>{t(c),i(c)},children:[b.jsx(xt,{content:"插入表情",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(Bo,{className:"text-xl"})})})})}),b.jsx(Ft,{className:"grid grid-cols-8 gap-1 flex-wrap justify-start items-start overflow-y-auto max-w-full max-h-96 p-2",children:e.map(c=>b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>s(c),children:b.jsx(Ho,{src:c.src,alt:c.alt,className:"w-6 h-6"})},c.id))})]})})},tg=()=>{const[s,t]=H.useState(""),e=H.useRef(null),r=Ze(),n=i=>{r([{type:"file",data:{file:i}}])};return b.jsxs(b.Fragment,{children:[b.jsxs($t,{children:[b.jsx(xt,{content:"发送文件",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(jo,{className:"text-lg"})})})})}),b.jsxs(Ft,{className:"flex-row gap-2 p-4",children:[b.jsx(xt,{content:"上传文件",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",onPress:()=>{var i;(i=e==null?void 0:e.current)==null||i.click()},children:b.jsx(Gs,{})})}),b.jsxs($t,{children:[b.jsx(xt,{content:"输入文件地址",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{tooltip:"输入文件地址",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",children:b.jsx(Vs,{})})})})}),b.jsxs(Ft,{className:"flex-row gap-1 p-2",children:[b.jsx(Kt,{value:s,onChange:i=>t(i.target.value),placeholder:"请输入文件地址"}),b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>{if(!Ar(s)){Er.error("请输入正确的文件地址");return}n(s),t("")},children:b.jsx(zo,{})})]})]})]})]}),b.jsx("input",{type:"file",ref:e,hidden:!0,className:"hidden",onChange:i=>{var c;const l=(c=i.target.files)==null?void 0:c[0];if(!l)return;const o=new FileReader;o.readAsDataURL(l),o.onload=h=>{var y;const m=(y=h.target)==null?void 0:y.result;n(m),i.target.value=""}}})]})},eg=({insertImage:s,onOpenChange:t})=>{const[e,r]=H.useState(""),n=H.useRef(null);return b.jsxs(b.Fragment,{children:[b.jsxs($t,{onOpenChange:t,children:[b.jsx(xt,{content:"插入图片",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(Po,{className:"text-xl"})})})})}),b.jsxs(Ft,{className:"flex-row gap-2 p-4",children:[b.jsx(xt,{content:"上传图片",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",onPress:()=>{var i;(i=n==null?void 0:n.current)==null||i.click()},children:b.jsx(Gs,{})})}),b.jsxs($t,{children:[b.jsx(xt,{content:"输入图片地址",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{tooltip:"输入图片地址",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",children:b.jsx(Vs,{})})})})}),b.jsxs(Ft,{className:"flex-row gap-1 p-2",children:[b.jsx(Kt,{value:e,onChange:i=>r(i.target.value),placeholder:"请输入图片地址"}),b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>{if(!Ar(e)){Er.error("请输入正确的图片地址");return}s(e),r("")},children:b.jsx(Do,{})})]})]})]})]}),b.jsx("input",{type:"file",ref:n,hidden:!0,accept:"image/*",className:"hidden",onChange:i=>{var c;const l=(c=i.target.files)==null?void 0:c[0];if(!l)return;const o=new FileReader;o.readAsDataURL(l),o.onload=h=>{var y;const m=(y=h.target)==null?void 0:y.result;s(m),i.target.value=""}}})]})},rg=()=>{const[s,t]=H.useState(""),[e,r]=H.useState(new Set(["163"])),[n,i]=H.useState("default"),l=H.useRef(null),{control:o,handleSubmit:c,reset:h}=Wo({defaultValues:{url:"",audio:"",title:"",image:"",content:""}}),m=Ze(),y=d=>{const v=[];d.type==="custom"?v.push({type:"music",data:{...d,type:"custom"}}):v.push({type:"music",data:d}),m(v)},f=d=>{y({type:"custom",...d}),h()};return b.jsx("div",{ref:l,className:"overflow-visible",children:b.jsxs($t,{placement:"right-start",shouldCloseOnScroll:!1,portalContainer:l.current,children:[b.jsx(xt,{content:"发送音乐",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(ko,{className:"text-xl"})})})})}),b.jsx(Ft,{className:"gap-2 p-4",children:b.jsxs(Zo,{placement:"top",className:"w-96",fullWidth:!0,selectedKey:n,onSelectionChange:d=>{d!==null&&i(d)},children:[b.jsxs(Ji,{title:"主流平台",className:"flex flex-col gap-2",children:[b.jsx(Vo,{onClick:d=>d.stopPropagation(),"aria-label":"音乐平台",selectedKeys:e,label:"音乐平台",placeholder:"请选择音乐平台",items:[{name:"QQ音乐",id:"qq"},{name:"网易云音乐",id:"163"},{name:"虾米音乐",id:"xm"}],onSelectionChange:r,children:d=>b.jsx(Ko,{value:d.id,children:d.name},d.id)}),b.jsx(Kt,{value:s,onChange:d=>t(d.target.value),placeholder:"请输入音乐ID",label:"音乐ID"}),b.jsxs(lt,{fullWidth:!0,size:"lg",color:"primary",variant:"flat",radius:"full",onPress:()=>{if(!s){Er.error("请输入音乐ID");return}y({type:Array.from(e)[0],id:s}),t("")},startContent:b.jsx(ta,{}),children:["创建",Array.from(e)[0]==="163"?"网易云":"QQ","音乐"]})]},"default"),b.jsx(Ji,{title:"自定义音乐",className:"flex flex-col gap-2",children:b.jsxs(tc,{onSubmit:c(f),className:"flex flex-col gap-2",validationBehavior:"native",children:[b.jsx(Ur,{name:"url",control:o,render:({field:d})=>b.jsx(Kt,{...d,isRequired:!0,validate:v=>Ar(v)?null:"请输入正确的音乐URL",size:"sm",placeholder:"请输入音乐URL",label:"音乐URL"})}),b.jsx(Ur,{name:"audio",control:o,render:({field:d})=>b.jsx(Kt,{...d,isRequired:!0,validate:v=>Ar(v)?null:"请输入正确的音频URL",size:"sm",placeholder:"请输入音频URL",label:"音频URL"})}),b.jsx(Ur,{name:"title",control:o,render:({field:d})=>b.jsx(Kt,{...d,isRequired:!0,size:"sm",errorMessage:"请输入音乐标题",placeholder:"请输入音乐标题",label:"音乐标题"})}),b.jsx(Ur,{name:"image",control:o,render:({field:d})=>b.jsx(Kt,{...d,size:"sm",placeholder:"请输入封面图片URL",label:"封面图片URL"})}),b.jsx(Ur,{name:"content",control:o,render:({field:d})=>b.jsx(Kt,{...d,size:"sm",placeholder:"请输入音乐描述",label:"音乐描述"})}),b.jsx(lt,{fullWidth:!0,size:"lg",color:"primary",variant:"flat",radius:"full",type:"submit",startContent:b.jsx(ta,{}),children:"创建自定义音乐"})]})},"custom")]})})]})})},sg=({insertReply:s})=>{const[t,e]=H.useState("");return b.jsx(b.Fragment,{children:b.jsxs($t,{children:[b.jsx(xt,{content:"回复消息",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(Fo,{className:"text-lg"})})})})}),b.jsxs(Ft,{className:"flex-row gap-2 p-4",children:[b.jsx(Kt,{placeholder:"输入消息 ID",value:t,onChange:r=>{const n=r.target.value;/^(?:0|(?:-?[1-9]\d*))$/.test(n)&&e(n)}}),b.jsx(lt,{color:"primary",variant:"flat",radius:"full",isIconOnly:!0,onPress:()=>{s(t),e("")},children:b.jsx($o,{})})]})]})})};function ng(s){return Yo({attr:{viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M 11.40625 6.96875 C 10.578125 6.953125 9.890625 7.125 9.46875 7.25 C 9.457031 7.25 9.449219 7.25 9.4375 7.25 L 6.9375 8.03125 C 4.003906 8.933594 2 11.652344 2 14.71875 L 2 20 C 2 23.855469 5.144531 27 9 27 L 18.90625 27 C 20.125 27.027344 21.304688 26.3125 21.78125 25.125 C 22.082031 24.371094 22.039063 23.578125 21.75 22.875 C 22.363281 22.550781 22.882813 22.027344 23.15625 21.34375 C 23.46875 20.558594 23.417969 19.722656 23.09375 19 L 27 19 C 28.644531 19 30 17.644531 30 16 C 30 14.355469 28.644531 13 27 13 L 25.46875 13 L 25.875 12.875 C 27.449219 12.398438 28.351563 10.699219 27.875 9.125 C 27.398438 7.550781 25.699219 6.648438 24.125 7.125 L 15.6875 9.71875 C 15.613281 9.53125 15.527344 9.328125 15.40625 9.125 C 14.90625 8.289063 13.894531 7.34375 12.28125 7.0625 C 11.980469 7.011719 11.683594 6.972656 11.40625 6.96875 Z M 25.125 9 C 25.515625 9.042969 25.847656 9.3125 25.96875 9.71875 C 26.132813 10.257813 25.820313 10.804688 25.28125 10.96875 L 18.4375 13.03125 L 18.78125 14.15625 L 18.78125 15 L 27 15 C 27.566406 15 28 15.433594 28 16 C 28 16.566406 27.566406 17 27 17 L 20.40625 17 L 17.78125 15.96875 C 17.402344 15.816406 17.011719 15.742188 16.625 15.75 L 16.09375 11.65625 L 24.71875 9.03125 C 24.855469 8.988281 24.996094 8.984375 25.125 9 Z M 11.375 9.03125 C 11.566406 9.03125 11.765625 9.03125 11.9375 9.0625 C 13.011719 9.25 13.425781 9.71875 13.6875 10.15625 C 13.949219 10.59375 13.96875 10.90625 13.96875 10.90625 C 13.96875 10.925781 13.96875 10.949219 13.96875 10.96875 L 14.8125 17.40625 C 14.820313 17.4375 14.832031 17.46875 14.84375 17.5 C 14.96875 18.027344 14.652344 18.53125 14.125 18.65625 C 13.800781 18.734375 13.636719 18.691406 13.46875 18.59375 C 13.300781 18.496094 13.09375 18.289063 12.9375 17.84375 L 11.6875 13 C 11.609375 12.703125 11.398438 12.460938 11.121094 12.339844 C 10.839844 12.21875 10.519531 12.230469 10.25 12.375 L 8.59375 13.28125 C 8.109375 13.546875 7.933594 14.15625 8.203125 14.640625 C 8.46875 15.125 9.078125 15.300781 9.5625 15.03125 L 10.0625 14.75 L 11.03125 18.4375 C 11.039063 18.46875 11.050781 18.5 11.0625 18.53125 C 11.332031 19.304688 11.792969 19.925781 12.4375 20.3125 C 12.964844 20.628906 13.578125 20.75 14.1875 20.6875 C 13.871094 20.980469 13.609375 21.355469 13.4375 21.78125 C 12.980469 22.925781 13.269531 24.183594 14.09375 25 L 9 25 C 6.226563 25 4 22.773438 4 20 L 4 14.71875 C 4 12.519531 5.429688 10.585938 7.53125 9.9375 L 10.03125 9.1875 C 10.234375 9.125 10.804688 9.03125 11.375 9.03125 Z M 16.8125 17.78125 C 16.886719 17.792969 16.957031 17.78125 17.03125 17.8125 L 20.75 19.3125 C 21.273438 19.523438 21.523438 20.070313 21.3125 20.59375 C 21.101563 21.117188 20.523438 21.367188 20 21.15625 L 16.28125 19.6875 C 16.226563 19.667969 16.203125 19.621094 16.15625 19.59375 C 16.550781 19.085938 16.804688 18.445313 16.8125 17.78125 Z M 16.1875 21.90625 C 16.320313 21.90625 16.460938 21.917969 16.59375 21.96875 L 17.9375 22.5 L 19.25 23.03125 L 19.375 23.0625 C 19.898438 23.273438 20.148438 23.851563 19.9375 24.375 C 19.785156 24.757813 19.445313 24.980469 19.0625 25 C 19.050781 25 19.042969 25 19.03125 25 C 18.898438 25.003906 18.757813 24.988281 18.625 24.9375 L 15.84375 23.8125 C 15.320313 23.601563 15.070313 23.023438 15.28125 22.5 C 15.386719 22.238281 15.578125 22.070313 15.8125 21.96875 C 15.929688 21.917969 16.054688 21.90625 16.1875 21.90625 Z"},child:[]}]})(s)}const ig=()=>{const s=Ze();return b.jsx(xt,{content:"发送猜拳",children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>{s([{type:"rps"}])},children:b.jsx(ng,{className:"text-2xl"})})})},ag=()=>{const[s,t]=H.useState(""),e=H.useRef(null),r=Ze(),n=i=>{r([{type:"video",data:{file:i}}])};return b.jsxs(b.Fragment,{children:[b.jsxs($t,{children:[b.jsx(xt,{content:"发送视频",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(Mo,{className:"text-xl"})})})})}),b.jsxs(Ft,{className:"flex-row gap-2 p-4",children:[b.jsx(xt,{content:"上传视频",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",onPress:()=>{var i;(i=e==null?void 0:e.current)==null||i.click()},children:b.jsx(Gs,{})})}),b.jsxs($t,{children:[b.jsx(xt,{content:"输入视频地址",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{tooltip:"输入视频地址",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",children:b.jsx(Vs,{})})})})}),b.jsxs(Ft,{className:"flex-row gap-1 p-2",children:[b.jsx(Kt,{value:s,onChange:i=>t(i.target.value),placeholder:"请输入视频地址"}),b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>{if(!Ar(s)){Er.error("请输入正确的视频地址");return}n(s),t("")},children:b.jsx(Xo,{})})]})]})]})]}),b.jsx("input",{type:"file",ref:e,hidden:!0,accept:"video/*",className:"hidden",onChange:i=>{var c;const l=(c=i.target.files)==null?void 0:c[0];if(!l)return;const o=new FileReader;o.readAsDataURL(l),o.onload=h=>{var y;const m=(y=h.target)==null?void 0:y.result;n(m),i.target.value=""}}})]})},lg=E.import("blots/embed"),fr=class fr extends lg{static create(t){const e=super.create(t);return e.setAttribute("alt",t.alt),e.setAttribute("src",t.src),e.setAttribute("data-id",t.id),e.classList.add(...fr.classNames),e}static formats(t){return{alt:t.getAttribute("alt")??"",src:t.getAttribute("src")??"",id:t.getAttribute("data-id")??""}}static value(t){return{alt:t.getAttribute("alt")??"",src:t.getAttribute("src")??"",id:t.getAttribute("data-id")??""}}};q(fr,"blotName","emoji"),q(fr,"tagName","img"),q(fr,"classNames",["w-6","h-6"]);let Li=fr;const og=E.import("blots/embed"),dr=class dr extends og{static create(t){const e=super.create();return e.setAttribute("alt",t.alt),e.setAttribute("src",t.src),e.classList.add(...dr.classNames),e}static value(t){return{alt:t.getAttribute("alt")??"",src:t.getAttribute("src")??""}}};q(dr,"blotName","image"),q(dr,"tagName","img"),q(dr,"classNames",["max-w-48","max-h-48","align-bottom"]);let Si=dr;const cg=E.import("blots/block/embed"),pr=class pr extends cg{static create(t){const e=super.create();e.setAttribute("data-message-id",t.messageId),e.setAttribute("contenteditable","false"),e.classList.add(...pr.classNames);const r=document.createElement("div");r.classList.add("text-sm","text-default-500","relative");const n=document.createElement("div");n.classList.add("w-3","h-3","absolute","top-0","right-0");const i=' ';return n.innerHTML=i,r.innerHTML=`消息ID:${t.messageId}`,r.appendChild(n),e.appendChild(r),e}static value(t){return{messageId:t.getAttribute("data-message-id")||""}}};q(pr,"blotName","reply"),q(pr,"tagName","div"),q(pr,"classNames",["p-2","select-none","bg-default-100","rounded-md","pointer-events-none"]);let _i=pr;const ug=()=>{const s=H.useRef(null),t=Ze(),e=["image","emoji","reply"],r={toolbar:"#toolbar"},{quillRef:n,quill:i,Quill:l}=z1({modules:r,formats:e,placeholder:"请输入消息"});l&&!i&&(l.register("formats/emoji",Li),l.register("formats/image",Si,!0),l.register("formats/reply",_i)),i&&(i.on("selection-change",f=>{var d;if(f){const w=i.getContents().ops[0];typeof(w==null?void 0:w.insert)!="string"&&((d=w==null?void 0:w.insert)!=null&&d.reply)&&f.index===0&&f.length!==i.getLength()&&i.setSelection(1,l.sources.SILENT)}}),i.on("text-change",()=>{var v;const d=i.getContents().ops[0];d&&typeof d.insert!="string"&&((v=d.insert)!=null&&v.reply)&&i.getLength()===1&&i.insertText(1,` `,l.sources.SILENT)}),i.on("editor-change",f=>{var d;if(f==="text-change"){const w=i.getContents().ops[0];w&&typeof w.insert!="string"&&((d=w.insert)!=null&&d.reply)&&i.getLength()===1&&i.insertText(1,` `,l.sources.SILENT)}}),i.root.addEventListener("compositionstart",()=>{var v;const d=i.getContents().ops[0];d&&typeof d.insert!="string"&&((v=d.insert)!=null&&v.reply)&&i.getLength()===1&&i.insertText(1,` `,l.sources.SILENT)}));const o=f=>{if(f){const d=i==null?void 0:i.getSelection();d&&(s.current=d)}},c=f=>{const d=s.current||(i==null?void 0:i.getSelection());i==null||i.deleteText((d==null?void 0:d.index)||0,(d==null?void 0:d.length)||0),i==null||i.insertEmbed((d==null?void 0:d.index)||0,"image",{src:f,alt:"图片"}),i==null||i.setSelection(((d==null?void 0:d.index)||0)+1,0)};function h(f){var T;if(!/^(?:0|(?:-?[1-9]\d*))$/.test(f)){Er.error("请输入正确的消息ID");return}const v=i==null?void 0:i.getContents(),w=v==null?void 0:v.ops[0],N=i==null?void 0:i.getSelection();if(w&&typeof w.insert!="string"&&((T=w.insert)!=null&&T.reply)){const O=i==null?void 0:i.getContents();O&&(O.ops[0]={insert:{reply:{messageId:f}}},i==null||i.setContents(O,l.sources.USER))}else i==null||i.insertEmbed(0,"reply",{messageId:f},l.sources.USER);i==null||i.setSelection(((N==null?void 0:N.index)||0)+1,0),i==null||i.blur()}const m=f=>{const d=s.current||(i==null?void 0:i.getSelection());i==null||i.deleteText((d==null?void 0:d.index)||0,(d==null?void 0:d.length)||0),i==null||i.insertEmbed((d==null?void 0:d.index)||0,"emoji",{alt:f.alt,src:f.src,id:f.id}),i==null||i.setSelection(((d==null?void 0:d.index)||0)+1,0)},y=()=>{var w;const f=i==null?void 0:i.getContents();return(((w=f==null?void 0:f.ops)==null?void 0:w.filter(N=>N.insert!==` `))??[]).map(N=>X1(N))};return b.jsxs("div",{children:[b.jsx("div",{ref:n,className:"border border-default-200 rounded-md !mb-2 !text-base !h-64"}),b.jsxs("div",{id:"toolbar",className:"!border-none flex gap-2",children:[b.jsx(eg,{insertImage:c,onOpenChange:o}),b.jsx(J1,{onInsertEmoji:m,onOpenChange:o}),b.jsx(sg,{insertReply:h}),b.jsx(tg,{}),b.jsx(Y1,{}),b.jsx(ag,{}),b.jsx(rg,{}),b.jsx(Q1,{}),b.jsx(ig,{}),b.jsx(lt,{color:"primary",onPress:()=>{const f=y();t(f)},className:"ml-auto",children:"获取JSON格式"})]})]})};function Zg({children:s}){const{isOpen:t,onOpen:e,onOpenChange:r}=Co();return b.jsxs(b.Fragment,{children:[s?s(e):b.jsx(lt,{onPress:e,color:"primary",radius:"full",variant:"flat",size:"sm",className:"bg-primary/10 text-primary",children:"构造消息"}),b.jsx(Lo,{size:"4xl",scrollBehavior:"inside",isOpen:t,onOpenChange:r,children:b.jsx(So,{children:n=>b.jsxs(b.Fragment,{children:[b.jsx(_o,{className:"flex flex-col gap-1",children:"构造消息"}),b.jsx(Oo,{className:"overflow-y-auto",children:b.jsx("div",{className:"overflow-y-auto",children:b.jsx(ug,{})})}),b.jsx(qo,{children:b.jsx(lt,{color:"primary",onPress:n,variant:"flat",children:"关闭"})})]})})})]})}export{Zg as C,It as O,Ug as a,Vg as b,zg as c,Gg as d,Dg as e,Fg as f,$g as g,Hg as h,Kg as i,Z1 as s};