import{i18nAddResources as t,DomEditor as e,t as n}from"@wangeditor/core";import{Editor as r,Transforms as o,Path as i,Node as a,Point as l,Range as u,Text as c,Element as s}from"slate";import{jsx as f}from"snabbdom";import d from"lodash.throttle";import p,{append as v,on as h,focus as g,attr as y,val as b,html as m,dataset as w,addClass as S,removeClass as x,children as T,each as E,find as N}from"dom7";import"nanoid";import M from"lodash.isequal";t("en",{tableModule:{deleteCol:"Delete column",deleteRow:"Delete row",deleteTable:"Delete table",widthAuto:"Width auto",insertCol:"Insert column",insertRow:"Insert row",insertTable:"Insert table",header:"Header"}}),t("zh-CN",{tableModule:{deleteCol:"删除列",deleteRow:"删除行",deleteTable:"删除表格",widthAuto:"宽度自适应",insertCol:"插入列",insertRow:"插入行",insertTable:"插入表格",header:"表头"}});var O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function H(t){var e={exports:{}};return t(e,e.exports),e.exports}var P,V,z=function(t){return t&&t.Math==Math&&t},L=z("object"==typeof globalThis&&globalThis)||z("object"==typeof window&&window)||z("object"==typeof self&&self)||z("object"==typeof O&&O)||function(){return this}()||Function("return this")(),R=function(t){try{return!!t()}catch(t){return!0}},A=!R((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),C=Function.prototype.call,I=C.bind?C.bind(C):function(){return C.apply(C,arguments)},j={}.propertyIsEnumerable,D=Object.getOwnPropertyDescriptor,k={f:D&&!j.call({1:2},1)?function(t){var e=D(this,t);return!!e&&e.enumerable}:j},B=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},F=Function.prototype,$=F.bind,_=F.call,G=$&&$.bind(_),q=$?function(t){return t&&G(_,t)}:function(t){return t&&function(){return _.apply(t,arguments)}},U=q({}.toString),W=q("".slice),X=function(t){return W(U(t),8,-1)},Y=L.Object,K=q("".split),J=R((function(){return!Y("z").propertyIsEnumerable(0)}))?function(t){return"String"==X(t)?K(t,""):Y(t)}:Y,Q=L.TypeError,Z=function(t){if(null==t)throw Q("Can't call method on "+t);return t},tt=function(t){return J(Z(t))},et=function(t){return"function"==typeof t},nt=function(t){return"object"==typeof t?null!==t:et(t)},rt=function(t){return et(t)?t:void 0},ot=function(t,e){return arguments.length<2?rt(L[t]):L[t]&&L[t][e]},it=q({}.isPrototypeOf),at=ot("navigator","userAgent")||"",lt=L.process,ut=L.Deno,ct=lt&<.versions||ut&&ut.version,st=ct&&ct.v8;st&&(V=(P=st.split("."))[0]>0&&P[0]<4?1:+(P[0]+P[1])),!V&&at&&(!(P=at.match(/Edge\/(\d+)/))||P[1]>=74)&&(P=at.match(/Chrome\/(\d+)/))&&(V=+P[1]);var ft=V,dt=!!Object.getOwnPropertySymbols&&!R((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&ft&&ft<41})),pt=dt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,vt=L.Object,ht=pt?function(t){return"symbol"==typeof t}:function(t){var e=ot("Symbol");return et(e)&&it(e.prototype,vt(t))},gt=L.String,yt=function(t){try{return gt(t)}catch(t){return"Object"}},bt=L.TypeError,mt=function(t){if(et(t))return t;throw bt(yt(t)+" is not a function")},wt=function(t,e){var n=t[e];return null==n?void 0:mt(n)},St=L.TypeError,xt=Object.defineProperty,Tt=function(t,e){try{xt(L,t,{value:e,configurable:!0,writable:!0})}catch(n){L[t]=e}return e},Et=L["__core-js_shared__"]||Tt("__core-js_shared__",{}),Nt=H((function(t){(t.exports=function(t,e){return Et[t]||(Et[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),Mt=L.Object,Ot=function(t){return Mt(Z(t))},Ht=q({}.hasOwnProperty),Pt=Object.hasOwn||function(t,e){return Ht(Ot(t),e)},Vt=0,zt=Math.random(),Lt=q(1..toString),Rt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Lt(++Vt+zt,36)},At=Nt("wks"),Ct=L.Symbol,It=Ct&&Ct.for,jt=pt?Ct:Ct&&Ct.withoutSetter||Rt,Dt=function(t){if(!Pt(At,t)||!dt&&"string"!=typeof At[t]){var e="Symbol."+t;dt&&Pt(Ct,t)?At[t]=Ct[t]:At[t]=pt&&It?It(e):jt(e)}return At[t]},kt=L.TypeError,Bt=Dt("toPrimitive"),Ft=function(t,e){if(!nt(t)||ht(t))return t;var n,r=wt(t,Bt);if(r){if(void 0===e&&(e="default"),n=I(r,t,e),!nt(n)||ht(n))return n;throw kt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&et(n=t.toString)&&!nt(r=I(n,t)))return r;if(et(n=t.valueOf)&&!nt(r=I(n,t)))return r;if("string"!==e&&et(n=t.toString)&&!nt(r=I(n,t)))return r;throw St("Can't convert object to primitive value")}(t,e)},$t=function(t){var e=Ft(t,"string");return ht(e)?e:e+""},_t=L.document,Gt=nt(_t)&&nt(_t.createElement),qt=function(t){return Gt?_t.createElement(t):{}},Ut=!A&&!R((function(){return 7!=Object.defineProperty(qt("div"),"a",{get:function(){return 7}}).a})),Wt=Object.getOwnPropertyDescriptor,Xt={f:A?Wt:function(t,e){if(t=tt(t),e=$t(e),Ut)try{return Wt(t,e)}catch(t){}if(Pt(t,e))return B(!I(k.f,t,e),t[e])}},Yt=L.String,Kt=L.TypeError,Jt=function(t){if(nt(t))return t;throw Kt(Yt(t)+" is not an object")},Qt=L.TypeError,Zt=Object.defineProperty,te={f:A?Zt:function(t,e,n){if(Jt(t),e=$t(e),Jt(n),Ut)try{return Zt(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Qt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},ee=A?function(t,e,n){return te.f(t,e,B(1,n))}:function(t,e,n){return t[e]=n,t},ne=q(Function.toString);et(Et.inspectSource)||(Et.inspectSource=function(t){return ne(t)});var re,oe,ie,ae=Et.inspectSource,le=L.WeakMap,ue=et(le)&&/native code/.test(ae(le)),ce=Nt("keys"),se=function(t){return ce[t]||(ce[t]=Rt(t))},fe={},de=L.TypeError,pe=L.WeakMap;if(ue||Et.state){var ve=Et.state||(Et.state=new pe),he=q(ve.get),ge=q(ve.has),ye=q(ve.set);re=function(t,e){if(ge(ve,t))throw new de("Object already initialized");return e.facade=t,ye(ve,t,e),e},oe=function(t){return he(ve,t)||{}},ie=function(t){return ge(ve,t)}}else{var be=se("state");fe[be]=!0,re=function(t,e){if(Pt(t,be))throw new de("Object already initialized");return e.facade=t,ee(t,be,e),e},oe=function(t){return Pt(t,be)?t[be]:{}},ie=function(t){return Pt(t,be)}}var me={set:re,get:oe,has:ie,enforce:function(t){return ie(t)?oe(t):re(t,{})},getterFor:function(t){return function(e){var n;if(!nt(e)||(n=oe(e)).type!==t)throw de("Incompatible receiver, "+t+" required");return n}}},we=Function.prototype,Se=A&&Object.getOwnPropertyDescriptor,xe=Pt(we,"name"),Te={EXISTS:xe,PROPER:xe&&"something"===function(){}.name,CONFIGURABLE:xe&&(!A||A&&Se(we,"name").configurable)},Ee=H((function(t){var e=Te.CONFIGURABLE,n=me.get,r=me.enforce,o=String(String).split("String");(t.exports=function(t,n,i,a){var l,u=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,s=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;et(i)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Pt(i,"name")||e&&i.name!==f)&&ee(i,"name",f),(l=r(i)).source||(l.source=o.join("string"==typeof f?f:""))),t!==L?(u?!s&&t[n]&&(c=!0):delete t[n],c?t[n]=i:ee(t,n,i)):c?t[n]=i:Tt(n,i)})(Function.prototype,"toString",(function(){return et(this)&&n(this).source||ae(this)}))})),Ne=Math.ceil,Me=Math.floor,Oe=function(t){var e=+t;return e!=e||0===e?0:(e>0?Me:Ne)(e)},He=Math.max,Pe=Math.min,Ve=function(t,e){var n=Oe(t);return n<0?He(n+e,0):Pe(n,e)},ze=Math.min,Le=function(t){return t>0?ze(Oe(t),9007199254740991):0},Re=function(t){return Le(t.length)},Ae=function(t){return function(e,n,r){var o,i=tt(e),a=Re(i),l=Ve(r,a);if(t&&n!=n){for(;a>l;)if((o=i[l++])!=o)return!0}else for(;a>l;l++)if((t||l in i)&&i[l]===n)return t||l||0;return!t&&-1}},Ce={includes:Ae(!0),indexOf:Ae(!1)}.indexOf,Ie=q([].push),je=function(t,e){var n,r=tt(t),o=0,i=[];for(n in r)!Pt(fe,n)&&Pt(r,n)&&Ie(i,n);for(;e.length>o;)Pt(r,n=e[o++])&&(~Ce(i,n)||Ie(i,n));return i},De=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ke=De.concat("length","prototype"),Be={f:Object.getOwnPropertyNames||function(t){return je(t,ke)}},Fe={f:Object.getOwnPropertySymbols},$e=q([].concat),_e=ot("Reflect","ownKeys")||function(t){var e=Be.f(Jt(t)),n=Fe.f;return n?$e(e,n(t)):e},Ge=function(t,e){for(var n=_e(e),r=te.f,o=Xt.f,i=0;i3})))},{anchor:function(t){return e="a",n="name",r=t,o=cn(Z(this)),i="<"+e,""!==n&&(i+=" "+n+'="'+fn(cn(r),sn,""")+'"'),i+">"+o+"";var e,n,r,o,i}});var dn,pn=function(){var t=Jt(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},vn=L.RegExp,hn=R((function(){var t=vn("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),gn=hn||R((function(){return!vn("a","y").sticky})),yn={BROKEN_CARET:hn||R((function(){var t=vn("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:gn,UNSUPPORTED_Y:hn},bn=Object.keys||function(t){return je(t,De)},mn=A?Object.defineProperties:function(t,e){Jt(t);for(var n,r=tt(e),o=bn(e),i=o.length,a=0;i>a;)te.f(t,n=o[a++],r[n]);return t},wn=ot("document","documentElement"),Sn=se("IE_PROTO"),xn=function(){},Tn=function(t){return"