gzkx-package 0.1.43 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +0 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/const J=W((Z||(Z=1,G=Y,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var i=arguments[t];i&&(e=r(e,n(i)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var i="";for(var s in n)e.call(n,s)&&n[s]&&(i=r(i,s));return i}function r(e,t){return t?e?e+" "+t:e+t:e}G.exports?(t.default=t,G.exports=t):window.classNames=t}()),Y.exports)),X=Math.round;function Q(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const ee=(e,t,n)=>0===n?e:e/100;function te(e,t){const n=t||255;return e>n?n:e<0?0:e}class ne{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(V(this,"isValid",!0),V(this,"r",0),V(this,"g",0),V(this,"b",0),V(this,"a",1),V(this,"_h",void 0),V(this,"_s",void 0),V(this,"_l",void 0),V(this,"_v",void 0),V(this,"_max",void 0),V(this,"_min",void 0),V(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof ne)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=te(e.r),this.g=te(e.g),this.b=te(e.b),this.a="number"==typeof e.a?te(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:X(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,i=e=>(n[e]-this[e])*r+this[e],s={r:X(i("r")),g:X(i("g")),b:X(i("b")),a:X(100*i("a"))/100};return this._c(s)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>X((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=X(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=X(100*this.getSaturation()),n=X(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=te(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=X(255*n);this.r=e,this.g=e,this.b=e}let i=0,s=0,o=0;const l=e/60,a=(1-Math.abs(2*n-1))*t,c=a*(1-Math.abs(l%2-1));l>=0&&l<1?(i=a,s=c):l>=1&&l<2?(i=c,s=a):l>=2&&l<3?(s=a,o=c):l>=3&&l<4?(s=c,o=a):l>=4&&l<5?(i=c,o=a):l>=5&&l<6&&(i=a,o=c);const u=n-a/2;this.r=X(255*(i+u)),this.g=X(255*(s+u)),this.b=X(255*(o+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const i=X(255*n);if(this.r=i,this.g=i,this.b=i,t<=0)return;const s=e/60,o=Math.floor(s),l=s-o,a=X(n*(1-t)*255),c=X(n*(1-t*l)*255),u=X(n*(1-t*(1-l))*255);switch(o){case 0:this.g=u,this.b=a;break;case 1:this.r=c,this.b=a;break;case 2:this.r=a,this.b=u;break;case 3:this.r=a,this.g=c;break;case 4:this.r=u,this.g=a;break;default:this.g=a,this.b=c}}fromHsvString(e){const t=Q(e,ee);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Q(e,ee);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Q(e,(e,t)=>t.includes("%")?X(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var re=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function ie(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function se(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function oe(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var le=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}le.primary=le[5];var ue="data-rc-order",de="data-rc-priority",he=new Map;function fe(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function pe(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function me(e){return Array.from((he.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function ge(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,i=t.priority,s=void 0===i?0:i,o=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(ue,o),l&&s&&a.setAttribute(de,"".concat(s)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=e;var c=pe(t),u=c.firstChild;if(r){if(l){var d=(t.styles||me(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(ue)))return!1;var t=Number(e.getAttribute(de)||0);return s>=t});if(d.length)return c.insertBefore(a,d[d.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=pe(n),i=me(r),s=ce(ce({},n),{},{styles:i});!function(e,t){var n=he.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=ge("",t),i=r.parentNode;he.set(e,i),e.removeChild(r)}}(r,s);var o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=pe(t);return(t.styles||me(n)).find(function(n){return n.getAttribute(fe(t))===e})}(t,s);if(o){var l,a,c;if(null!==(l=s.csp)&&void 0!==l&&l.nonce&&o.nonce!==(null===(a=s.csp)||void 0===a?void 0:a.nonce))o.nonce=null===(c=s.csp)||void 0===c?void 0:c.nonce;return o.innerHTML!==e&&(o.innerHTML=e),o}var u=ge(e,s);return u.setAttribute(fe(s),t),u}function be(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function ye(e){return function(e){return be(e)instanceof ShadowRoot}(e)?be(e):null}var xe={},we=[];function Ne(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)we.reduce(function(e,t){return t(null!=e?e:"","warning")},t)}function Ee(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)we.reduce(function(e,t){return t(null!=e?e:"","note")},t)}function ke(e,t,n){t||xe[n]||(e(!1,n),xe[n]=!0)}function Ae(e,t){ke(Ne,e,t)}function Se(e){return"object"===$(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===$(e.icon)||"function"==typeof e.icon)}function Ce(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,i=e[n];if("class"===n)t.className=i,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=i;return t},{})}function je(e,t,n){return n?r.createElement(e.tag,ce(ce({key:t},Ce(e.attrs)),n),(e.children||[]).map(function(n,r){return je(n,"".concat(t,"-").concat(e.tag,"-").concat(r))})):r.createElement(e.tag,ce({key:t},Ce(e.attrs)),(e.children||[]).map(function(n,r){return je(n,"".concat(t,"-").concat(e.tag,"-").concat(r))}))}function Oe(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new ne(e),i=r.toHsv(),s=5;s>0;s-=1){var o=new ne({h:ie(i,s,!0),s:se(i,s,!0),v:oe(i,s,!0)});n.push(o)}n.push(r);for(var l=1;l<=4;l+=1){var a=new ne({h:ie(i,l),s:se(i,l),v:oe(i,l)});n.push(a)}return"dark"===t.theme?re.map(function(e){var r=e.index,i=e.amount;return new ne(t.backgroundColor||"#141414").mix(n[r],i).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function qe(e){return e?Array.isArray(e)?e:[e]:[]}Ae.preMessage=function(e){we.push(e)},Ae.resetWarned=function(){xe={}},Ae.noteOnce=function(e,t){ke(Ee,e,t)};var _e=["icon","className","onClick","style","primaryColor","secondaryColor"],Te={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var Le=function(e){var t,n,i,s,o,l,a,c,d=e.icon,h=e.className,f=e.onClick,p=e.style,m=e.primaryColor,g=e.secondaryColor,v=H(e,_e),b=u.useRef(),y=Te;if(m&&(y={primaryColor:m,secondaryColor:g||Oe(m)}),t=b,n=r.useContext(D),i=n.csp,s=n.prefixCls,o=n.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",s&&(l=l.replace(/anticon/g,s)),o&&(l="@layer ".concat(o," {\n").concat(l,"\n}")),r.useEffect(function(){var e=ye(t.current);ve(l,"@ant-design-icons",{prepend:!o,csp:i,attachTo:e})},[]),a=Se(d),c="icon should be icon definiton, but got ".concat(d),Ae(a,"[@ant-design/icons] ".concat(c)),!Se(d))return null;var x=d;return x&&"function"==typeof x.icon&&(x=ce(ce({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),je(x.icon,"svg-".concat(x.name),ce(ce({className:h,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},v),{},{ref:b}))};function Ie(e){var t=U(qe(e),2),n=t[0],r=t[1];return Le.setTwoToneColors({primaryColor:n,secondaryColor:r})}Le.displayName="IconReact",Le.getTwoToneColors=function(){return ce({},Te)},Le.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;Te.primaryColor=t,Te.secondaryColor=n||Oe(t),Te.calculated=!!n};var Re=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Ie(le.primary);var Me=u.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,s=e.rotate,o=e.tabIndex,l=e.onClick,a=e.twoToneColor,c=H(e,Re),d=u.useContext(D),h=d.prefixCls,f=void 0===h?"anticon":h,p=d.rootClassName,m=J(p,f,V(V({},"".concat(f,"-").concat(r.name),!!r.name),"".concat(f,"-spin"),!!i||"loading"===r.name),n),g=o;void 0===g&&l&&(g=-1);var v=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,b=U(qe(a),2),y=b[0],x=b[1];return u.createElement("span",P({role:"img","aria-label":r.name},c,{ref:t,tabIndex:g,onClick:l,className:m}),u.createElement(Le,{icon:r,primaryColor:y,secondaryColor:x,style:v}))});Me.displayName="AntdIcon",Me.getTwoToneColor=function(){var e=Le.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Me.setTwoToneColor=Ie;var Be={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},De=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Be}))},Pe=u.forwardRef(De);"production"!==process.env.NODE_ENV&&(Pe.displayName="DownOutlined");var Fe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},Ue=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Fe}))},$e=u.forwardRef(Ue);"production"!==process.env.NODE_ENV&&($e.displayName="PlusOutlined");var ze={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},Ve=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:ze}))},He=u.forwardRef(Ve);"production"!==process.env.NODE_ENV&&(He.displayName="RightOutlined");var Ke={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},We=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Ke}))},Ze=u.forwardRef(We);"production"!==process.env.NODE_ENV&&(Ze.displayName="SettingOutlined");var Ge={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},Ye=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Ge}))},Je=u.forwardRef(Ye);"production"!==process.env.NODE_ENV&&(Je.displayName="UploadOutlined");const{Option:Xe}=i.Select,Qe=e=>(t,n)=>{const r=null==t?void 0:t[e],i=null==n?void 0:n[e],s=null==r||""===r,o=null==i||""===i;if(s&&o)return 0;if(s)return 1;if(o)return-1;const l=Number(r),a=Number(i);if(!isNaN(l)&&!isNaN(a))return l-a;const c=String(r),u=String(i);return c.localeCompare(u,"zh-CN",{numeric:!0,sensitivity:"base"})},et=({columns:e,dataSource:t,pagination:s,tableId:o,size:a="middle",onRowClick:c,page:u,showTableConfig:d=!0,...h})=>{var p;const[m,g]=r.useState([]),[v,b]=r.useState([]),[y,x]=r.useState(!1),[w,N]=r.useState([]),[E,k]=r.useState([]),[A,C]=r.useState([]),[j]=i.Form.useForm(),[O,q]=r.useState([]),[_,T]=r.useState({field:null,order:null}),[L,I]=r.useState([]),R=f.getUserInfo(),M=null==(p=f.getOrgInfo())?void 0:p.orgId,B=r.useRef(void 0),D=r.useRef(void 0),P=r.useMemo(()=>(null==e?void 0:e.map(e=>e.dataIndex||e.key).join(","))||"",[e]),F=r.useCallback(async()=>{var t,n,r;const i=(null==e?void 0:e.map((e,t)=>({key:e.key||e.dataIndex||`col-${t}`,title:e.title,dataIndex:e.dataIndex,displayTitle:"string"==typeof e.title?e.title:`列 ${t+1}`,headerAlignment:e.align||"left",contentAlignment:e.align||"left",dataFormat:"字符串",width:e.width||100,enabled:!1!==e.enabled,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:t+1,render:e.render,fixed:e.fixed,originalColumn:{...e}})))||[];if(k(i),e.length>1)try{if(o){const l=await(s={userId:R.userId,tableId:o||"",orgId:M},S("/platform/business/common/getTableConfigByUser",s));if(null==(t=null==l?void 0:l.data)?void 0:t.content){const t=null==(r=JSON.parse(null==(n=null==l?void 0:l.data)?void 0:n.content))?void 0:r.map(t=>{var n;const r=null==(n=e.find(e=>e.key===t.key))?void 0:n.render;return{...t,render:r,originalColumn:{...t.originalColumn,render:r}}});N(t),C(t)}else N(i),C(i)}else N(i),C(i)}catch(l){N(i),C(i)}else N(i),C(i);var s},[e,o,R.userId]),U=r.useMemo(()=>l.debounce(F,100),[F]);r.useEffect(()=>{(B.current!==o||D.current!==P)&&(B.current=o,D.current=P,U())},[o,P,U]),r.useEffect(()=>{const t=w.filter(e=>e.enabled).sort((e,t)=>e.sort-t.sort).map(t=>{const n=e.find(e=>(e.key||e.dataIndex)===t.key),r={...t.originalColumn,...n,key:t.key,title:t.displayTitle,dataIndex:t.dataIndex,align:t.contentAlignment,width:Number(t.width),onHeaderCell:e=>{var r;const i=(null==n?void 0:n.onHeaderCell)||(null==(r=t.originalColumn)?void 0:r.onHeaderCell),s=i?i(e):{};return{...s,style:{...s.style,textAlign:t.headerAlignment}}}};return t.allowSorting&&t.dataIndex&&(r.sorter=!0,r.sortDirections=["ascend","descend"],r.sortOrder=_.field===t.dataIndex?_.order:null),r}),s=[...d?[{title:n.jsxs(i.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(i.Tooltip,{title:"表格配置",children:n.jsx(Ze,{onClick:()=>x(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(e,t,r)=>{const s=e||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+r+1||r+1;return n.jsx(i.Tooltip,{title:String(s),children:n.jsx("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})})}}]:[],...t].map(e=>{const t=e.render;return{...e,render:(s,o,l)=>{const a=t?t(s,o,l):s;return r.isValidElement(a)?n.jsx("div",{style:{textAlign:e.align,width:"100%"},children:a}):"object"==typeof a&&null!==a?"":n.jsx(i.Tooltip,{title:null!=a?String(a):"",children:n.jsx("div",{style:{display:"block",width:"100%",textAlign:e.align,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",paddingLeft:"left"===e.align?0:void 0,paddingRight:"right"===e.align?0:void 0},children:null!=a?a:""})})}}});g(s)},[w,d,u,_,e]),r.useEffect(()=>{const e=(t,n,r)=>t.map((t,i)=>{const s=`${n}.${i+1}`,o={...t,parentId:(null==t?void 0:t.parentId)||r,id:(null==t?void 0:t.id)||`${r}-${i+1}`,INDEX:s};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(o.children=e(t.children,s,o.id)),o}),n=(t||[]).map((t,n)=>{const r=(null==t?void 0:t.INDEX)||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+n+1||n+1,i={...t,parentId:(null==t?void 0:t.parentId)||null,id:(null==t?void 0:t.id)||n+1,INDEX:r};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(i.children=e(t.children,r,i.id)),i});if(q(n.map(e=>e.id)),I(n),_.field&&_.order&&n.length>0){const e=[...n].sort((e,t)=>{const n=Qe(_.field)(e,t);return"descend"===_.order?-n:n});b(e)}else b(n)},[t]);const $=r.useRef(null),z=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(e,t)=>n.jsx(i.Input,{size:"small",defaultValue:e,onBlur:e=>V(t.key,"displayTitle",e.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>V(t.key,"headerAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"内容对齐",dataIndex:"contentAlignment",key:"contentAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>V(t.key,"contentAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"数据格式",dataIndex:"dataFormat",key:"dataFormat",render:(e,t)=>n.jsxs(i.Select,{size:"small",defaultValue:e,style:{width:80},onChange:e=>V(t.key,"dataFormat",e),children:[n.jsx(Xe,{value:"字符串",children:"字符串"}),n.jsx(Xe,{value:"数字",children:"数字"}),n.jsx(Xe,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>V(t.key,"width",e.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>V(t.key,"enabled",e)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>V(t.key,"allowSorting",e)})},{title:"显示顺序",dataIndex:"sort",key:"sort",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>V(t.key,"sort",e.target.value)})}],V=(e,t,n)=>{C(r=>r.map(r=>r.key===e?{...r,[t]:n}:r))},H=async()=>{try{const t=await(e={tableId:o||"",userId:R.userId,content:JSON.stringify(A)},S("/platform/business/common/saveUserTableConfig",e));N(A),200===(null==t?void 0:t.code)&&(i.message.success("保存成功"),U())}catch(t){}var e},K=()=>{x(!1)},W=(e,t=!1)=>{q(t?O.filter(t=>t!==(null==e?void 0:e.id)):[...O,null==e?void 0:e.id])},Z=r.useCallback(e=>{const{field:t,order:n}=e,r=L||[];if(!t||!n)return T({field:null,order:null}),void b([...r]);if(T({field:t,order:n}),0===r.length)return void b([]);const i=[...r].sort((e,r)=>{const i=Qe(t)(e,r);return"descend"===n?-i:i});b(i)},[L]),G=r.useCallback((e,t,n,r)=>{"sort"!==(null==r?void 0:r.action)?(h.onChange&&h.onChange(e,t,n,r),h.handleTableChange&&h.handleTableChange(e,t,n)):Z(n)},[Z,h.onChange,h.handleTableChange]),Y=r.useMemo(()=>{if(!1===s)return!1;if(s&&"object"==typeof s){const e={pageSize:10,...s};return Array.isArray(e.pageSizeOptions)&&(e.pageSizeOptions=e.pageSizeOptions.filter(e=>null!=e)),e}return s},[s]);return n.jsxs(i.ConfigProvider,{theme:{components:{Table:{bodySortBg:"transparent",headerSortActiveBg:"#2569D8",headerSortHoverBg:"#2569D8"}}},children:[n.jsx(i.Table,{...h,columns:m,dataSource:v,bordered:!0,rowKey:"id",indentSize:24,pagination:Y,size:"small",onChange:G,onRow:(e,t)=>{const n=h.onRow?h.onRow(e,t):{};return{...n,onClick:t=>{var r;c&&c(e,t),null==(r=null==n?void 0:n.onClick)||r.call(n,t)}}},expandable:{expandedRowKeys:O,expandIcon:({expanded:e,onExpand:t,record:r})=>{var i;if((null==(i=null==r?void 0:r.children)?void 0:i.length)>0){const i={fontSize:"14px",color:"rgba(0, 0, 0, 0.45)",cursor:"pointer",position:"absolute",left:`${18+8*((null==r?void 0:r.INDEX)?String(r.INDEX).split(".").length-1:0)}px`,top:"13px"};return e?n.jsx(Pe,{onClick:e=>{t(r,e),W(r,!0)},style:i}):n.jsx(He,{onClick:e=>{t(r,e),W(r,!1)},style:i})}return null}}}),n.jsx(i.Modal,{title:"表格设置",visible:y,footer:[n.jsx(i.Button,{onClick:async()=>{var e;200===(await(e={userId:R.userId,tableId:o||""},S("/platform/business/common/restoreDefaultTableConfig",e))).code&&(N(E),C(E),x(!1),i.message.success("重置成功"))},children:"重置"},"reset"),n.jsx(i.Button,{onClick:K,children:"取消"},"cancel"),n.jsx(i.Button,{onClick:async()=>{try{const t=await(e={orgId:M,tableId:o||"",content:JSON.stringify(A)},S("/platform/business/common/saveCurOrgTableConfig",e));N(A),200===(null==t?void 0:t.code)&&(i.message.success("保存为机构配置成功"),x(!1))}catch(t){}var e},children:"保存为该机构配置"},"saveOrg"),n.jsx(i.Button,{type:"primary",onClick:()=>{x(!1),H()},children:"保存"},"submit")],onCancel:K,width:1e3,destroyOnClose:!0,maskClosable:!1,children:n.jsx(i.Spin,{spinning:!1,children:n.jsx(i.Form,{form:j,component:!1,children:n.jsx(i.Table,{ref:$,columns:z,dataSource:A.filter(e=>!e.isBuiltIn).sort((e,t)=>e.sort-t.sort),rowKey:"key",size:"small",pagination:!1,bordered:!0,scroll:{y:400}})})})})]})},tt=({label:e,id:t,value:s,onChange:o,disabled:l=!1})=>{const[a,c]=r.useState([]),[u,d]=r.useState(void 0),[h,f]=r.useState(!1),[p,m]=r.useState(void 0),[g,v]=r.useState(void 0),[b,y]=r.useState(void 0),[x,w]=r.useState(void 0),[N,E]=r.useState([]),[k,A]=r.useState(void 0),[S,C]=r.useState(!1),[j,O]=r.useState([]),[_,T]=r.useState(void 0),[L,I]=r.useState(!1),[R,M]=r.useState([]),[B,D]=r.useState(void 0),[P,F]=r.useState(!1),[U,$]=r.useState(""),[z,V]=r.useState({}),H=r.useRef(!1),K=r.useRef(!1),W=r.useCallback(e=>{o&&o(e)},[o]),Z=r.useCallback(async(e,t)=>{switch(e){case 1:f(!0);break;case 2:C(!0);break;case 3:I(!0);break;case 4:F(!0)}try{const n=await q({level:e,parent:t.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(e=>({value:e.code,label:e.name})):[]}catch(n){return[]}finally{switch(e){case 1:f(!1);break;case 2:C(!1);break;case 3:I(!1);break;case 4:F(!1)}}},[]);r.useEffect(()=>{Z(1,"0").then(e=>{c(e)})},[Z]),r.useEffect(()=>{s&&!H.current&&(H.current=!0,V(s),d(s.addProvinceCode),m(s.addProvince),s.addProvinceCode&&Z(2,s.addProvinceCode).then(e=>{E(e),A(s.addCityCode),v(s.addCity),s.addCityCode&&Z(3,s.addCityCode).then(e=>{O(e),T(s.addCountyCode),y(s.addCounty),s.addCountyCode&&Z(4,s.addCountyCode).then(e=>{M(e),D(s.addStreetCode),w(s.addStreet),$(s.address||"")})})}))},[s,Z]),r.useEffect(()=>{u?Z(2,u).then(e=>{E(e)}):(v(void 0),y(void 0),w(void 0),m(void 0),$(""),A(void 0),E([]),T(void 0),O([]),D(void 0),M([]))},[u,Z]),r.useEffect(()=>{k?Z(3,k).then(e=>{O(e)}):(T(void 0),O([]),D(void 0),M([]),$(""))},[k,Z]),r.useEffect(()=>{_?Z(4,_).then(e=>{M(e)}):(D(void 0),M([]),$(""))},[_,Z]),r.useEffect(()=>{H.current&&(K.current=!0,W({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:b,addCountyCode:_,addStreet:x,addStreetCode:B,address:U}),setTimeout(()=>{K.current=!1},0))},[p,g,b,u,k,_,B,x,U,W]);return n.jsxs("div",{children:[" ",n.jsxs(i.Space,{wrap:!0,id:t,children:[" ",n.jsx(i.Select,{style:{minWidth:100},options:a,value:u,onChange:e=>{var t;e===u&&void 0!==e||(d(e),m(null==(t=a.find(t=>t.value===e))?void 0:t.label),A(void 0),v(void 0),E([]),T(void 0),y(void 0),O([]),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择省",loading:h,disabled:l,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:N,value:k,onChange:e=>{var t;e===k&&void 0!==e||(A(e),v(null==(t=N.find(t=>t.value===e))?void 0:t.label),T(void 0),y(void 0),O([]),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择市",loading:S,disabled:l||!u||h,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:j,value:_,onChange:e=>{var t;e===_&&void 0!==e||(T(e),y(null==(t=j.find(t=>t.value===e))?void 0:t.label),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择区/县",loading:L,disabled:l||!k||S,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:R,value:B,onChange:e=>{var t;e===B&&void 0!==e||(D(e),w(null==(t=R.find(t=>t.value===e))?void 0:t.label),$(""))},placeholder:"请选择乡/镇",loading:P,disabled:l||!_||L,allowClear:!0}),n.jsx(i.Input,{placeholder:"请输入详细地址",disabled:l||!_,value:U,onChange:e=>$(e.target.value)})]})]})},nt=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,key:a,disabled:c=!1})=>{const[u,d]=r.useState(!1),[h,f]=r.useState(""),[p,m]=r.useState(""),[g,v]=r.useState([]);r.useEffect(()=>{v(e?[{uid:"-1",name:"image.png",status:"done",url:e}]:[])},[e]);const b=r.useCallback(e=>{t&&t(e)},[t]),y=n.jsxs("div",{children:[n.jsx($e,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:g,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),f(e.url||e.preview),d(!0),m(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n,r;if(v(t),"done"===e.status){const r=null==(n=e.response)?void 0:n.data;r?(i.message.success(`${e.name} 文件上传成功`),null==b||b(r)):(i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),v(t.filter(t=>t.uid!==e.uid)))}else"removed"===e.status?(i.message.success(`${e.name} 文件已移除`),null==b||b(void 0)):"error"===e.status&&(i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),null==b||b(void 0))},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e;if(r instanceof File&&r.size>8388608)return i.message.error("文件大小不能超过 8MB"),void(null==n||n(new Error("文件大小不能超过 8MB")));const o=new FormData;o.append("file",r);try{const e=await(l=o,a={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&s({percent:e.loaded/e.total*100})}},S("/platform/general/upload",l,a));e&&e.data?(null==b||b(e.data),t(e,r)):n(new Error("上传成功但响应中缺少图片URL"),e)}catch(c){n(c)}var l,a},maxCount:l,disabled:c,onRemove:e=>!0,children:g.length>=(l||1)?null:y},a),n.jsx(i.Modal,{visible:u,title:p,footer:null,onCancel:()=>d(!1),children:n.jsx("img",{alt:"example",style:{width:"100%"},src:h})})]})};var rt="object"==typeof global&&global&&global.Object===Object&&global,it="object"==typeof self&&self&&self.Object===Object&&self,st=rt||it||Function("return this")(),ot=st.Symbol,lt=Object.prototype,at=lt.hasOwnProperty,ct=lt.toString,ut=ot?ot.toStringTag:void 0;var dt=Object.prototype.toString;var ht=ot?ot.toStringTag:void 0;function ft(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ht&&ht in Object(e)?function(e){var t=at.call(e,ut),n=e[ut];try{e[ut]=void 0;var r=!0}catch(s){}var i=ct.call(e);return r&&(t?e[ut]=n:delete e[ut]),i}(e):function(e){return dt.call(e)}(e)}function pt(e){return null!=e&&"object"==typeof e}var mt=Array.isArray;function gt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function vt(e){return e}function bt(e){if(!gt(e))return!1;var t=ft(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var yt,xt=st["__core-js_shared__"],wt=(yt=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+yt:"";var Nt=Function.prototype.toString;function Et(e){if(null!=e){try{return Nt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var kt=/^\[object .+?Constructor\]$/,At=Function.prototype,St=Object.prototype,Ct=At.toString,jt=St.hasOwnProperty,Ot=RegExp("^"+Ct.call(jt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qt(e){return!(!gt(e)||(t=e,wt&&wt in t))&&(bt(e)?Ot:kt).test(Et(e));var t}function _t(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return qt(n)?n:void 0}var Tt=_t(st,"WeakMap"),Lt=Object.create,It=function(){function e(){}return function(t){if(!gt(t))return{};if(Lt)return Lt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Rt=Date.now;var Mt,Bt,Dt,Pt=function(){try{var e=_t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Ft=Pt?function(e,t){return Pt(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:vt,Ut=(Mt=Ft,Bt=0,Dt=0,function(){var e=Rt(),t=16-(e-Dt);if(Dt=e,t>0){if(++Bt>=800)return arguments[0]}else Bt=0;return Mt.apply(void 0,arguments)});var $t=/^(?:0|[1-9]\d*)$/;function zt(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&$t.test(e))&&e>-1&&e%1==0&&e<t}function Vt(e,t,n){"__proto__"==t&&Pt?Pt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ht(e,t){return e===t||e!=e&&t!=t}var Kt=Object.prototype.hasOwnProperty;function Wt(e,t,n){var r=e[t];Kt.call(e,t)&&Ht(r,n)&&(void 0!==n||t in e)||Vt(e,t,n)}var Zt=Math.max;function Gt(e,t){return Ut(function(e,t,n){return t=Zt(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=Zt(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,l)}}(e,t,vt),e+"")}function Yt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Jt(e){return null!=e&&Yt(e.length)&&!bt(e)}var Xt=Object.prototype;function Qt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Xt)}function en(e){return pt(e)&&"[object Arguments]"==ft(e)}var tn=Object.prototype,nn=tn.hasOwnProperty,rn=tn.propertyIsEnumerable,sn=en(function(){return arguments}())?en:function(e){return pt(e)&&nn.call(e,"callee")&&!rn.call(e,"callee")};var on="object"==typeof exports&&exports&&!exports.nodeType&&exports,ln=on&&"object"==typeof module&&module&&!module.nodeType&&module,an=ln&&ln.exports===on?st.Buffer:void 0,cn=(an?an.isBuffer:void 0)||function(){return!1},un={};function dn(e){return function(t){return e(t)}}un["[object Float32Array]"]=un["[object Float64Array]"]=un["[object Int8Array]"]=un["[object Int16Array]"]=un["[object Int32Array]"]=un["[object Uint8Array]"]=un["[object Uint8ClampedArray]"]=un["[object Uint16Array]"]=un["[object Uint32Array]"]=!0,un["[object Arguments]"]=un["[object Array]"]=un["[object ArrayBuffer]"]=un["[object Boolean]"]=un["[object DataView]"]=un["[object Date]"]=un["[object Error]"]=un["[object Function]"]=un["[object Map]"]=un["[object Number]"]=un["[object Object]"]=un["[object RegExp]"]=un["[object Set]"]=un["[object String]"]=un["[object WeakMap]"]=!1;var hn="object"==typeof exports&&exports&&!exports.nodeType&&exports,fn=hn&&"object"==typeof module&&module&&!module.nodeType&&module,pn=fn&&fn.exports===hn&&rt.process,mn=function(){try{var e=fn&&fn.require&&fn.require("util").types;return e||pn&&pn.binding&&pn.binding("util")}catch(t){}}(),gn=mn&&mn.isTypedArray,vn=gn?dn(gn):function(e){return pt(e)&&Yt(e.length)&&!!un[ft(e)]},bn=Object.prototype.hasOwnProperty;function yn(e,t){var n=mt(e),r=!n&&sn(e),i=!n&&!r&&cn(e),s=!n&&!r&&!i&&vn(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!t&&!bn.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||zt(c,a))||l.push(c);return l}function xn(e,t){return function(n){return e(t(n))}}var wn=xn(Object.keys,Object),Nn=Object.prototype.hasOwnProperty;function En(e){return Jt(e)?yn(e):function(e){if(!Qt(e))return wn(e);var t=[];for(var n in Object(e))Nn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var kn=Object.prototype.hasOwnProperty;function An(e){if(!gt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Qt(e),n=[];for(var r in e)("constructor"!=r||!t&&kn.call(e,r))&&n.push(r);return n}function Sn(e){return Jt(e)?yn(e,!0):An(e)}var Cn=_t(Object,"create");var jn=Object.prototype.hasOwnProperty;var On=Object.prototype.hasOwnProperty;function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function _n(e,t){for(var n=e.length;n--;)if(Ht(e[n][0],t))return n;return-1}qn.prototype.clear=function(){this.__data__=Cn?Cn(null):{},this.size=0},qn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qn.prototype.get=function(e){var t=this.__data__;if(Cn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return jn.call(t,e)?t[e]:void 0},qn.prototype.has=function(e){var t=this.__data__;return Cn?void 0!==t[e]:On.call(t,e)},qn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Cn&&void 0===t?"__lodash_hash_undefined__":t,this};var Tn=Array.prototype.splice;function Ln(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ln.prototype.clear=function(){this.__data__=[],this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=_n(t,e);return!(n<0)&&(n==t.length-1?t.pop():Tn.call(t,n,1),--this.size,!0)},Ln.prototype.get=function(e){var t=this.__data__,n=_n(t,e);return n<0?void 0:t[n][1]},Ln.prototype.has=function(e){return _n(this.__data__,e)>-1},Ln.prototype.set=function(e,t){var n=this.__data__,r=_n(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var In=_t(st,"Map");function Rn(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(In||Ln),string:new qn}},Mn.prototype.delete=function(e){var t=Rn(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Rn(this,e).get(e)},Mn.prototype.has=function(e){return Rn(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Rn(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var Bn=xn(Object.getPrototypeOf,Object),Dn=Function.prototype,Pn=Object.prototype,Fn=Dn.toString,Un=Pn.hasOwnProperty,$n=Fn.call(Object);function zn(e){var t=this.__data__=new Ln(e);this.size=t.size}zn.prototype.clear=function(){this.__data__=new Ln,this.size=0},zn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},zn.prototype.get=function(e){return this.__data__.get(e)},zn.prototype.has=function(e){return this.__data__.has(e)},zn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ln){var r=n.__data__;if(!In||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(r)}return n.set(e,t),this.size=n.size,this};var Vn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Hn=Vn&&"object"==typeof module&&module&&!module.nodeType&&module,Kn=Hn&&Hn.exports===Vn?st.Buffer:void 0,Wn=Kn?Kn.allocUnsafe:void 0;function Zn(e,t){if(t)return e.slice();var n=e.length,r=Wn?Wn(n):new e.constructor(n);return e.copy(r),r}var Gn=Object.prototype.propertyIsEnumerable,Yn=Object.getOwnPropertySymbols,Jn=Yn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(Yn(e),function(t){return Gn.call(e,t)}))}:function(){return[]};function Xn(e){return function(e,t,n){var r=t(e);return mt(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,En,Jn)}var Qn=_t(st,"DataView"),er=_t(st,"Promise"),tr=_t(st,"Set"),nr="[object Map]",rr="[object Promise]",ir="[object Set]",sr="[object WeakMap]",or="[object DataView]",lr=Et(Qn),ar=Et(In),cr=Et(er),ur=Et(tr),dr=Et(Tt),hr=ft;(Qn&&hr(new Qn(new ArrayBuffer(1)))!=or||In&&hr(new In)!=nr||er&&hr(er.resolve())!=rr||tr&&hr(new tr)!=ir||Tt&&hr(new Tt)!=sr)&&(hr=function(e){var t=ft(e),n="[object Object]"==t?e.constructor:void 0,r=n?Et(n):"";if(r)switch(r){case lr:return or;case ar:return nr;case cr:return rr;case ur:return ir;case dr:return sr}return t});var fr=Object.prototype.hasOwnProperty;var pr=st.Uint8Array;function mr(e){var t=new e.constructor(e.byteLength);return new pr(t).set(new pr(e)),t}var gr=/\w*$/;var vr=ot?ot.prototype:void 0,br=vr?vr.valueOf:void 0;function yr(e,t){var n=t?mr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function xr(e,t,n){var r,i,s,o,l,a=e.constructor;switch(t){case"[object ArrayBuffer]":return mr(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return l=mr((o=e).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return yr(e,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(s=new(i=e).constructor(i.source,gr.exec(i))).lastIndex=i.lastIndex,s;case"[object Symbol]":return r=e,br?Object(br.call(r)):{}}}function wr(e){return"function"!=typeof e.constructor||Qt(e)?{}:It(Bn(e))}var Nr=mn&&mn.isMap,Er=Nr?dn(Nr):function(e){return pt(e)&&"[object Map]"==hr(e)};var kr=mn&&mn.isSet,Ar=kr?dn(kr):function(e){return pt(e)&&"[object Set]"==hr(e)},Sr="[object Arguments]",Cr="[object Function]",jr="[object Object]",Or={};function qr(e,t,n,r,i,s){var o,l=1&t;if(void 0!==o)return o;if(!gt(e))return e;var a=mt(e);if(a)o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&fr.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=hr(e),u=c==Cr||"[object GeneratorFunction]"==c;if(cn(e))return Zn(e,l);if(c==jr||c==Sr||u&&!i)o=u?{}:wr(e);else{if(!Or[c])return i?e:{};o=xr(e,c,l)}}s||(s=new zn);var d=s.get(e);if(d)return d;s.set(e,o),Ar(e)?e.forEach(function(r){o.add(qr(r,t,n,r,e,s))}):Er(e)&&e.forEach(function(r,i){o.set(i,qr(r,t,n,i,e,s))});var h=a?void 0:Xn(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(h||e,function(r,i){h&&(r=e[i=r]),Wt(o,i,qr(r,t,n,i,e,s))}),o}Or[Sr]=Or["[object Array]"]=Or["[object ArrayBuffer]"]=Or["[object DataView]"]=Or["[object Boolean]"]=Or["[object Date]"]=Or["[object Float32Array]"]=Or["[object Float64Array]"]=Or["[object Int8Array]"]=Or["[object Int16Array]"]=Or["[object Int32Array]"]=Or["[object Map]"]=Or["[object Number]"]=Or[jr]=Or["[object RegExp]"]=Or["[object Set]"]=Or["[object String]"]=Or["[object Symbol]"]=Or["[object Uint8Array]"]=Or["[object Uint8ClampedArray]"]=Or["[object Uint16Array]"]=Or["[object Uint32Array]"]=!0,Or["[object Error]"]=Or[Cr]=Or["[object WeakMap]"]=!1;function _r(e){return qr(e,5)}function Tr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Mn;++t<n;)this.add(e[t])}function Lr(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}Tr.prototype.add=Tr.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Tr.prototype.has=function(e){return this.__data__.has(e)};function Ir(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e),u=s.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,f=2&n?new Tr:void 0;for(s.set(e,t),s.set(t,e);++d<l;){var p=e[d],m=t[d];if(r)var g=o?r(m,p,d,t,e,s):r(p,m,d,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(f){if(!Lr(t,function(e,t){if(o=t,!f.has(o)&&(p===e||i(p,e,n,r,s)))return f.push(t);var o})){h=!1;break}}else if(p!==m&&!i(p,m,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Rr(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Mr(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Br=ot?ot.prototype:void 0,Dr=Br?Br.valueOf:void 0;var Pr=Object.prototype.hasOwnProperty;var Fr="[object Arguments]",Ur="[object Array]",$r="[object Object]",zr=Object.prototype.hasOwnProperty;function Vr(e,t,n,r,i,s){var o=mt(e),l=mt(t),a=o?Ur:hr(e),c=l?Ur:hr(t),u=(a=a==Fr?$r:a)==$r,d=(c=c==Fr?$r:c)==$r,h=a==c;if(h&&cn(e)){if(!cn(t))return!1;o=!0,u=!1}if(h&&!u)return s||(s=new zn),o||vn(e)?Ir(e,t,n,r,i,s):function(e,t,n,r,i,s,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new pr(e),new pr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ht(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=Rr;case"[object Set]":var a=1&r;if(l||(l=Mr),e.size!=t.size&&!a)return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var u=Ir(l(e),l(t),r,i,s,o);return o.delete(e),u;case"[object Symbol]":if(Dr)return Dr.call(e)==Dr.call(t)}return!1}(e,t,a,n,r,i,s);if(!(1&n)){var f=u&&zr.call(e,"__wrapped__"),p=d&&zr.call(t,"__wrapped__");if(f||p){var m=f?e.value():e,g=p?t.value():t;return s||(s=new zn),i(m,g,n,r,s)}}return!!h&&(s||(s=new zn),function(e,t,n,r,i,s){var o=1&n,l=Xn(e),a=l.length;if(a!=Xn(t).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in t:Pr.call(t,u)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var f=!0;s.set(e,t),s.set(t,e);for(var p=o;++c<a;){var m=e[u=l[c]],g=t[u];if(r)var v=o?r(g,m,u,t,e,s):r(m,g,u,e,t,s);if(!(void 0===v?m===g||i(m,g,n,r,s):v)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var b=e.constructor,y=t.constructor;b==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(f=!1)}return s.delete(e),s.delete(t),f}(e,t,n,r,i,s))}function Hr(e,t,n,r,i){return e===t||(null==e||null==t||!pt(e)&&!pt(t)?e!=e&&t!=t:Vr(e,t,n,r,Hr,i))}var Kr=function(e,t,n){for(var r=-1,i=Object(e),s=n(e),o=s.length;o--;){var l=s[++r];if(!1===t(i[l],l,i))break}return e};function Wr(e,t,n){(void 0!==n&&!Ht(e[t],n)||void 0===n&&!(t in e))&&Vt(e,t,n)}function Zr(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function Gr(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i],l=void 0;void 0===l&&(l=e[o]),r?Vt(n,o,l):Wt(n,o,l)}return n}(e,Sn(e))}function Yr(e,t,n,r,i,s,o){var l=Zr(e,n),a=Zr(t,n),c=o.get(a);if(c)Wr(e,n,c);else{var u,d=s?s(l,a,n+"",e,t,o):void 0,h=void 0===d;if(h){var f=mt(a),p=!f&&cn(a),m=!f&&!p&&vn(a);d=a,f||p||m?mt(l)?d=l:pt(u=l)&&Jt(u)?d=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(l):p?(h=!1,d=Zn(a,!0)):m?(h=!1,d=yr(a,!0)):d=[]:function(e){if(!pt(e)||"[object Object]"!=ft(e))return!1;var t=Bn(e);if(null===t)return!0;var n=Un.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fn.call(n)==$n}(a)||sn(a)?(d=l,sn(l)?d=Gr(l):gt(l)&&!bt(l)||(d=wr(a))):h=!1}h&&(o.set(a,d),i(d,a,r,s,o),o.delete(a)),Wr(e,n,d)}}function Jr(e,t,n,r,i){e!==t&&Kr(t,function(s,o){if(i||(i=new zn),gt(s))Yr(e,t,o,n,Jr,r,i);else{var l=r?r(Zr(e,o),s,o+"",e,t,i):void 0;void 0===l&&(l=s),Wr(e,o,l)}},Sn)}function Xr(e,t){return Hr(e,t)}var Qr,ei=(Qr=function(e,t,n){Jr(e,t,n)},Gt(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,s=r>2?t[2]:void 0;for(i=Qr.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(e,t,n){if(!gt(n))return!1;var r=typeof t;return!!("number"==r?Jt(n)&&zt(t,n.length):"string"==r&&t in n)&&Ht(n[t],e)}(t[0],t[1],s)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var o=t[n];o&&Qr(e,o,n,i)}return e})),ti=(e=>(e[e.TYPE=3]="TYPE",e[e.LEVEL=12]="LEVEL",e[e.ATTRIBUTE=13]="ATTRIBUTE",e[e.BLOT=14]="BLOT",e[e.INLINE=7]="INLINE",e[e.BLOCK=11]="BLOCK",e[e.BLOCK_BLOT=10]="BLOCK_BLOT",e[e.INLINE_BLOT=6]="INLINE_BLOT",e[e.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",e[e.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",e[e.ANY=15]="ANY",e))(ti||{});class ni{constructor(e,t,n={}){this.attrName=e,this.keyName=t;const r=ti.TYPE&ti.ATTRIBUTE;this.scope=null!=n.scope?n.scope&ti.LEVEL|r:ti.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(e){return Array.from(e.attributes).map(e=>e.name)}add(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)}canAdd(e,t){return null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1)}remove(e){e.removeAttribute(this.keyName)}value(e){const t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""}}class ri extends Error{constructor(e){super(e="[Parchment] "+e),this.message=e,this.name=this.constructor.name}}const ii=class e{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(e,t=!1){if(null==e)return null;if(this.blots.has(e))return this.blots.get(e)||null;if(t){let n=null;try{n=e.parentNode}catch{return null}return this.find(n,t)}return null}create(t,n,r){const i=this.query(n);if(null==i)throw new ri(`Unable to create ${n} blot`);const s=i,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:s.create(r),l=new s(t,o,r);return e.blots.set(l.domNode,l),l}find(t,n=!1){return e.find(t,n)}query(e,t=ti.ANY){let n;return"string"==typeof e?n=this.types[e]||this.attributes[e]:e instanceof Text||e.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof e?e&ti.LEVEL&ti.BLOCK?n=this.types.block:e&ti.LEVEL&ti.INLINE&&(n=this.types.inline):e instanceof Element&&((e.getAttribute("class")||"").split(/\s+/).some(e=>(n=this.classes[e],!!n)),n=n||this.tags[e.tagName]),null==n?null:"scope"in n&&t&ti.LEVEL&n.scope&&t&ti.TYPE&n.scope?n:null}register(...e){return e.map(e=>{const t="blotName"in e,n="attrName"in e;if(!t&&!n)throw new ri("Invalid definition");if(t&&"abstract"===e.blotName)throw new ri("Cannot register abstract class");const r=t?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?"string"==typeof e.keyName&&(this.attributes[e.keyName]=e):t&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(e=>e.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(t=>{(null==this.tags[t]||null==e.className)&&(this.tags[t]=e)}))),e})}};ii.blots=new WeakMap;let si=ii;function oi(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(e=>0===e.indexOf(`${t}-`))}const li=class extends ni{static keys(e){return(e.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(`${this.keyName}-${t}`),!0)}remove(e){oi(e,this.keyName).forEach(t=>{e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")}value(e){const t=(oi(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""}};function ai(e){const t=e.split("-"),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("");return t[0]+n}const ci=class extends ni{static keys(e){return(e.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(e,t){return!!this.canAdd(e,t)&&(e.style[ai(this.keyName)]=t,!0)}remove(e){e.style[ai(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")}value(e){const t=e.style[ai(this.keyName)];return this.canAdd(e,t)?t:""}};const ui=class{constructor(e){this.attributes={},this.domNode=e,this.build()}attribute(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])}build(){this.attributes={};const e=si.find(this.domNode);if(null==e)return;const t=ni.keys(this.domNode),n=li.keys(this.domNode),r=ci.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{const n=e.scroll.query(t,ti.ATTRIBUTE);n instanceof ni&&(this.attributes[n.attrName]=n)})}copy(e){Object.keys(this.attributes).forEach(t=>{const n=this.attributes[t].value(this.domNode);e.format(t,n)})}move(e){this.copy(e),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((e,t)=>(e[t]=this.attributes[t].value(this.domNode),e),{})}},di=class{constructor(e,t){this.scroll=e,this.domNode=t,si.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(null==this.tagName)throw new ri("Blot definition missing tagName");let t,n;return Array.isArray(this.tagName)?("string"==typeof e?(n=e.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof e&&(n=e),t="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t}get statics(){return this.constructor}attach(){}clone(){const e=this.domNode.cloneNode(!1);return this.scroll.create(e)}detach(){null!=this.parent&&this.parent.removeChild(this),si.blots.delete(this.domNode)}deleteAt(e,t){this.isolate(e,t).remove()}formatAt(e,t,n,r){const i=this.isolate(e,t);if(null!=this.scroll.query(n,ti.BLOT)&&r)i.wrap(n,r);else if(null!=this.scroll.query(n,ti.ATTRIBUTE)){const e=this.scroll.create(this.statics.scope);i.wrap(e),e.format(n,r)}}insertAt(e,t,n){const r=null==n?this.scroll.create("text",t):this.scroll.create(t,n),i=this.split(e);this.parent.insertBefore(r,i||void 0)}isolate(e,t){const n=this.split(e);if(null==n)throw new Error("Attempt to isolate at end");return n.split(t),n}length(){return 1}offset(e=this.parent){return null==this.parent||this===e?0:this.parent.children.offset(this)+this.parent.offset(e)}optimize(e){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(e,t){return 0===e?this:this.next}update(e,t){}wrap(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new ri(`Cannot wrap ${e}`);return n.appendChild(this),n}};di.blotName="abstract";let hi=di;const fi=class extends hi{static value(e){return!0}index(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1}position(e,t){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};fi.scope=ti.INLINE_BLOT;const pi=fi;class mi{constructor(){this.head=null,this.tail=null,this.length=0}append(...e){if(this.insertBefore(e[0],null),e.length>1){const t=e.slice(1);this.append(...t)}}at(e){const t=this.iterator();let n=t();for(;n&&e>0;)e-=1,n=t();return n}contains(e){const t=this.iterator();let n=t();for(;n;){if(n===e)return!0;n=t()}return!1}indexOf(e){const t=this.iterator();let n=t(),r=0;for(;n;){if(n===e)return r;r+=1,n=t()}return-1}insertBefore(e,t){null!=e&&(this.remove(e),e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)}offset(e){let t=0,n=this.head;for(;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return-1}remove(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)}iterator(e=this.head){return()=>{const t=e;return null!=e&&(e=e.next),t}}find(e,t=!1){const n=this.iterator();let r=n();for(;r;){const i=r.length();if(e<i||t&&e===i&&(null==r.next||0!==r.next.length()))return[r,e];e-=i,r=n()}return[null,0]}forEach(e){const t=this.iterator();let n=t();for(;n;)e(n),n=t()}forEachAt(e,t,n){if(t<=0)return;const[r,i]=this.find(e);let s=e-i;const o=this.iterator(r);let l=o();for(;l&&s<e+t;){const r=l.length();e>s?n(l,e-s,Math.min(t,s+r-e)):n(l,0,Math.min(r,e+t-s)),s+=r,l=o()}}map(e){return this.reduce((t,n)=>(t.push(e(n)),t),[])}reduce(e,t){const n=this.iterator();let r=n();for(;r;)t=e(t,r),r=n();return t}}function gi(e,t){const n=t.find(e);if(n)return n;try{return t.create(e)}catch{const n=t.create(ti.INLINE);return Array.from(e.childNodes).forEach(e=>{n.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(n.domNode,e),n.attach(),n}}const vi=class e extends hi{constructor(e,t){super(e,t),this.uiNode=null,this.build()}appendChild(e){this.insertBefore(e)}attach(){super.attach(),this.children.forEach(e=>{e.attach()})}attachUI(t){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=t,e.uiClass&&this.uiNode.classList.add(e.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new mi,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{const t=gi(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(t){if(t instanceof ri)return;throw t}})}deleteAt(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,(e,t,n)=>{e.deleteAt(t,n)})}descendant(t,n=0){const[r,i]=this.children.find(n);return null==t.blotName&&t(r)||null!=t.blotName&&r instanceof t?[r,i]:r instanceof e?r.descendant(t,i):[null,-1]}descendants(t,n=0,r=Number.MAX_VALUE){let i=[],s=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&i.push(n),n instanceof e&&(i=i.concat(n.descendants(t,r,s))),s-=o}),i}detach(){this.children.forEach(e=>{e.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(n=>{t||this.statics.allowedChildren.some(e=>n instanceof e)||(n.statics.scope===ti.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),t=!0):n instanceof e?n.unwrap():n.remove())})}formatAt(e,t,n,r){this.children.forEachAt(e,t,(e,t,i)=>{e.formatAt(t,i,n,r)})}insertAt(e,t,n){const[r,i]=this.children.find(e);if(r)r.insertAt(i,t,n);else{const e=null==n?this.scroll.create("text",t):this.scroll.create(t,n);this.appendChild(e)}}insertBefore(e,t){null!=e.parent&&e.parent.children.remove(e);let n=null;this.children.insertBefore(e,t||null),e.parent=this,null!=t&&(n=t.domNode),(this.domNode.parentNode!==e.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(e.domNode,n),e.attach()}length(){return this.children.reduce((e,t)=>e+t.length(),0)}moveChildren(e,t){this.children.forEach(n=>{e.insertBefore(n,t)})}optimize(e){if(super.optimize(e),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,n=!1){const[r,i]=this.children.find(t,n),s=[[this,t]];return r instanceof e?s.concat(r.path(i,n)):(null!=r&&s.push([r,i]),s)}removeChild(e){this.children.remove(e)}replaceWith(t,n){const r="string"==typeof t?this.scroll.create(t,n):t;return r instanceof e&&this.moveChildren(r),super.replaceWith(r)}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(e,this.length(),(e,r,i)=>{const s=e.split(r,t);null!=s&&n.appendChild(s)}),n}splitAfter(e){const t=this.clone();for(;null!=e.next;)t.appendChild(e.next);return this.parent&&this.parent.insertBefore(t,this.next||void 0),t}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(e,t){const n=[],r=[];e.forEach(e=>{e.target===this.domNode&&"childList"===e.type&&(n.push(...e.addedNodes),r.push(...e.removedNodes))}),r.forEach(e=>{if(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const t=this.scroll.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===this.domNode)&&t.detach()}),n.filter(e=>e.parentNode===this.domNode&&e!==this.uiNode).sort((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(e=>{let t=null;null!=e.nextSibling&&(t=this.scroll.find(e.nextSibling));const n=gi(e,this.scroll);(n.next!==t||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};vi.uiClass="";const bi=vi;const yi=class e extends bi{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ui(this.domNode)}format(t,n){if(t!==this.statics.blotName||n){const e=this.scroll.query(t,ti.INLINE);if(null==e)return;e instanceof ni?this.attributes.attribute(e,n):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n)}else this.children.forEach(t=>{t instanceof e||(t=t.wrap(e.blotName,!0)),this.attributes.copy(t)}),this.unwrap()}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.formats()[n]||this.scroll.query(n,ti.ATTRIBUTE)?this.isolate(e,t).format(n,r):super.formatAt(e,t,n,r)}optimize(t){super.optimize(t);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof e&&r.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}wrap(t,n){const r=super.wrap(t,n);return r instanceof e&&this.attributes.move(r),r}};yi.allowedChildren=[yi,pi],yi.blotName="inline",yi.scope=ti.INLINE_BLOT,yi.tagName="SPAN";const xi=yi,wi=class e extends bi{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ui(this.domNode)}format(t,n){const r=this.scroll.query(t,ti.BLOCK);null!=r&&(r instanceof ni?this.attributes.attribute(r,n):t!==this.statics.blotName||n?n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n):this.replaceWith(e.blotName))}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.scroll.query(n,ti.BLOCK)?this.format(n,r):super.formatAt(e,t,n,r)}insertAt(e,t,n){if(null==n||null!=this.scroll.query(t,ti.INLINE))super.insertAt(e,t,n);else{const r=this.split(e);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const e=this.scroll.create(t,n);r.parent.insertBefore(e,r)}}}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}};wi.blotName="block",wi.scope=ti.BLOCK_BLOT,wi.tagName="P",wi.allowedChildren=[xi,wi,pi];const Ni=wi,Ei=class extends bi{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(e,t){super.deleteAt(e,t),this.enforceAllowedChildren()}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.enforceAllowedChildren()}insertAt(e,t,n){super.insertAt(e,t,n),this.enforceAllowedChildren()}optimize(e){super.optimize(e),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};Ei.blotName="container",Ei.scope=ti.BLOCK_BLOT;const ki=Ei;const Ai=class extends pi{static formats(e,t){}format(e,t){super.formatAt(0,this.length(),e,t)}formatAt(e,t,n,r){0===e&&t===this.length()?this.format(n,r):super.formatAt(e,t,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},Si={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},Ci=class extends bi{constructor(e,t){super(null,t),this.registry=e,this.scroll=this,this.build(),this.observer=new MutationObserver(e=>{this.update(e)}),this.observer.observe(this.domNode,Si),this.attach()}create(e,t){return this.registry.create(this,e,t)}find(e,t=!1){const n=this.registry.find(e,t);return n?n.scroll===this?n:t?this.find(n.scroll.domNode.parentNode,!0):null:null}query(e,t=ti.ANY){return this.registry.query(e,t)}register(...e){return this.registry.register(...e)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(e,t){this.update(),0===e&&t===this.length()?this.children.forEach(e=>{e.remove()}):super.deleteAt(e,t)}formatAt(e,t,n,r){this.update(),super.formatAt(e,t,n,r)}insertAt(e,t,n){this.update(),super.insertAt(e,t,n)}optimize(e=[],t={}){super.optimize(t);const n=t.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)e.push(r.pop());const i=(e,t=!0)=>{null==e||e===this||null!=e.domNode.parentNode&&(n.has(e.domNode)||n.set(e.domNode,[]),t&&i(e.parent))},s=e=>{n.has(e.domNode)&&(e instanceof bi&&e.children.forEach(s),n.delete(e.domNode),e.optimize(t))};let o=e;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(e=>{const t=this.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(i(this.find(e.previousSibling,!1)),Array.from(e.addedNodes).forEach(e=>{const t=this.find(e,!1);i(t,!1),t instanceof bi&&t.children.forEach(e=>{i(e,!1)})})):"attributes"===e.type&&i(t.prev)),i(t))}),this.children.forEach(s),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)e.push(r.pop())}}update(e,t={}){e=e||this.observer.takeRecords();const n=new WeakMap;e.map(e=>{const t=this.find(e.target,!0);return null==t?null:n.has(t.domNode)?(n.get(t.domNode).push(e),null):(n.set(t.domNode,[e]),t)}).forEach(e=>{null!=e&&e!==this&&n.has(e.domNode)&&e.update(n.get(e.domNode)||[],t)}),t.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),t),this.optimize(e,t)}};Ci.blotName="scroll",Ci.defaultChild=Ni,Ci.allowedChildren=[Ni,ki],Ci.scope=ti.BLOCK_BLOT,Ci.tagName="DIV";const ji=Ci,Oi=class e extends pi{static create(e){return document.createTextNode(e)}static value(e){return e.data}constructor(e,t){super(e,t),this.text=this.statics.value(this.domNode)}deleteAt(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)}index(e,t){return this.domNode===e?t:-1}insertAt(e,t,n){null==n?(this.text=this.text.slice(0,e)+t+this.text.slice(e),this.domNode.data=this.text):super.insertAt(e,t,n)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(e,t=!1){return[this.domNode,e]}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(e,t){e.some(e=>"characterData"===e.type&&e.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};Oi.blotName="text",Oi.scope=ti.INLINE_BLOT;const qi=Oi,_i=Object.freeze(Object.defineProperty({__proto__:null,Attributor:ni,AttributorStore:ui,BlockBlot:Ni,ClassAttributor:li,ContainerBlot:ki,EmbedBlot:Ai,InlineBlot:xi,LeafBlot:pi,ParentBlot:bi,Registry:si,Scope:ti,ScrollBlot:ji,StyleAttributor:ci,TextBlot:qi},Symbol.toStringTag,{value:"Module"}));var Ti,Li,Ii={exports:{}};function Ri(){if(Li)return Ti;Li=1;var e=-1;function t(h,f,p,m,v){if(h===f)return h?[[0,h]]:[];if(null!=p){var b=function(e,t,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,i="number"==typeof n?null:n.newRange,s=e.length,o=t.length;if(0===r.length&&(null===i||0===i.length)){var l=r.index,a=e.slice(0,l),c=e.slice(l),u=i?i.index:null,d=l+o-s;if((null===u||u===d)&&!(d<0||d>o)){var h=t.slice(0,d);if((m=t.slice(d))===c){var f=Math.min(l,d);if((b=a.slice(0,f))===(x=h.slice(0,f)))return g(b,a.slice(f),h.slice(f),c)}}if(null===u||u===l){var p=l,m=(h=t.slice(0,p),t.slice(p));if(h===a){var v=Math.min(s-p,o-p);if((y=c.slice(c.length-v))===(w=m.slice(m.length-v)))return g(a,c.slice(0,c.length-v),m.slice(0,m.length-v),y)}}}if(r.length>0&&i&&0===i.length){var b=e.slice(0,r.index),y=e.slice(r.index+r.length);if(!(o<(f=b.length)+(v=y.length))){var x=t.slice(0,f),w=t.slice(o-v);if(b===x&&y===w)return g(b,e.slice(f,s-v),t.slice(f,o-v),y)}}return null}(h,f,p);if(b)return b}var y=r(h,f),x=h.substring(0,y);y=s(h=h.substring(y),f=f.substring(y));var w=h.substring(h.length-y),N=function(i,o){var l;if(!i)return[[1,o]];if(!o)return[[e,i]];var a=i.length>o.length?i:o,c=i.length>o.length?o:i,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],i.length>o.length&&(l[0][0]=l[2][0]=e),l;if(1===c.length)return[[e,i],[1,o]];var d=function(e,t){var n=e.length>t.length?e:t,i=e.length>t.length?t:e;if(n.length<4||2*i.length<n.length)return null;function o(e,t,n){for(var i,o,l,a,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,d="";-1!==(u=t.indexOf(c,u+1));){var h=r(e.substring(n),t.substring(u)),f=s(e.substring(0,n),t.substring(0,u));d.length<f+h&&(d=t.substring(u-f,u)+t.substring(u,u+h),i=e.substring(0,n-f),o=e.substring(n+h),l=t.substring(0,u-f),a=t.substring(u+h))}return 2*d.length>=e.length?[i,o,l,a,d]:null}var l,a,c,u,d,h=o(n,i,Math.ceil(n.length/4)),f=o(n,i,Math.ceil(n.length/2));if(!h&&!f)return null;l=f?h&&h[4].length>f[4].length?h:f:h;e.length>t.length?(a=l[0],c=l[1],u=l[2],d=l[3]):(u=l[0],d=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,d,p]}(i,o);if(d){var h=d[0],f=d[1],p=d[2],m=d[3],g=d[4],v=t(h,p),b=t(f,m);return v.concat([[0,g]],b)}return function(t,r){for(var i=t.length,s=r.length,o=Math.ceil((i+s)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),d=0;d<a;d++)c[d]=-1,u[d]=-1;c[l+1]=0,u[l+1]=0;for(var h=i-s,f=h%2!=0,p=0,m=0,g=0,v=0,b=0;b<o;b++){for(var y=-b+p;y<=b-m;y+=2){for(var x=l+y,w=(S=y===-b||y!==b&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-y;S<i&&w<s&&t.charAt(S)===r.charAt(w);)S++,w++;if(c[x]=S,S>i)m+=2;else if(w>s)p+=2;else if(f){if((k=l+h-y)>=0&&k<a&&-1!==u[k])if(S>=(E=i-u[k]))return n(t,r,S,w)}}for(var N=-b+g;N<=b-v;N+=2){for(var E,k=l+N,A=(E=N===-b||N!==b&&u[k-1]<u[k+1]?u[k+1]:u[k-1]+1)-N;E<i&&A<s&&t.charAt(i-E-1)===r.charAt(s-A-1);)E++,A++;if(u[k]=E,E>i)v+=2;else if(A>s)g+=2;else if(!f){if((x=l+h-N)>=0&&x<a&&-1!==c[x]){var S;w=l+(S=c[x])-x;if(S>=(E=i-E))return n(t,r,S,w)}}}}return[[e,t],[1,r]]}(i,o)}(h=h.substring(0,h.length-y),f=f.substring(0,f.length-y));return x&&N.unshift([0,x]),w&&N.push([0,w]),d(N,v),m&&function(t){var n=!1,r=[],h=0,f=null,p=0,m=0,g=0,v=0,b=0;for(;p<t.length;)0==t[p][0]?(r[h++]=p,m=v,g=b,v=0,b=0,f=t[p][1]):(1==t[p][0]?v+=t[p][1].length:b+=t[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(v,b)&&(t.splice(r[h-1],0,[e,f]),t[r[h-1]+1][0]=1,h--,p=--h>0?r[h-1]:-1,m=0,g=0,v=0,b=0,f=null,n=!0)),p++;n&&d(t);(function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(o),s=r.match(o),d=i&&n.match(l),h=s&&r.match(l),f=d&&n.match(a),p=h&&r.match(a),m=f&&e.match(c),g=p&&t.match(u);return m||g?5:f||p?4:i&&!d&&h?3:d||h?2:i||s?1:0}var n=1;for(;n<e.length-1;){if(0==e[n-1][0]&&0==e[n+1][0]){var r=e[n-1][1],i=e[n][1],d=e[n+1][1],h=s(r,i);if(h){var f=i.substring(i.length-h);r=r.substring(0,r.length-h),i=f+i.substring(0,i.length-h),d=f+d}for(var p=r,m=i,g=d,v=t(r,i)+t(i,d);i.charAt(0)===d.charAt(0);){r+=i.charAt(0),i=i.substring(1)+d.charAt(0),d=d.substring(1);var b=t(r,i)+t(i,d);b>=v&&(v=b,p=r,m=i,g=d)}e[n-1][1]!=p&&(p?e[n-1][1]=p:(e.splice(n-1,1),n--),e[n][1]=m,g?e[n+1][1]=g:(e.splice(n+1,1),n--))}n++}})(t),p=1;for(;p<t.length;){if(t[p-1][0]==e&&1==t[p][0]){var y=t[p-1][1],x=t[p][1],w=i(y,x),N=i(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(t.splice(p,0,[0,x.substring(0,w)]),t[p-1][1]=y.substring(0,y.length-w),t[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(t.splice(p,0,[0,y.substring(0,N)]),t[p-1][0]=1,t[p-1][1]=x.substring(0,x.length-N),t[p+1][0]=e,t[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(e,n,r,i){var s=e.substring(0,r),o=n.substring(0,i),l=e.substring(r),a=n.substring(i),c=t(s,o),u=t(l,a);return c.concat(u)}function r(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(s,i)==t.substring(s,i)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return h(e.charCodeAt(i-1))&&i--,i}function i(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var s=0,o=1;;){var l=e.substring(i-o),a=t.indexOf(l);if(-1==a)return s;o+=a,0!=a&&e.substring(i-o)!=t.substring(0,o)||(s=o,o++)}}function s(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(e.length-i,e.length-s)==t.substring(t.length-i,t.length-s)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return f(e.charCodeAt(e.length-i))&&i--,i}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,c=/\n\r?\n$/,u=/^\r?\n\r?\n/;function d(t,n){t.push([0,""]);for(var i,o=0,l=0,a=0,c="",u="";o<t.length;)if(o<t.length-1&&!t[o][1])t.splice(o,1);else switch(t[o][0]){case 1:a++,u+=t[o][1],o++;break;case e:l++,c+=t[o][1],o++;break;case 0:var h=o-a-l-1;if(n){if(h>=0&&m(t[h][1])){var f=t[h][1].slice(-1);if(t[h][1]=t[h][1].slice(0,-1),c=f+c,u=f+u,!t[h][1]){t.splice(h,1),o--;var g=h-1;t[g]&&1===t[g][0]&&(a++,u=t[g][1]+u,g--),t[g]&&t[g][0]===e&&(l++,c=t[g][1]+c,g--),h=g}}if(p(t[o][1])){f=t[o][1].charAt(0);t[o][1]=t[o][1].slice(1),c+=f,u+=f}}if(o<t.length-1&&!t[o][1]){t.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(i=r(u,c))&&(h>=0?t[h][1]+=u.substring(0,i):(t.splice(0,0,[0,u.substring(0,i)]),o++),u=u.substring(i),c=c.substring(i)),0!==(i=s(u,c))&&(t[o][1]=u.substring(u.length-i)+t[o][1],u=u.substring(0,u.length-i),c=c.substring(0,c.length-i)));var v=a+l;0===c.length&&0===u.length?(t.splice(o-v,v),o-=v):0===c.length?(t.splice(o-v,v,[1,u]),o=o-v+1):0===u.length?(t.splice(o-v,v,[e,c]),o=o-v+1):(t.splice(o-v,v,[e,c],[1,u]),o=o-v+2)}0!==o&&0===t[o-1][0]?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,l=0,c="",u=""}""===t[t.length-1][1]&&t.pop();var b=!1;for(o=1;o<t.length-1;)0===t[o-1][0]&&0===t[o+1][0]&&(t[o][1].substring(t[o][1].length-t[o-1][1].length)===t[o-1][1]?(t[o][1]=t[o-1][1]+t[o][1].substring(0,t[o][1].length-t[o-1][1].length),t[o+1][1]=t[o-1][1]+t[o+1][1],t.splice(o-1,1),b=!0):t[o][1].substring(0,t[o+1][1].length)==t[o+1][1]&&(t[o-1][1]+=t[o+1][1],t[o][1]=t[o][1].substring(t[o+1][1].length)+t[o+1][1],t.splice(o+1,1),b=!0)),o++;b&&d(t,n)}function h(e){return e>=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function p(e){return f(e.charCodeAt(0))}function m(e){return h(e.charCodeAt(e.length-1))}function g(t,n,r,i){return m(t)||p(i)?null:function(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}([[0,t],[e,n],[1,r],[0,i]])}function v(e,n,r,i){return t(e,n,r,i,!0)}return v.INSERT=1,v.DELETE=e,v.EQUAL=0,Ti=v}var Mi,Bi={exports:{}};function Di(){return Mi||(Mi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Boolean]",o="[object Date]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",u="[object Number]",d="[object Object]",h="[object Promise]",f="[object RegExp]",p="[object Set]",m="[object String]",g="[object Symbol]",v="[object WeakMap]",b="[object ArrayBuffer]",y="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",N="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",A="[object Uint8Array]",S="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",O=/\w*$/,q=/^\[object .+?Constructor\]$/,_=/^(?:0|[1-9]\d*)$/,T={};T[i]=T["[object Array]"]=T[b]=T[y]=T[s]=T[o]=T[x]=T[w]=T[N]=T[E]=T[k]=T[c]=T[u]=T[d]=T[f]=T[p]=T[m]=T[g]=T[A]=T[S]=T[C]=T[j]=!0,T["[object Error]"]=T[l]=T[v]=!1;var L="object"==typeof K&&K&&K.Object===Object&&K,I="object"==typeof self&&self&&self.Object===Object&&self,R=L||I||Function("return this")(),M=t&&!t.nodeType&&t,B=M&&e&&!e.nodeType&&e,D=B&&B.exports===M;function P(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function U(e,t,n,r){for(var i=-1,s=e?e.length:0;++i<s;)n=t(n,e[i],i,e);return n}function $(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function z(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function V(e,t){return function(n){return e(t(n))}}function H(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var W=Array.prototype,Z=Function.prototype,G=Object.prototype,Y=R["__core-js_shared__"],J=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),X=Z.toString,Q=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=D?R.Buffer:void 0,re=R.Symbol,ie=R.Uint8Array,se=V(Object.getPrototypeOf,Object),oe=Object.create,le=G.propertyIsEnumerable,ae=W.splice,ce=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,de=V(Object.keys,Object),he=Be(R,"DataView"),fe=Be(R,"Map"),pe=Be(R,"Promise"),me=Be(R,"Set"),ge=Be(R,"WeakMap"),ve=Be(Object,"create"),be=$e(he),ye=$e(fe),xe=$e(pe),we=$e(me),Ne=$e(ge),Ee=re?re.prototype:void 0,ke=Ee?Ee.valueOf:void 0;function Ae(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new Se(e)}function Oe(e,t){var n=Ve(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&He(e)}(e)&&Q.call(e,"callee")&&(!le.call(e,"callee")||ee.call(e)==i)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,s=!!r;for(var o in e)!Q.call(e,o)||s&&("length"==o||Fe(o,r))||n.push(o);return n}function qe(e,t,n){var r=e[t];Q.call(e,t)&&ze(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function _e(e,t){for(var n=e.length;n--;)if(ze(e[n][0],t))return n;return-1}function Te(e,t,n,r,h,v,q){var _;if(r&&(_=v?r(e,h,v,q):r(e)),void 0!==_)return _;if(!Ze(e))return e;var L=Ve(e);if(L){if(_=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,_)}else{var I=Pe(e),R=I==l||I==a;if(Ke(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(I==d||I==i||R&&!v){if($(e))return v?e:{};if(_=function(e){return"function"!=typeof e.constructor||Ue(e)?{}:(t=se(e),Ze(t)?oe(t):{});var t}(R?{}:e),!t)return function(e,t){return Re(e,De(e),t)}(e,function(e,t){return e&&Re(t,Ge(t),e)}(_,e))}else{if(!T[I])return v?e:{};_=function(e,t,n,r){var i=e.constructor;switch(t){case b:return Ie(e);case s:case o:return new i(+e);case y:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case x:case w:case N:case E:case k:case A:case S:case C:case j:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(z(e),!0):z(e);return U(r,P,new e.constructor)}(e,r,n);case u:case m:return new i(e);case f:return function(e){var t=new e.constructor(e.source,O.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(H(e),!0):H(e);return U(r,F,new e.constructor)}(e,r,n);case g:return l=e,ke?Object(ke.call(l)):{}}var l}(e,I,Te,t)}}q||(q=new je);var M=q.get(e);if(M)return M;if(q.set(e,_),!L)var B=n?function(e){return function(e,t,n){var r=t(e);return Ve(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,Ge,De)}(e):Ge(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(B||e,function(i,s){B&&(i=e[s=i]),qe(_,s,Te(i,t,n,r,s,e,q))}),_}function Le(e){return!(!Ze(e)||function(e){return!!J&&J in e}(e))&&(We(e)||$(e)?te:q).test($e(e))}function Ie(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Re(e,t,n,r){n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i];qe(n,o,e[o])}return n}function Me(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Be(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}Ae.prototype.clear=function(){this.__data__=ve?ve(null):{}},Ae.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ae.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Ae.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Q.call(t,e)},Ae.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?n:t,this},Se.prototype.clear=function(){this.__data__=[]},Se.prototype.delete=function(e){var t=this.__data__,n=_e(t,e);return!(n<0)&&(n==t.length-1?t.pop():ae.call(t,n,1),!0)},Se.prototype.get=function(e){var t=this.__data__,n=_e(t,e);return n<0?void 0:t[n][1]},Se.prototype.has=function(e){return _e(this.__data__,e)>-1},Se.prototype.set=function(e,t){var n=this.__data__,r=_e(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ce.prototype.clear=function(){this.__data__={hash:new Ae,map:new(fe||Se),string:new Ae}},Ce.prototype.delete=function(e){return Me(this,e).delete(e)},Ce.prototype.get=function(e){return Me(this,e).get(e)},Ce.prototype.has=function(e){return Me(this,e).has(e)},Ce.prototype.set=function(e,t){return Me(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new Se},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Se){var r=n.__data__;if(!fe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ce(r)}return n.set(e,t),this};var De=ce?V(ce,Object):function(){return[]},Pe=function(e){return ee.call(e)};function Fe(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||_.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function $e(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function ze(e,t){return e===t||e!=e&&t!=t}(he&&Pe(new he(new ArrayBuffer(1)))!=y||fe&&Pe(new fe)!=c||pe&&Pe(pe.resolve())!=h||me&&Pe(new me)!=p||ge&&Pe(new ge)!=v)&&(Pe=function(e){var t=ee.call(e),n=t==d?e.constructor:void 0,r=n?$e(n):void 0;if(r)switch(r){case be:return y;case ye:return c;case xe:return h;case we:return p;case Ne:return v}return t});var Ve=Array.isArray;function He(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!We(e)}var Ke=ue||function(){return!1};function We(e){var t=Ze(e)?ee.call(e):"";return t==l||t==a}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return He(e)?Oe(e):function(e){if(!Ue(e))return de(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Te(e,!0,!0)}}(Bi,Bi.exports)),Bi.exports}var Pi,Fi={exports:{}};function Ui(){return Pi||(Pi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",h="[object Object]",f="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",b="[object WeakMap]",y="[object ArrayBuffer]",x="[object DataView]",w=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[i]=E[s]=E[y]=E[o]=E[x]=E[l]=E[a]=E[c]=E[u]=E[d]=E[h]=E[p]=E[m]=E[g]=E[b]=!1;var k="object"==typeof K&&K&&K.Object===Object&&K,A="object"==typeof self&&self&&self.Object===Object&&self,S=k||A||Function("return this")(),C=t&&!t.nodeType&&t,j=C&&e&&!e.nodeType&&e,O=j&&j.exports===C,q=O&&k.process,_=function(){try{return q&&q.binding&&q.binding("util")}catch(e){}}(),T=_&&_.isTypedArray;function L(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function I(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function R(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,P=S["__core-js_shared__"],F=B.toString,U=D.hasOwnProperty,$=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),z=D.toString,V=RegExp("^"+F.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H=O?S.Buffer:void 0,W=S.Symbol,Z=S.Uint8Array,G=D.propertyIsEnumerable,Y=M.splice,J=W?W.toStringTag:void 0,X=Object.getOwnPropertySymbols,Q=H?H.isBuffer:void 0,ee=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),te=Oe(S,"DataView"),ne=Oe(S,"Map"),re=Oe(S,"Promise"),ie=Oe(S,"Set"),se=Oe(S,"WeakMap"),oe=Oe(Object,"create"),le=Le(te),ae=Le(ne),ce=Le(re),ue=Le(ie),de=Le(se),he=W?W.prototype:void 0,fe=he?he.valueOf:void 0;function pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ge;++t<n;)this.add(e[t])}function be(e){var t=this.__data__=new me(e);this.size=t.size}function ye(e,t){var n=Me(e),r=!n&&Re(e),i=!n&&!r&&Be(e),s=!n&&!r&&!i&&$e(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!U.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Te(c,a))||l.push(c);return l}function xe(e,t){for(var n=e.length;n--;)if(Ie(e[n][0],t))return n;return-1}function we(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?function(e){var t=U.call(e,J),n=e[J];try{e[J]=void 0;var r=!0}catch(s){}var i=z.call(e);r&&(t?e[J]=n:delete e[J]);return i}(e):function(e){return z.call(e)}(e)}function Ne(e){return Ue(e)&&we(e)==i}function Ee(e,t,n,r,c){return e===t||(null==e||null==t||!Ue(e)&&!Ue(t)?e!=e&&t!=t:function(e,t,n,r,c,f){var b=Me(e),w=Me(t),N=b?s:_e(e),E=w?s:_e(t),k=(N=N==i?h:N)==h,A=(E=E==i?h:E)==h,S=N==E;if(S&&Be(e)){if(!Be(t))return!1;b=!0,k=!1}if(S&&!k)return f||(f=new be),b||$e(e)?Se(e,t,n,r,c,f):function(e,t,n,r,i,s,c){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!s(new Z(e),new Z(t)));case o:case l:case d:return Ie(+e,+t);case a:return e.name==t.name&&e.message==t.message;case p:case g:return e==t+"";case u:var h=I;case m:var f=1&r;if(h||(h=R),e.size!=t.size&&!f)return!1;var b=c.get(e);if(b)return b==t;r|=2,c.set(e,t);var w=Se(h(e),h(t),r,i,s,c);return c.delete(e),w;case v:if(fe)return fe.call(e)==fe.call(t)}return!1}(e,t,N,n,r,c,f);if(!(1&n)){var C=k&&U.call(e,"__wrapped__"),j=A&&U.call(t,"__wrapped__");if(C||j){var O=C?e.value():e,q=j?t.value():t;return f||(f=new be),c(O,q,n,r,f)}}if(!S)return!1;return f||(f=new be),function(e,t,n,r,i,s){var o=1&n,l=Ce(e),a=l.length,c=Ce(t),u=c.length;if(a!=u&&!o)return!1;var d=a;for(;d--;){var h=l[d];if(!(o?h in t:U.call(t,h)))return!1}var f=s.get(e);if(f&&s.get(t))return f==t;var p=!0;s.set(e,t),s.set(t,e);var m=o;for(;++d<a;){var g=e[h=l[d]],v=t[h];if(r)var b=o?r(v,g,h,t,e,s):r(g,v,h,e,t,s);if(!(void 0===b?g===v||i(g,v,n,r,s):b)){p=!1;break}m||(m="constructor"==h)}if(p&&!m){var y=e.constructor,x=t.constructor;y==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,n,r,c,f)}(e,t,n,r,Ee,c))}function ke(e){return!(!Fe(e)||function(e){return!!$&&$ in e}(e))&&(De(e)?V:w).test(Le(e))}function Ae(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||D,t!==r)return ee(e);var t,n,r,i=[];for(var s in Object(e))U.call(e,s)&&"constructor"!=s&&i.push(s);return i}function Se(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var u=-1,d=!0,h=2&n?new ve:void 0;for(s.set(e,t),s.set(t,e);++u<l;){var f=e[u],p=t[u];if(r)var m=o?r(p,f,u,t,e,s):r(f,p,u,e,t,s);if(void 0!==m){if(m)continue;d=!1;break}if(h){if(!L(t,function(e,t){if(o=t,!h.has(o)&&(f===e||i(f,e,n,r,s)))return h.push(t);var o})){d=!1;break}}else if(f!==p&&!i(f,p,n,r,s)){d=!1;break}}return s.delete(e),s.delete(t),d}function Ce(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,ze,qe)}function je(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Oe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ke(n)?n:void 0}pe.prototype.clear=function(){this.__data__=oe?oe(null):{},this.size=0},pe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pe.prototype.get=function(e){var t=this.__data__;if(oe){var r=t[e];return r===n?void 0:r}return U.call(t,e)?t[e]:void 0},pe.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:U.call(t,e)},pe.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oe&&void 0===t?n:t,this},me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=xe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Y.call(t,n,1),--this.size,!0)},me.prototype.get=function(e){var t=this.__data__,n=xe(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return xe(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,r=xe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ge.prototype.clear=function(){this.size=0,this.__data__={hash:new pe,map:new(ne||me),string:new pe}},ge.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},ge.prototype.get=function(e){return je(this,e).get(e)},ge.prototype.has=function(e){return je(this,e).has(e)},ge.prototype.set=function(e,t){var n=je(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,n),this},ve.prototype.has=function(e){return this.__data__.has(e)},be.prototype.clear=function(){this.__data__=new me,this.size=0},be.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},be.prototype.get=function(e){return this.__data__.get(e)},be.prototype.has=function(e){return this.__data__.has(e)},be.prototype.set=function(e,t){var n=this.__data__;if(n instanceof me){var r=n.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ge(r)}return n.set(e,t),this.size=n.size,this};var qe=X?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(X(e),function(t){return G.call(e,t)}))}:function(){return[]},_e=we;function Te(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function Le(e){if(null!=e){try{return F.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ie(e,t){return e===t||e!=e&&t!=t}(te&&_e(new te(new ArrayBuffer(1)))!=x||ne&&_e(new ne)!=u||re&&_e(re.resolve())!=f||ie&&_e(new ie)!=m||se&&_e(new se)!=b)&&(_e=function(e){var t=we(e),n=t==h?e.constructor:void 0,r=n?Le(n):"";if(r)switch(r){case le:return x;case ae:return u;case ce:return f;case ue:return m;case de:return b}return t});var Re=Ne(function(){return arguments}())?Ne:function(e){return Ue(e)&&U.call(e,"callee")&&!G.call(e,"callee")},Me=Array.isArray;var Be=Q||function(){return!1};function De(e){if(!Fe(e))return!1;var t=we(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Fe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ue(e){return null!=e&&"object"==typeof e}var $e=T?function(e){return function(t){return e(t)}}(T):function(e){return Ue(e)&&Pe(e.length)&&!!E[we(e)]};function ze(e){return null!=(t=e)&&Pe(t.length)&&!De(t)?ye(e):Ae(e);var t}e.exports=function(e,t){return Ee(e,t)}}(Fi,Fi.exports)),Fi.exports}var $i,zi={};var Vi,Hi={};function Ki(){return Vi||(Vi=1,Object.defineProperty(Hi,"__esModule",{value:!0}),(e||(e={})).length=function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"object"==typeof e.retain&&null!==e.retain?1:"string"==typeof e.insert?e.insert.length:1},Hi.default=e),Hi;var e}var Wi,Zi,Gi={};var Yi=(Zi||(Zi=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const n=Ri(),r=Di(),i=Ui(),s=function(){if($i)return zi;$i=1,Object.defineProperty(zi,"__esModule",{value:!0});const e=Di(),t=Ui();var n,r;return(r=n||(n={})).compose=function(t={},n={},r=!1){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});let i=e(n);r||(i=Object.keys(i).reduce((e,t)=>(null!=i[t]&&(e[t]=i[t]),e),{}));for(const e in t)void 0!==t[e]&&void 0===n[e]&&(i[e]=t[e]);return Object.keys(i).length>0?i:void 0},r.diff=function(e={},n={}){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});const r=Object.keys(e).concat(Object.keys(n)).reduce((r,i)=>(t(e[i],n[i])||(r[i]=void 0===n[i]?null:n[i]),r),{});return Object.keys(r).length>0?r:void 0},r.invert=function(e={},t={}){e=e||{};const n=Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0!==e[r]&&(n[r]=t[r]),n),{});return Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0===t[r]&&(n[r]=null),n),n)},r.transform=function(e,t,n=!1){if("object"!=typeof e)return t;if("object"!=typeof t)return;if(!n)return t;const r=Object.keys(t).reduce((n,r)=>(void 0===e[r]&&(n[r]=t[r]),n),{});return Object.keys(r).length>0?r:void 0},zi.default=n,zi}();t.AttributeMap=s.default;const o=Ki();t.Op=o.default;const l=function(){if(Wi)return Gi;Wi=1,Object.defineProperty(Gi,"__esModule",{value:!0});const e=Ki();return Gi.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const n=this.ops[this.index];if(n){const r=this.offset,i=e.default.length(n);if(t>=i-r?(t=i-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof n.delete)return{delete:t};{const e={};return n.attributes&&(e.attributes=n.attributes),"number"==typeof n.retain?e.retain=t:"object"==typeof n.retain&&null!==n.retain?e.retain=n.retain:"string"==typeof n.insert?e.insert=n.insert.substr(r,t):e.insert=n.insert,e}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?e.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const e=this.ops[this.index];return e?"number"==typeof e.delete?"delete":"number"==typeof e.retain||"object"==typeof e.retain&&null!==e.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}return[]}},Gi}();t.OpIterator=l.default;const a=String.fromCharCode(0),c=(e,t)=>{if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);const n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]};class u{constructor(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){const t=this.handlers[e];if(!t)throw new Error(`no handlers for embed type "${e}"`);return t}insert(e,t){const n={};return"string"==typeof e&&0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if("number"==typeof e&&e<=0)return this;const n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=r(e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,n=this.ops[t-1],"object"!=typeof n))return this.ops.unshift(e),this;if(i(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){const e=this.ops[this.ops.length-1];return e&&"number"==typeof e.retain&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){const t=[],n=[];return this.forEach(r=>{(e(r)?t:n).push(r)}),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}changeLength(){return this.reduce((e,t)=>t.insert?e+o.default.length(t):t.delete?e-t.delete:e,0)}length(){return this.reduce((e,t)=>e+o.default.length(t),0)}slice(e=0,t=1/0){const n=[],r=new l.default(this.ops);let i=0;for(;i<t&&r.hasNext();){let s;i<e?s=r.next(e-i):(s=r.next(t-i),n.push(s)),i+=o.default.length(s)}return new u(n)}compose(e){const t=new l.default(this.ops),n=new l.default(e.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let e=o.retain;for(;"insert"===t.peekType()&&t.peekLength()<=e;)e-=t.peekLength(),r.push(t.next());o.retain-e>0&&n.next(o.retain-e)}const a=new u(r);for(;t.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===t.peekType())a.push(t.next());else{const e=Math.min(t.peekLength(),n.peekLength()),r=t.next(e),o=n.next(e);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?e:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const e=null==r.retain?"insert":"retain",[t,n,i]=c(r[e],o.retain),s=u.getHandler(t);l[e]={[t]:s.compose(n,i,"retain"===e)}}const d=s.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(d&&(l.attributes=d),a.push(l),!n.hasNext()&&i(a.ops[a.ops.length-1],l)){const e=new u(t.rest());return a.concat(e).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(e){const t=new u(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t}diff(e,t){if(this.ops===e.ops)return new u;const r=[this,e].map(t=>t.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],t,!0),d=new l.default(this.ops),h=new l.default(e.ops);return c.forEach(e=>{let t=e[1].length;for(;t>0;){let r=0;switch(e[0]){case n.INSERT:r=Math.min(h.peekLength(),t),o.push(h.next(r));break;case n.DELETE:r=Math.min(t,d.peekLength()),d.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(d.peekLength(),h.peekLength(),t);const e=d.next(r),l=h.next(r);i(e.insert,l.insert)?o.retain(r,s.default.diff(e.attributes,l.attributes)):o.push(l).delete(r)}t-=r}}),o.chop()}eachLine(e,t="\n"){const n=new l.default(this.ops);let r=new u,i=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const s=n.peek(),l=o.default.length(s)-n.peekLength(),a="string"==typeof s.insert?s.insert.indexOf(t,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===e(r,n.next(1).attributes||{},i))return;i+=1,r=new u}}r.length()>0&&e(r,{},i)}invert(e){const t=new u;return this.reduce((n,r)=>{if(r.insert)t.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return t.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const i=r.delete||r.retain;return e.slice(n,n+i).forEach(e=>{r.delete?t.push(e):r.retain&&r.attributes&&t.retain(o.default.length(e),s.default.invert(r.attributes,e.attributes))}),n+i}if("object"==typeof r.retain&&null!==r.retain){const i=e.slice(n,n+1),o=new l.default(i.ops).next(),[a,d,h]=c(r.retain,o.insert),f=u.getHandler(a);return t.retain({[a]:f.invert(d,h)},s.default.invert(r.attributes,o.attributes)),n+1}}return n},0),t.chop()}transform(e,t=!1){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);const n=e,r=new l.default(this.ops),i=new l.default(n.ops),a=new u;for(;r.hasNext()||i.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===i.peekType())if("insert"===i.peekType())a.push(i.next());else{const e=Math.min(r.peekLength(),i.peekLength()),n=r.next(e),o=i.next(e);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,i=o.retain;let l="object"==typeof i&&null!==i?i:e;if("object"==typeof r&&null!==r&&"object"==typeof i&&null!==i){const e=Object.keys(r)[0];if(e===Object.keys(i)[0]){const n=u.getHandler(e);n&&(l={[e]:n.transform(r[e],i[e],t)})}}a.retain(l,s.default.transform(n.attributes,o.attributes,t))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(e,t=!1){t=!!t;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=e;){const i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(r<e||!t)&&(e+=i),r+=i):e-=Math.min(i,e-r)}return e}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=s.default,u.handlers={},t.default=u,e.exports=u,e.exports.default=u}(Ii,Ii.exports)),Ii.exports);const Ji=W(Yi);class Xi extends Ai{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}Xi.blotName="break",Xi.tagName="BR";let Qi=class extends qi{};const es={"&":"&","<":"<",">":">",'"':""","'":"'"};function ts(e){return e.replace(/[&<>"']/g,e=>es[e])}const ns=class e extends xi{static compare(t,n){const r=e.order.indexOf(t),i=e.order.indexOf(n);return r>=0||i>=0?r-i:t===n?0:t<n?-1:1}formatAt(t,n,r,i){if(e.compare(this.statics.blotName,r)<0&&this.scroll.query(r,ti.BLOT)){const e=this.isolate(t,n);i&&e.wrap(r,i)}else super.formatAt(t,n,r,i)}optimize(t){if(super.optimize(t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};t(ns,"allowedChildren",[ns,Xi,Ai,Qi]),t(ns,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let rs=ns;class is extends Ni{constructor(){super(...arguments),t(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=os(this)),this.cache.delta}deleteAt(e,t){super.deleteAt(e,t),this.cache={}}formatAt(e,t,n,r){t<=0||(this.scroll.query(n,ti.BLOCK)?e+t===this.length()&&this.format(n,r):super.formatAt(e,Math.min(t,this.length()-e-1),n,r),this.cache={})}insertAt(e,t,n){if(null!=n)return super.insertAt(e,t,n),void(this.cache={});if(0===t.length)return;const r=t.split("\n"),i=r.shift();i.length>0&&(e<this.length()-1||null==this.children.tail?super.insertAt(Math.min(e,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});let s=this;r.reduce((e,t)=>(s=s.split(e,!0),s.insertAt(0,t),t.length),e+i.length)}insertBefore(e,t){const{head:n}=this.children;super.insertBefore(e,t),n instanceof Xi&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(e,t){super.moveChildren(e,t),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 t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t&&(0===e||e>=this.length()-1)){const t=this.clone();return 0===e?(this.parent.insertBefore(t,this),this):(this.parent.insertBefore(t,this.next),t)}const n=super.split(e,t);return this.cache={},n}}is.blotName="block",is.tagName="P",is.defaultChild=Xi,is.allowedChildren=[Xi,rs,Ai,Qi];class ss extends Ai{attach(){super.attach(),this.attributes=new ui(this.domNode)}delta(){return(new Ji).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(e,t){const n=this.scroll.query(e,ti.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}formatAt(e,t,n,r){this.format(n,r)}insertAt(e,t,n){if(null!=n)return void super.insertAt(e,t,n);const r=t.split("\n"),i=r.pop(),s=r.map(e=>{const t=this.scroll.create(is.blotName);return t.insertAt(0,e),t}),o=this.split(e);s.forEach(e=>{this.parent.insertBefore(e,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}}function os(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.descendants(pi).reduce((e,n)=>0===n.length()?e:e.insert(n.value(),ls(n,{},t)),new Ji).insert("\n",ls(e))}function ls(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==e?t:("formats"in e&&"function"==typeof e.formats&&(t={...t,...e.formats()},n&&delete t["code-token"]),null==e.parent||"scroll"===e.parent.statics.blotName||e.parent.statics.scope!==e.statics.scope?t:ls(e.parent,t,n))}ss.scope=ti.BLOCK_BLOT;const as=class e extends Ai{static value(){}constructor(t,n,r){super(t,n),this.selection=r,this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,n){if(0!==this.savedLength)return void super.format(t,n);let r=this,i=0;for(;null!=r&&r.statics.scope!==ti.BLOCK_BLOT;)i+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=e.CONTENTS.length,r.optimize(),r.formatAt(i,e.CONTENTS.length,t,n),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const n=this.prev instanceof Qi?this.prev:null,r=n?n.length():0,i=this.next instanceof Qi?this.next:null,s=i?i.text:"",{textNode:o}=this,l=o.data.split(e.CONTENTS).join("");let a;if(o.data=e.CONTENTS,n)a=n,(l||i)&&(n.insertAt(n.length(),l+s),i&&i.remove());else if(i)a=i,i.insertAt(0,l);else{const e=document.createTextNode(l);a=this.scroll.create(e),this.parent.insertBefore(a,this)}if(this.remove(),t){const e=(e,t)=>n&&e===n.domNode?t:e===o?r+t-1:i&&e===i.domNode?r+l.length+t:null,s=e(t.start.node,t.start.offset),c=e(t.end.node,t.end.offset);if(null!==s&&null!==c)return{startNode:a.domNode,startOffset:s,endNode:a.domNode,endOffset:c}}return null}update(e,t){if(e.some(e=>"characterData"===e.type&&e.target===this.textNode)){const e=this.restore();e&&(t.range=e)}}optimize(t){super.optimize(t);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=e.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};t(as,"blotName","cursor"),t(as,"className","ql-cursor"),t(as,"tagName","span"),t(as,"CONTENTS","\ufeff");let cs=as;var us,ds={exports:{}};var hs=(us||(us=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new i(r,s||e,o),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],l]:e._events[a].push(l):(e._events[a]=l,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i<s;i++)o[i]=r[i].fn;return o},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,i,s,o){var l=n?n+e:e;if(!this._events[l])return!1;var a,c,u=this._events[l],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,s),!0;case 6:return u.fn.call(u.context,t,r,i,s,o),!0}for(c=1,a=new Array(d-1);c<d;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,i);break;default:if(!a)for(h=1,a=new Array(d-1);h<d;h++)a[h-1]=arguments[h];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var l=this._events[s];if(l.fn)l.fn!==t||i&&!l.once||r&&l.context!==r||o(this,s);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==t||i&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}(ds)),ds.exports);const fs=W(hs),ps=new WeakMap,ms=["error","warn","log","info"];let gs="warn";function vs(e){if(gs&&ms.indexOf(e)<=ms.indexOf(gs))for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r]}function bs(e){return ms.reduce((t,n)=>(t[n]=vs.bind(console,n,e),t),{})}bs.level=e=>{gs=e},vs.level=bs.level;const ys=bs("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(e=>{document.addEventListener(e,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(e=>{const n=ps.get(e);n&&n.emitter&&n.emitter.handleDOM(...t)})})});class xs extends fs{constructor(){super(),this.domListeners={},this.on("error",ys.error)}emit(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ys.log.call(ys,...t),super.emit(...t)}handleDOM(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.domListeners[e.type]||[]).forEach(t=>{let{node:r,handler:i}=t;(e.target===r||r.contains(e.target))&&i(e,...n)})}listenDOM(e,t,n){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:n})}}t(xs,"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"}),t(xs,"sources",{API:"api",SILENT:"silent",USER:"user"});const ws=bs("quill:selection");class Ns{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=e,this.length=t}}class Es{constructor(e,t){this.emitter=t,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new Ns(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,xs.sources.USER),1)}),this.emitter.on(xs.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const e=this.getNativeRange();null!=e&&e.start.node!==this.cursor.textNode&&this.emitter.once(xs.events.SCROLL_UPDATE,(t,n)=>{try{this.root.contains(e.start.node)&&this.root.contains(e.end.node)&&this.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset);const r=n.some(e=>"characterData"===e.type||"childList"===e.type||"attributes"===e.type&&e.target===this.root);this.update(r?xs.sources.SILENT:t)}catch(r){}})}),this.emitter.on(xs.events.SCROLL_OPTIMIZE,(e,t)=>{if(t.range){const{startNode:e,startOffset:n,endNode:r,endOffset:i}=t.range;this.setNativeRange(e,n,r,i),this.update(xs.sources.SILENT)}}),this.update(xs.sources.SILENT)}handleComposition(){this.emitter.on(xs.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(xs.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const e=this.cursor.restore();if(!e)return;setTimeout(()=>{this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(xs.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(e,t){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(e,ti.BLOCK)){if(n.start.node!==this.cursor.textNode){const e=this.scroll.find(n.start.node,!1);if(null==e)return;if(e instanceof pi){const t=e.split(n.start.offset);e.parent.insertBefore(this.cursor,t)}else e.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;e=Math.min(e,n-1),t=Math.min(e+t,n-1)-e;let[i,s]=this.scroll.leaf(e);if(null==i)return null;if(t>0&&s===i.length()){const[t]=this.scroll.leaf(e+1);if(t){const[n]=this.scroll.line(e),[r]=this.scroll.line(e+1);n===r&&(i=t,s=0)}}[r,s]=i.position(s,!0);const o=document.createRange();if(t>0)return o.setStart(r,s),[i,s]=this.scroll.leaf(e+t),null==i?null:([r,s]=i.position(s,!0),o.setEnd(r,s),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;s<r.data.length?(o.setStart(r,s),o.setEnd(r,s+1)):(o.setStart(r,s-1),o.setEnd(r,s),a="right"),l=o.getBoundingClientRect()}else{if(!(i.domNode instanceof Element))return null;l=i.domNode.getBoundingClientRect(),s>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const e=document.getSelection();if(null==e||e.rangeCount<=0)return null;const t=e.getRangeAt(0);if(null==t)return null;const n=this.normalizeNative(t);return ws.info("getNativeRange",n),n}getRange(){const e=this.scroll.domNode;if("isConnected"in e&&!e.isConnected)return[null,null];const t=this.getNativeRange();if(null==t)return[null,null];return[this.normalizedToRange(t),t]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&ks(this.root,document.activeElement)}normalizedToRange(e){const t=[[e.start.node,e.start.offset]];e.native.collapsed||t.push([e.end.node,e.end.offset]);const n=t.map(e=>{const[t,n]=e,r=this.scroll.find(t,!0),i=r.offset(this.scroll);return 0===n?i:r instanceof pi?i+r.index(t,n):i+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),i=Math.min(r,...n);return new Ns(i,r-i)}normalizeNative(e){if(!ks(this.root,e.startContainer)||!e.collapsed&&!ks(this.root,e.endContainer))return null;const t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(e=>{let{node:t,offset:n}=e;for(;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else{if(t.childNodes.length!==n)break;t=t.lastChild,n=t instanceof Text?t.data.length:t.childNodes.length>0?t.childNodes.length:t.childNodes.length+1}e.node=t,e.offset=n}),t}rangeToNative(e){const t=this.scroll.length(),n=(e,n)=>{e=Math.min(t-1,e);const[r,i]=this.scroll.leaf(e);return r?r.position(i,n):[null,-1]};return[...n(e.index,!1),...n(e.index+e.length,!0)]}setNativeRange(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(ws.info("setNativeRange",e,t,n,r),null!=e&&(null==this.root.parentNode||null==e.parentNode||null==n.parentNode))return;const s=document.getSelection();if(null!=s)if(null!=e){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e instanceof Element&&"BR"===e.tagName&&(t=Array.from(e.parentNode.childNodes).indexOf(e),e=e.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const i=document.createRange();i.setStart(e,t),i.setEnd(n,r),s.removeAllRanges(),s.addRange(i)}}else s.removeAllRanges(),this.root.blur()}setRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xs.sources.API;if("string"==typeof t&&(n=t,t=!1),ws.info("setRange",e),null!=e){const n=this.rangeToNative(e);this.setNativeRange(...n,t)}else this.setNativeRange(null);this.update(n)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xs.sources.USER;const t=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Xr(t,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const e=this.cursor.restore();e&&this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}const n=[xs.events.SELECTION_CHANGE,_r(this.lastRange),_r(t),e];this.emitter.emit(xs.events.EDITOR_CHANGE,...n),e!==xs.sources.SILENT&&this.emitter.emit(...n)}}}function ks(e,t){try{t.parentNode}catch(n){return!1}return e.contains(t)}const As=/^[ -~]*$/;class Ss{constructor(e){this.scroll=e,this.delta=this.getDelta()}applyDelta(e){this.scroll.update();let t=this.scroll.length();this.scroll.batchStart();const n=_s(e),r=new Ji;return function(e){const t=[];return e.forEach(e=>{if("string"==typeof e.insert){e.insert.split("\n").forEach((n,r)=>{r&&t.push({insert:"\n",attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})})}else t.push(e)}),t}(n.ops.slice()).reduce((e,n)=>{const i=Yi.Op.length(n);let s=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(i),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(t<=e||!!this.scroll.descendant(ss,e)[0]),this.scroll.insertAt(e,r);const[i,o]=this.scroll.line(e);let a=ei({},ls(i));if(i instanceof is){const[e]=i.descendant(pi,o);e&&(a=ei(a,ls(e)))}s=Yi.AttributeMap.diff(a,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;const i=null!=this.scroll.query(r,ti.INLINE);if(i)(t<=e||this.scroll.descendant(ss,e)[0])&&(l=!0);else if(e>0){const[t,n]=this.scroll.descendant(pi,e-1);if(t instanceof Qi){"\n"!==t.value()[n]&&(o=!0)}else t instanceof Ai&&t.statics.scope===ti.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),i){const[t]=this.scroll.descendant(pi,e);if(t){const e=ei({},ls(t));s=Yi.AttributeMap.diff(e,s)||{}}}}t+=i}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const t=Object.keys(n.retain)[0];if(null==t)return e;this.scroll.updateEmbedAt(e,t,n.retain[t])}Object.keys(s).forEach(t=>{this.scroll.formatAt(e,i,t,s[t])});const a=o?1:0,c=l?1:0;return t+=a+c,r.retain(a),r.delete(c),e+i+a+c},0),r.reduce((e,t)=>"number"==typeof t.delete?(this.scroll.deleteAt(e,t.delete),e):e+Yi.Op.length(t),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(e,t){return this.scroll.deleteAt(e,t),this.update((new Ji).retain(e).delete(t))}formatLine(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(e,Math.max(t,1)).forEach(e=>{e.format(r,n[r])})}),this.scroll.optimize();const r=(new Ji).retain(e).retain(t,_r(n));return this.update(r)}formatText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t,r,n[r])});const r=(new Ji).retain(e).retain(t,_r(n));return this.update(r)}getContents(e,t){return this.delta.slice(e,e+t)}getDelta(){return this.scroll.lines().reduce((e,t)=>e.concat(t.delta()),new Ji)}getFormat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(e=>{const[t]=e;t instanceof is?n.push(t):t instanceof pi&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(pi,e,t));const[i,s]=[n,r].map(e=>{const t=e.shift();if(null==t)return{};let n=ls(t);for(;Object.keys(n).length>0;){const t=e.shift();if(null==t)return n;n=Os(ls(t),n)}return n});return{...i,...s}}getHTML(e,t){const[n,r]=this.scroll.line(e);if(n){const i=n.length();return!(n.length()>=r+t)||0===r&&t===i?js(this.scroll,e,t,!0):js(n,r,t,!0)}return""}getText(e,t){return this.getContents(e,t).filter(e=>"string"==typeof e.insert).map(e=>e.insert).join("")}insertContents(e,t){const n=_s(t),r=(new Ji).retain(e).concat(n);return this.scroll.insertContents(e,n),this.update(r)}insertEmbed(e,t,n){return this.scroll.insertAt(e,t,n),this.update((new Ji).retain(e).insert({[t]:n}))}insertText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t.length,r,n[r])}),this.update((new Ji).retain(e).insert(t,_r(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const e=this.scroll.children.head;if((null==e?void 0:e.statics.blotName)!==is.blotName)return!1;const t=e;return!(t.children.length>1)&&t.children.head instanceof Xi}removeFormat(e,t){const n=this.getText(e,t),[r,i]=this.scroll.line(e+t);let s=0,o=new Ji;null!=r&&(s=r.length()-i,o=r.delta().slice(i,i+s-1).insert("\n"));const l=this.getContents(e,t+s).diff((new Ji).insert(n).concat(o)),a=(new Ji).retain(e).concat(l);return this.applyDelta(a)}update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(As)&&this.scroll.find(t[0].target)){const i=this.scroll.find(t[0].target),s=ls(i),o=i.offset(this.scroll),l=t[0].oldValue.replace(cs.CONTENTS,""),a=(new Ji).insert(l),c=(new Ji).insert(i.value()),u=n&&{oldRange:Ts(n.oldRange,-o),newRange:Ts(n.newRange,-o)};e=(new Ji).retain(o).concat(a.diff(c,u)).reduce((e,t)=>t.insert?e.insert(t.insert,s):e.push(t),new Ji),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&Xr(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}function Cs(e,t,n){if(0===e.length){const[e]=qs(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${Cs([],t-1,n)}`}const[{child:r,offset:i,length:s,indent:o,type:l},...a]=e,[c,u]=qs(l);if(o>t)return n.push(l),o===t+1?`<${c}><li${u}>${js(r,i,s)}${Cs(a,o,n)}`:`<${c}><li>${Cs(e,t+1,n)}`;const d=n[n.length-1];if(o===t&&l===d)return`</li><li${u}>${js(r,i,s)}${Cs(a,o,n)}`;const[h]=qs(n.pop());return`</li></${h}>${Cs(e,t-1,n)}`}function js(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in e&&"function"==typeof e.html)return e.html(t,n);if(e instanceof Qi){return ts(e.value().slice(t,t+n)).replaceAll(" "," ")}if(e instanceof bi){if("list-container"===e.statics.blotName){const r=[];return e.children.forEachAt(t,n,(e,t,n)=>{const i="formats"in e&&"function"==typeof e.formats?e.formats():{};r.push({child:e,offset:t,length:n,indent:i.indent||0,type:i.list})}),Cs(r,-1,[])}const i=[];if(e.children.forEachAt(t,n,(e,t,n)=>{i.push(js(e,t,n))}),r||"list"===e.statics.blotName)return i.join("");const{outerHTML:s,innerHTML:o}=e.domNode,[l,a]=s.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${i.join("")}<${a}`:`${l}>${i.join("")}<${a}`}return e.domNode instanceof Element?e.domNode.outerHTML:""}function Os(e,t){return Object.keys(t).reduce((n,r)=>{if(null==e[r])return n;const i=t[r];return i===e[r]?n[r]=i:Array.isArray(i)?i.indexOf(e[r])<0?n[r]=i.concat([e[r]]):n[r]=i:n[r]=[i,e[r]],n},{})}function qs(e){const t="ordered"===e?"ol":"ul";switch(e){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function _s(e){return e.reduce((e,t)=>{if("string"==typeof t.insert){const n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new Ji)}function Ts(e,t){let{index:n,length:r}=e;return new Ns(n+t,r)}class Ls{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=e,this.options=t}}t(Ls,"DEFAULTS",{});const Is="\ufeff";class Rs extends Ai{constructor(e,t){super(e,t),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(e=>{this.contentNode.appendChild(e)}),this.leftGuard=document.createTextNode(Is),this.rightGuard=document.createTextNode(Is),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(e,t){return e===this.leftGuard?0:e===this.rightGuard?1:super.index(e,t)}restore(e){let t,n=null;const r=e.data.split(Is).join("");if(e===this.leftGuard)if(this.prev instanceof Qi){const e=this.prev.length();this.prev.insertAt(e,r),n={startNode:this.prev.domNode,startOffset:e+r.length}}else t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this),n={startNode:t,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof Qi?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this.next),n={startNode:t,startOffset:r.length}));return e.data=Is,n}update(e,t){e.forEach(e=>{if("characterData"===e.type&&(e.target===this.leftGuard||e.target===this.rightGuard)){const n=this.restore(e.target);n&&(t.range=n)}})}}class Ms{constructor(e,n){t(this,"isComposing",!1),this.scroll=e,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",e=>{this.isComposing||this.handleCompositionStart(e)}),this.scroll.domNode.addEventListener("compositionend",e=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(e)})})}handleCompositionStart(e){const t=e.target instanceof Node?this.scroll.find(e.target,!0):null;!t||t instanceof Rs||(this.emitter.emit(xs.events.COMPOSITION_BEFORE_START,e),this.scroll.batchStart(),this.emitter.emit(xs.events.COMPOSITION_START,e),this.isComposing=!0)}handleCompositionEnd(e){this.emitter.emit(xs.events.COMPOSITION_BEFORE_END,e),this.scroll.batchEnd(),this.emitter.emit(xs.events.COMPOSITION_END,e),this.isComposing=!1}}const Bs=class{constructor(e,n){t(this,"modules",{}),this.quill=e,this.options=n}init(){Object.keys(this.options.modules).forEach(e=>{null==this.modules[e]&&this.addModule(e)})}addModule(e){const t=this.quill.constructor.import(`modules/${e}`);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}};t(Bs,"DEFAULTS",{modules:{}}),t(Bs,"themes",{default:Bs});let Ds=Bs;const Ps=e=>e.parentElement||e.getRootNode().host||null,Fs=e=>{const t=e.getBoundingClientRect(),n="offsetWidth"in e&&Math.abs(t.width)/e.offsetWidth||1,r="offsetHeight"in e&&Math.abs(t.height)/e.offsetHeight||1;return{top:t.top,right:t.left+e.clientWidth*n,bottom:t.top+e.clientHeight*r,left:t.left}},Us=e=>{const t=parseInt(e,10);return Number.isNaN(t)?0:t},$s=(e,t,n,r,i,s)=>e<n&&t>r?0:e<n?-(n-e+i):t>r?t-e>r-n?e+i-n:t-r+s:0,zs=["block","break","cursor","inline","scroll","text"],Vs=bs("quill"),Hs=new si;bi.uiClass="ql-ui";const Ks=class e{static debug(e){!0===e&&(e="log"),bs.level(e)}static find(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ps.get(e)||Hs.find(e,t)}static import(e){return null==this.imports[e]&&Vs.error(`Cannot import ${e}. Are you sure it was registered?`),this.imports[e]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const e=arguments.length<=0?void 0:arguments[0],t=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in e?e.attrName:e.blotName;"string"==typeof n?this.register(`formats/${n}`,e,t):Object.keys(e).forEach(n=>{this.register(n,e[n],t)})}else{const e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[e]||n||Vs.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&t&&"boolean"!=typeof t&&"abstract"!==t.blotName&&Hs.register(t),"function"==typeof t.register&&t.register(Hs)}}constructor(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(e,t){const n=Zs(e);if(!n)throw new Error("Invalid Quill container");const r=!t.theme||t.theme===Ws.DEFAULTS.theme,i=r?Ds:Ws.import(`themes/${t.theme}`);if(!i)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:s,...o}=Ws.DEFAULTS,{modules:l,...a}=i.DEFAULTS;let c=Gs(t.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=ei({},Gs(s),Gs(l),c),d={...o,...Ys(a),...Ys(t)};let h=t.registry;h?t.formats&&Vs.warn('Ignoring "formats" option because "registry" is specified'):h=t.formats?((e,t,n)=>{const r=new si;return zs.forEach(e=>{const n=t.query(e);n&&r.register(n)}),e.forEach(e=>{let i=t.query(e);i||n.error(`Cannot register "${e}" specified in "formats" config. Are you sure it was registered?`);let s=0;for(;i;)if(r.register(i),i="blotName"in i?i.requiredContainer??null:null,s+=1,s>100){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r})(t.formats,d.registry,Vs):d.registry;return{...d,registry:h,container:n,theme:i,modules:Object.entries(u).reduce((e,t)=>{let[n,r]=t;if(!r)return e;const i=Ws.import(`modules/${n}`);return null==i?(Vs.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:ei({},i.DEFAULTS||{},r)}},{}),bounds:Zs(d.bounds)}}(t,n),this.container=this.options.container,null==this.container)return void Vs.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",ps.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new xs;const i=ji.blotName,s=this.options.registry.query(i);if(!s||!("blotName"in s))throw new Error(`Cannot initialize Quill without "${i}" blot`);if(this.scroll=new s(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new Ss(this.scroll),this.selection=new Es(this.scroll,this.emitter),this.composition=new Ms(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(xs.events.EDITOR_CHANGE,e=>{e===xs.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(xs.events.SCROLL_UPDATE,(e,t)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;Js.call(this,()=>this.editor.update(null,t,i),e)}),this.emitter.on(xs.events.SCROLL_EMBED_UPDATE,(t,n)=>{const r=this.selection.lastRange,[i]=this.selection.getRange(),s=r&&i?{oldRange:r,newRange:i}:void 0;Js.call(this,()=>{const e=(new Ji).retain(t.offset(this)).retain({[t.statics.blotName]:n});return this.editor.update(e,[],s)},e.sources.USER)}),r){const e=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(e)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){const t=e;(e=document.createElement("div")).classList.add(t)}return this.container.insertBefore(e,t),e}blur(){this.selection.setRange(null)}deleteText(e,t,n){return[e,t,,n]=Xs(e,t,n),Js.call(this,()=>this.editor.deleteText(e,t),n,e,-1*t)}disable(){this.enable(!1)}editReadOnly(e){this.allowReadOnlyEdits=!0;const t=e();return this.allowReadOnlyEdits=!1,t}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}focus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),e.preventScroll||this.scrollSelectionIntoView()}format(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xs.sources.API;return Js.call(this,()=>{const n=this.getSelection(!0);let r=new Ji;if(null==n)return r;if(this.scroll.query(e,ti.BLOCK))r=this.editor.formatLine(n.index,n.length,{[e]:t});else{if(0===n.length)return this.selection.format(e,t),r;r=this.editor.formatText(n.index,n.length,{[e]:t})}return this.setSelection(n,xs.sources.SILENT),r},n)}formatLine(e,t,n,r,i){let s;return[e,t,s,i]=Xs(e,t,n,r,i),Js.call(this,()=>this.editor.formatLine(e,t,s),i,e,0)}formatText(e,t,n,r,i){let s;return[e,t,s,i]=Xs(e,t,n,r,i),Js.call(this,()=>this.editor.formatText(e,t,s),i,e,0)}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length),!n)return null;const r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}getContents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e;return[e,t]=Xs(e,t),this.editor.getContents(e,t)}getFormat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}getIndex(e){return e.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(e){return this.scroll.leaf(e)}getLine(e){return this.scroll.line(e)}getLines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}getModule(e){return this.theme.modules[e]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Xs(e,t),this.editor.getHTML(e,t)}getText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Xs(e,t),this.editor.getText(e,t)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return Js.call(this,()=>this.editor.insertEmbed(t,n,r),i,t)}insertText(e,t,n,r,i){let s;return[e,,s,i]=Xs(e,0,n,r,i),Js.call(this,()=>this.editor.insertText(e,t,s),i,e,t.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(e,t,n){return[e,t,,n]=Xs(e,t,n),Js.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){((e,t)=>{var n,r,i;const s=e.ownerDocument;let o=t,l=e;for(;l;){const e=l===s.body,t=e?{top:0,right:(null==(n=window.visualViewport)?void 0:n.width)??s.documentElement.clientWidth,bottom:(null==(r=window.visualViewport)?void 0:r.height)??s.documentElement.clientHeight,left:0}:Fs(l),a=getComputedStyle(l),c=$s(o.left,o.right,t.left,t.right,Us(a.scrollPaddingLeft),Us(a.scrollPaddingRight)),u=$s(o.top,o.bottom,t.top,t.bottom,Us(a.scrollPaddingTop),Us(a.scrollPaddingBottom));if(c||u)if(e)null==(i=s.defaultView)||i.scrollBy(c,u);else{const{scrollLeft:e,scrollTop:t}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-e,r=l.scrollTop-t;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=e||"fixed"===a.position?null:Ps(l)}})(this.root,e)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const e=this.selection.lastRange,t=e&&this.selection.getBounds(e.index,e.length);t&&this.scrollRectIntoView(t)}setContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xs.sources.API;return Js.call(this,()=>{e=new Ji(e);const t=this.getLength(),n=this.editor.deleteText(0,t),r=this.editor.insertContents(0,e),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)},t)}setSelection(t,n,r){null==t?this.selection.setRange(null,n||e.sources.API):([t,n,,r]=Xs(t,n,r),this.selection.setRange(new Ns(Math.max(0,t),n),r),r!==xs.sources.SILENT&&this.scrollSelectionIntoView())}setText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xs.sources.API;const n=(new Ji).insert(e);return this.setContents(n,t)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xs.sources.USER;const t=this.scroll.update(e);return this.selection.update(e),t}updateContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xs.sources.API;return Js.call(this,()=>(e=new Ji(e),this.editor.applyDelta(e)),t,!0)}};t(Ks,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Hs,theme:"default"}),t(Ks,"events",xs.events),t(Ks,"sources",xs.sources),t(Ks,"version","2.0.3"),t(Ks,"imports",{delta:Ji,parchment:_i,"core/module":Ls,"core/theme":Ds});let Ws=Ks;function Zs(e){return"string"==typeof e?document.querySelector(e):e}function Gs(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:!0===r?{}:r}},{})}function Ys(e){return Object.fromEntries(Object.entries(e).filter(e=>void 0!==e[1]))}function Js(e,t,n,r){if(!this.isEnabled()&&t===xs.sources.USER&&!this.allowReadOnlyEdits)return new Ji;let i=null==n?null:this.getSelection();const s=this.editor.delta,o=e();if(null!=i&&(!0===n&&(n=i.index),null==r?i=Qs(i,o,t):0!==r&&(i=Qs(i,n,r,t)),this.setSelection(i,xs.sources.SILENT)),o.length()>0){const e=[xs.events.TEXT_CHANGE,o,s,t];this.emitter.emit(xs.events.EDITOR_CHANGE,...e),t!==xs.sources.SILENT&&this.emitter.emit(...e)}return o}function Xs(e,t,n,r,i){let s={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(i=r,r=n,n=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(i=r,r=n,n=t,t=0),"object"==typeof n?(s=n,i=r):"string"==typeof n&&(null!=r?s[n]=r:i=n),[e,t,s,i=i||xs.sources.API]}function Qs(e,t,n,r){const i="number"==typeof n?n:0;if(null==e)return null;let s,o;return t&&"function"==typeof t.transformPosition?[s,o]=[e.index,e.index+e.length].map(e=>t.transformPosition(e,r!==xs.sources.USER)):[s,o]=[e.index,e.index+e.length].map(e=>e<t||e===t&&r===xs.sources.USER?e:i>=0?e+i:Math.max(t,e+i)),new Ns(s,o-s)}class eo extends ki{}function to(e){return e instanceof is||e instanceof ss}function no(e){return"function"==typeof e.updateContent}class ro extends ji{constructor(e,t,n){let{emitter:r}=n;super(e,t),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",e=>this.handleDragStart(e))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const e=this.batch;this.batch=!1,this.update(e)}emitMount(e){this.emitter.emit(xs.events.SCROLL_BLOT_MOUNT,e)}emitUnmount(e){this.emitter.emit(xs.events.SCROLL_BLOT_UNMOUNT,e)}emitEmbedUpdate(e,t){this.emitter.emit(xs.events.SCROLL_EMBED_UPDATE,e,t)}deleteAt(e,t){const[n,r]=this.line(e),[i]=this.line(e+t);if(super.deleteAt(e,t),null!=i&&n!==i&&r>0){if(n instanceof ss||i instanceof ss)return void this.optimize();const e=i.children.head instanceof Xi?null:i.children.head;n.moveChildren(i,e),n.remove()}this.optimize()}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e?"true":"false")}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.optimize()}insertAt(e,t,n){if(e>=this.length())if(null==n||null==this.scroll.query(t,ti.BLOCK)){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e),null==n&&t.endsWith("\n")?e.insertAt(0,t.slice(0,-1),n):e.insertAt(0,t,n)}else{const e=this.scroll.create(t,n);this.appendChild(e)}else super.insertAt(e,t,n);this.optimize()}insertBefore(e,t){if(e.statics.scope===ti.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(e),super.insertBefore(n,t)}else super.insertBefore(e,t)}insertContents(e,t){const n=this.deltaToRenderBlocks(t.concat((new Ji).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const i=n.shift();if(i){const t="block"===i.type&&(0===i.delta.length()||!this.descendant(ss,e)[0]&&e<this.length()),n="block"===i.type?i.delta:(new Ji).insert({[i.key]:i.value});io(this,e,n);const r="block"===i.type?1:0,s=e+n.length()+r;t&&this.insertAt(s-1,"\n");const o=ls(this.line(e)[0]),l=Yi.AttributeMap.diff(o,i.attributes)||{};Object.keys(l).forEach(e=>{this.formatAt(s-1,1,e,l[e])}),e=s}let[s,o]=this.children.find(e);if(n.length&&(s&&(s=s.split(o),o=0),n.forEach(e=>{if("block"===e.type){io(this.createBlock(e.attributes,s||void 0),0,e.delta)}else{const t=this.create(e.key,e.value);this.insertBefore(t,s||void 0),Object.keys(e.attributes).forEach(n=>{t.format(n,e.attributes[n])})}})),"block"===r.type&&r.delta.length()){io(this,s?s.offset(s.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(e){const t=this.path(e).pop();if(!t)return[null,-1];const[n,r]=t;return n instanceof pi?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(to,e)}lines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(e,t,r)=>{let i=[],s=r;return e.children.forEachAt(t,r,(e,t,r)=>{to(e)?i.push(e):e instanceof ki&&(i=i.concat(n(e,t,s))),s-=r}),i};return n(this,e,t)}optimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(e,t),e.length>0&&this.emitter.emit(xs.events.SCROLL_OPTIMIZE,e,t))}path(e){return super.path(e).slice(1)}remove(){}update(e){if(this.batch)return void(Array.isArray(e)&&(this.batch=this.batch.concat(e)));let t=xs.sources.USER;"string"==typeof e&&(t=e),Array.isArray(e)||(e=this.observer.takeRecords()),(e=e.filter(e=>{let{target:t}=e;const n=this.find(t,!0);return n&&!no(n)})).length>0&&this.emitter.emit(xs.events.SCROLL_BEFORE_UPDATE,t,e),super.update(e.concat([])),e.length>0&&this.emitter.emit(xs.events.SCROLL_UPDATE,t,e)}updateEmbedAt(e,t,n){const[r]=this.descendant(e=>e instanceof ss,e);r&&r.statics.blotName===t&&no(r)&&r.updateContent(n)}handleDragStart(e){e.preventDefault()}deltaToRenderBlocks(e){const t=[];let n=new Ji;return e.forEach(e=>{const r=null==e?void 0:e.insert;if(r)if("string"==typeof r){const i=r.split("\n");i.slice(0,-1).forEach(r=>{n.insert(r,e.attributes),t.push({type:"block",delta:n,attributes:e.attributes??{}}),n=new Ji});const s=i[i.length-1];s&&n.insert(s,e.attributes)}else{const i=Object.keys(r)[0];if(!i)return;this.query(i,ti.INLINE)?n.push(e):(n.length()&&t.push({type:"block",delta:n,attributes:{}}),n=new Ji,t.push({type:"blockEmbed",key:i,value:r[i],attributes:e.attributes??{}}))}}),n.length()&&t.push({type:"block",delta:n,attributes:{}}),t}createBlock(e,t){let n;const r={};Object.entries(e).forEach(e=>{let[t,i]=e;null!=this.query(t,ti.BLOCK&ti.BLOT)?n=t:r[t]=i});const i=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(i,t||void 0);const s=i.length();return Object.entries(r).forEach(e=>{let[t,n]=e;i.formatAt(0,s,t,n)}),i}}function io(e,t,n){n.reduce((t,n)=>{const r=Yi.Op.length(n);let i=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;e.insertAt(t,r);const[s]=e.descendant(pi,t),o=ls(s);i=Yi.AttributeMap.diff(o,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;e.insertAt(t,r,n.insert[r]);if(null!=e.scroll.query(r,ti.INLINE)){const[n]=e.descendant(pi,t),r=ls(n);i=Yi.AttributeMap.diff(r,i)||{}}}return Object.keys(i).forEach(n=>{e.formatAt(t,r,n,i[n])}),t+r},t)}t(ro,"blotName","scroll"),t(ro,"className","ql-editor"),t(ro,"tagName","DIV"),t(ro,"defaultChild",is),t(ro,"allowedChildren",[is,ss,eo]);const so={scope:ti.BLOCK,whitelist:["right","center","justify"]},oo=new ni("align","align",so),lo=new li("align","ql-align",so),ao=new ci("align","text-align",so);class co extends ci{value(e){let t=super.value(e);if(!t.startsWith("rgb("))return t;t=t.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${t.split(",").map(e=>`00${parseInt(e,10).toString(16)}`.slice(-2)).join("")}`}}const uo=new li("color","ql-color",{scope:ti.INLINE}),ho=new co("color","color",{scope:ti.INLINE}),fo=new li("background","ql-bg",{scope:ti.INLINE}),po=new co("background","background-color",{scope:ti.INLINE});class mo extends eo{static create(e){const t=super.create(e);return t.setAttribute("spellcheck","false"),t}code(e,t){return this.children.map(e=>e.length()<=1?"":e.domNode.innerText).join("\n").slice(e,e+t)}html(e,t){return`<pre>\n${ts(this.code(e,t))}\n</pre>`}}class go extends is{static register(){Ws.register(mo)}}t(go,"TAB"," ");class vo extends rs{}vo.blotName="code",vo.tagName="CODE",go.blotName="code-block",go.className="ql-code-block",go.tagName="DIV",mo.blotName="code-block-container",mo.className="ql-code-block-container",mo.tagName="DIV",mo.allowedChildren=[go],go.allowedChildren=[Qi,Xi,cs],go.requiredContainer=mo;const bo={scope:ti.BLOCK,whitelist:["rtl"]},yo=new ni("direction","dir",bo),xo=new li("direction","ql-direction",bo),wo=new ci("direction","direction",bo),No={scope:ti.INLINE,whitelist:["serif","monospace"]},Eo=new li("font","ql-font",No);const ko=new class extends ci{value(e){return super.value(e).replace(/["']/g,"")}}("font","font-family",No),Ao=new li("size","ql-size",{scope:ti.INLINE,whitelist:["small","large","huge"]}),So=new ci("size","font-size",{scope:ti.INLINE,whitelist:["10px","18px","32px"]}),Co=bs("quill:keyboard"),jo=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Oo extends Ls{static match(e,t){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!t[n]!==e[n]&&null!==t[n])&&(t.key===e.key||t.key===e.which)}constructor(e,t){super(e,t),this.bindings={},Object.keys(this.options.bindings).forEach(e=>{this.options.bindings[e]&&this.addBinding(this.options.bindings[e])}),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(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(e){if("string"==typeof e||"number"==typeof e)e={key:e};else{if("object"!=typeof e)return null;e=_r(e)}e.shortKey&&(e[jo]=e.shortKey,delete e.shortKey);return e}(e);if(null==r)return void Co.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(e=>{const i={...r,key:e,...t,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)})}listen(){this.quill.root.addEventListener("keydown",e=>{if(e.defaultPrevented||e.isComposing)return;if(229===e.keyCode&&("Enter"===e.key||"Backspace"===e.key))return;const t=(this.bindings[e.key]||[]).concat(this.bindings[e.which]||[]).filter(t=>Oo.match(e,t));if(0===t.length)return;const n=Ws.find(e.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[i,s]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof qi?o.value().slice(0,l):"",d=a instanceof qi?a.value().slice(c):"",h={collapsed:0===r.length,empty:0===r.length&&i.length()<=1,format:this.quill.getFormat(r),line:i,offset:s,prefix:u,suffix:d,event:e};t.some(e=>{if(null!=e.collapsed&&e.collapsed!==h.collapsed)return!1;if(null!=e.empty&&e.empty!==h.empty)return!1;if(null!=e.offset&&e.offset!==h.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(e=>null==h.format[e]))return!1}else if("object"==typeof e.format&&!Object.keys(e.format).every(t=>!0===e.format[t]?null!=h.format[t]:!1===e.format[t]?null==h.format[t]:Xr(e.format[t],h.format[t])))return!1;return!(null!=e.prefix&&!e.prefix.test(h.prefix))&&(!(null!=e.suffix&&!e.suffix.test(h.suffix))&&!0!==e.handler.call(this,r,h,e))})&&e.preventDefault()})}handleBackspace(e,t){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;if(0===e.index||this.quill.getLength()<=1)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Ji).retain(e.index-n).delete(n);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(t){if(!("block"===t.statics.blotName&&t.length()<=1)){const t=i.formats(),n=this.quill.getFormat(e.index-1,1);if(r=Yi.AttributeMap.diff(t,n)||{},Object.keys(r).length>0){const t=(new Ji).retain(e.index+i.length()-2).retain(1,r);s=s.compose(t)}}}}this.quill.updateContents(s,Ws.sources.USER),this.quill.focus()}handleDelete(e,t){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(e.index>=this.quill.getLength()-n)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Ji).retain(e.index).delete(n);if(t.offset>=i.length()-1){const[t]=this.quill.getLine(e.index+1);if(t){const n=i.formats(),o=this.quill.getFormat(e.index,1);r=Yi.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(s=s.retain(t.length()-1).retain(1,r))}}this.quill.updateContents(s,Ws.sources.USER),this.quill.focus()}handleDeleteRange(e){Ro({range:e,quill:this.quill}),this.quill.focus()}handleEnter(e,t){const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,ti.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{}),r=(new Ji).retain(e.index).delete(e.length).insert("\n",n);this.quill.updateContents(r,Ws.sources.USER),this.quill.setSelection(e.index+1,Ws.sources.SILENT),this.quill.focus()}}const qo={bindings:{bold:Lo("bold"),italic:Lo("italic"),underline:Lo("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","+1",Ws.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","-1",Ws.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(e,t){null!=t.format.indent?this.quill.format("indent","-1",Ws.sources.USER):null!=t.format.list&&this.quill.format("list",!1,Ws.sources.USER)}},"indent code-block":_o(!0),"outdent code-block":_o(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(e){this.quill.deleteText(e.index-1,1,Ws.sources.USER)}},tab:{key:"Tab",handler(e,t){if(t.format.table)return!0;this.quill.history.cutoff();const n=(new Ji).retain(e.index).delete(e.length).insert("\t");return this.quill.updateContents(n,Ws.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,Ws.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,Ws.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(e,t){const n={list:!1};t.format.indent&&(n.indent=!1),this.quill.formatLine(e.index,e.length,n,Ws.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(e){const[t,n]=this.quill.getLine(e.index),r={...t.formats(),list:"checked"},i=(new Ji).retain(e.index).insert("\n",r).retain(t.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,Ws.sources.USER),this.quill.setSelection(e.index+1,Ws.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(e,t){const[n,r]=this.quill.getLine(e.index),i=(new Ji).retain(e.index).insert("\n",t.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,Ws.sources.USER),this.quill.setSelection(e.index+1,Ws.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(e){const t=this.quill.getModule("table");if(t){const[n,r,i,s]=t.getTable(e),o=function(e,t,n,r){if(null==t.prev&&null==t.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==t.prev)return-1;if(null==t.next)return 1;return null}(0,r,i,s);if(null==o)return;let l=n.offset();if(o<0){const t=(new Ji).retain(l).insert("\n");this.quill.updateContents(t,Ws.sources.USER),this.quill.setSelection(e.index+1,e.length,Ws.sources.SILENT)}else if(o>0){l+=n.length();const e=(new Ji).retain(l).insert("\n");this.quill.updateContents(e,Ws.sources.USER),this.quill.setSelection(l,Ws.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(e,t){const{event:n,line:r}=t,i=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(i-1,Ws.sources.USER):this.quill.setSelection(i+r.length(),Ws.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(e,t){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=t.prefix,[r,i]=this.quill.getLine(e.index);if(i>n)return!0;let s;switch(t.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(e.index," ",Ws.sources.USER),this.quill.history.cutoff();const o=(new Ji).retain(e.index-i).delete(n+1).retain(r.length()-2-i).retain(1,{list:s});return this.quill.updateContents(o,Ws.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,Ws.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(e){const[t,n]=this.quill.getLine(e.index);let r=2,i=t;for(;null!=i&&i.length()<=1&&i.formats()["code-block"];)if(i=i.prev,r-=1,r<=0){const r=(new Ji).retain(e.index+t.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,Ws.sources.USER),this.quill.setSelection(e.index-1,Ws.sources.SILENT),!1}return!0}},"embed left":To("ArrowLeft",!1),"embed left shift":To("ArrowLeft",!0),"embed right":To("ArrowRight",!1),"embed right shift":To("ArrowRight",!0),"table down":Io(!1),"table up":Io(!0)}};function _o(e){return{key:"Tab",shiftKey:!e,format:{"code-block":!0},handler(t,n){let{event:r}=n;const i=this.quill.scroll.query("code-block"),{TAB:s}=i;if(0===t.length&&!r.shiftKey)return this.quill.insertText(t.index,s,Ws.sources.USER),void this.quill.setSelection(t.index+s.length,Ws.sources.SILENT);const o=0===t.length?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:l,length:a}=t;o.forEach((t,n)=>{e?(t.insertAt(0,s),0===n?l+=s.length:a+=s.length):t.domNode.textContent.startsWith(s)&&(t.deleteAt(0,s.length),0===n?l-=s.length:a-=s.length)}),this.quill.update(Ws.sources.USER),this.quill.setSelection(l,a,Ws.sources.SILENT)}}}function To(e,t){const n="ArrowLeft"===e?"prefix":"suffix";return{key:e,shiftKey:t,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===e&&(r+=n.length+1);const[i]=this.quill.getLeaf(r);return!(i instanceof Ai)||("ArrowLeft"===e?t?this.quill.setSelection(n.index-1,n.length+1,Ws.sources.USER):this.quill.setSelection(n.index-1,Ws.sources.USER):t?this.quill.setSelection(n.index,n.length+1,Ws.sources.USER):this.quill.setSelection(n.index+n.length+1,Ws.sources.USER),!1)}}}function Lo(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],Ws.sources.USER)}}}function Io(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,n){const r=e?"prev":"next",i=n.line,s=i.parent[r];if(null!=s){if("table-row"===s.statics.blotName){let e=s.children.head,t=i;for(;null!=t.prev;)t=t.prev,e=e.next;const r=e.offset(this.quill.scroll)+Math.min(n.offset,e.length()-1);this.quill.setSelection(r,0,Ws.sources.USER)}}else{const t=i.table()[r];null!=t&&(e?this.quill.setSelection(t.offset(this.quill.scroll)+t.length()-1,0,Ws.sources.USER):this.quill.setSelection(t.offset(this.quill.scroll),0,Ws.sources.USER))}return!1}}}function Ro(e){let{quill:t,range:n}=e;const r=t.getLines(n);let i={};if(r.length>1){const e=r[0].formats(),t=r[r.length-1].formats();i=Yi.AttributeMap.diff(t,e)||{}}t.deleteText(n,Ws.sources.USER),Object.keys(i).length>0&&t.formatLine(n.index,1,i,Ws.sources.USER),t.setSelection(n.index,Ws.sources.SILENT)}Oo.DEFAULTS=qo;const Mo=/font-weight:\s*normal/,Bo=["P","OL","UL"],Do=e=>e&&Bo.includes(e.tagName);const Po=/\bmso-list:[^;]*ignore/i,Fo=/\bmso-list:[^;]*\bl(\d+)/i,Uo=/\bmso-list:[^;]*\blevel(\d+)/i,$o=e=>{var t,n;const r=Array.from(e.querySelectorAll("[style*=mso-list]")),i=[],s=[];r.forEach(e=>{(e.getAttribute("style")||"").match(Po)?i.push(e):s.push(e)}),i.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)});const o=e.documentElement.innerHTML,l=s.map(e=>((e,t)=>{const n=e.getAttribute("style"),r=null==n?void 0:n.match(Fo);if(!r)return null;const i=Number(r[1]),s=null==n?void 0:n.match(Uo),o=s?Number(s[1]):1,l=new RegExp(`@list l${i}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=t.match(l);return{id:i,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:e}})(e,o)).filter(e=>e);for(;l.length;){const e=[];let r=l.shift();for(;r;)e.push(r),r=l.length&&(null==(t=l[0])?void 0:t.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const i=document.createElement("ul");e.forEach(e=>{const t=document.createElement("li");t.setAttribute("data-list",e.type),e.indent>1&&t.setAttribute("class","ql-indent-"+(e.indent-1)),t.innerHTML=e.element.innerHTML,i.appendChild(t)});const s=null==(n=e[0])?void 0:n.element,{parentNode:o}=s??{};s&&(null==o||o.replaceChild(i,s)),e.slice(1).forEach(e=>{let{element:t}=e;null==o||o.removeChild(t)})}};const zo=[function(e){"urn:schemas-microsoft-com:office:word"===e.documentElement.getAttribute("xmlns:w")&&$o(e)},function(e){e.querySelector('[id^="docs-internal-guid-"]')&&((e=>{Array.from(e.querySelectorAll('b[style*="font-weight"]')).filter(e=>{var t;return null==(t=e.getAttribute("style"))?void 0:t.match(Mo)}).forEach(t=>{var n;const r=e.createDocumentFragment();r.append(...t.childNodes),null==(n=t.parentNode)||n.replaceChild(r,t)})})(e),(e=>{Array.from(e.querySelectorAll("br")).filter(e=>Do(e.previousElementSibling)&&Do(e.nextElementSibling)).forEach(e=>{var t;null==(t=e.parentNode)||t.removeChild(e)})})(e))}],Vo=bs("quill:clipboard"),Ho=[[Node.TEXT_NODE,function(e,t,n){var r;let i=e.data;if("O:P"===(null==(r=e.parentElement)?void 0:r.tagName))return t.insert(i.trim());if(!Qo(e)){if(0===i.trim().length&&i.includes("\n")&&!function(e,t){return e.previousElementSibling&&e.nextElementSibling&&!Jo(e.previousElementSibling,t)&&!Jo(e.nextElementSibling,t)}(e,n))return t;i=i.replace(/[^\S\u00a0]/g," "),i=i.replace(/ {2,}/g," "),(null==e.previousSibling&&null!=e.parentElement&&Jo(e.parentElement,n)||e.previousSibling instanceof Element&&Jo(e.previousSibling,n))&&(i=i.replace(/^ /,"")),(null==e.nextSibling&&null!=e.parentElement&&Jo(e.parentElement,n)||e.nextSibling instanceof Element&&Jo(e.nextSibling,n))&&(i=i.replace(/ $/,"")),i=i.replaceAll(" "," ")}return t.insert(i)}],[Node.TEXT_NODE,nl],["br",function(e,t){Yo(t,"\n")||t.insert("\n");return t}],[Node.ELEMENT_NODE,nl],[Node.ELEMENT_NODE,function(e,t,n){const r=n.query(e);if(null==r)return t;if(r.prototype instanceof Ai){const t={},i=r.value(e);if(null!=i)return t[r.blotName]=i,(new Ji).insert(t,r.formats(e,n))}else if(r.prototype instanceof Ni&&!Yo(t,"\n")&&t.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return Go(t,r.blotName,r.formats(e,n),n);return t}],[Node.ELEMENT_NODE,function(e,t,n){const r=ni.keys(e),i=li.keys(e),s=ci.keys(e),o={};return r.concat(i).concat(s).forEach(t=>{let r=n.query(t,ti.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(e),o[r.attrName])||(r=Ko[t],null==r||r.attrName!==t&&r.keyName!==t||(o[r.attrName]=r.value(e)||void 0),r=Wo[t],null==r||r.attrName!==t&&r.keyName!==t||(r=Wo[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,i]=t;return Go(e,r,i,n)},t)}],[Node.ELEMENT_NODE,function(e,t,n){var r;const i={},s=e.style||{};"italic"===s.fontStyle&&(i.italic=!0);"underline"===s.textDecoration&&(i.underline=!0);"line-through"===s.textDecoration&&(i.strike=!0);((null==(r=s.fontWeight)?void 0:r.startsWith("bold"))||parseInt(s.fontWeight,10)>=700)&&(i.bold=!0);if(t=Object.entries(i).reduce((e,t)=>{let[r,i]=t;return Go(e,r,i,n)},t),parseFloat(s.textIndent||0)>0)return(new Ji).insert("\t").concat(t);return t}],["li",function(e,t,n){const r=n.query(e);if(null==r||"list"!==r.blotName||!Yo(t,"\n"))return t;let i=-1,s=e.parentNode;for(;null!=s;)["OL","UL"].includes(s.tagName)&&(i+=1),s=s.parentNode;return i<=0?t:t.reduce((e,t)=>t.insert?t.attributes&&"number"==typeof t.attributes.indent?e.push(t):e.insert(t.insert,{indent:i,...t.attributes||{}}):e,new Ji)}],["ol, ul",function(e,t,n){const r=e;let i="OL"===r.tagName?"ordered":"bullet";const s=r.getAttribute("data-checked");s&&(i="true"===s?"checked":"unchecked");return Go(t,"list",i,n)}],["pre",function(e,t,n){const r=n.query("code-block"),i=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(e,n);return Go(t,"code-block",i,n)}],["tr",function(e,t,n){var r,i;const s="TABLE"===(null==(r=e.parentElement)?void 0:r.tagName)?e.parentElement:null==(i=e.parentElement)?void 0:i.parentElement;if(null!=s){return Go(t,"table",Array.from(s.querySelectorAll("tr")).indexOf(e)+1,n)}return t}],["b",tl("bold")],["i",tl("italic")],["strike",tl("strike")],["style",function(){return new Ji}]],Ko=[oo,yo].reduce((e,t)=>(e[t.keyName]=t,e),{}),Wo=[ao,po,ho,wo,ko,So].reduce((e,t)=>(e[t.keyName]=t,e),{});class Zo extends Ls{constructor(e,t){super(e,t),this.quill.root.addEventListener("copy",e=>this.onCaptureCopy(e,!1)),this.quill.root.addEventListener("cut",e=>this.onCaptureCopy(e,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Ho.concat(this.options.matchers??[]).forEach(e=>{let[t,n]=e;this.addMatcher(t,n)})}addMatcher(e,t){this.matchers.push([e,t])}convert(e){let{html:t,text:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[go.blotName])return(new Ji).insert(n||"",{[go.blotName]:r[go.blotName]});if(!t)return(new Ji).insert(n||"",r);const i=this.convertHTML(t);return Yo(i,"\n")&&(null==i.ops[i.ops.length-1].attributes||r.table)?i.compose((new Ji).retain(i.length()-1).delete(1)):i}normalizeHTML(e){(e=>{e.documentElement&&zo.forEach(t=>{t(e)})})(e)}convertHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");this.normalizeHTML(t);const n=t.body,r=new WeakMap,[i,s]=this.prepareMatching(n,r);return el(this.quill.scroll,n,i,s,r)}dangerouslyPasteHTML(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ws.sources.API;if("string"==typeof e){const n=this.convert({html:e,text:""});this.quill.setContents(n,t),this.quill.setSelection(0,Ws.sources.SILENT)}else{const r=this.convert({html:t,text:""});this.quill.updateContents((new Ji).retain(e).concat(r),n),this.quill.setSelection(e+r.length(),Ws.sources.SILENT)}}onCaptureCopy(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.defaultPrevented)return;e.preventDefault();const[i]=this.quill.selection.getRange();if(null==i)return;const{html:s,text:o}=this.onCopy(i,r);null==(t=e.clipboardData)||t.setData("text/plain",o),null==(n=e.clipboardData)||n.setData("text/html",s),r&&Ro({range:i,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>"#"!==e[0]).join("\n")}onCapturePaste(e){var t,n,r,i,s;if(e.defaultPrevented||!this.quill.isEnabled())return;e.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(t=e.clipboardData)?void 0:t.getData("text/html");let a=null==(n=e.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const t=null==(r=e.clipboardData)?void 0:r.getData("text/uri-list");t&&(a=this.normalizeURIList(t))}const c=Array.from((null==(i=e.clipboardData)?void 0:i.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const e=(new DOMParser).parseFromString(l,"text/html");if(1===e.body.childElementCount&&"IMG"===(null==(s=e.body.firstElementChild)?void 0:s.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(e){const t=this.quill.getText(e);return{html:this.quill.getSemanticHTML(e),text:t}}onPaste(e,t){let{text:n,html:r}=t;const i=this.quill.getFormat(e.index),s=this.convert({text:n,html:r},i);Vo.log("onPaste",s,{text:n,html:r});const o=(new Ji).retain(e.index).delete(e.length).concat(s);this.quill.updateContents(o,Ws.sources.USER),this.quill.setSelection(o.length()-e.length,Ws.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(e,t){const n=[],r=[];return this.matchers.forEach(i=>{const[s,o]=i;switch(s){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(e.querySelectorAll(s)).forEach(e=>{if(t.has(e)){const n=t.get(e);null==n||n.push(o)}else t.set(e,[o])})}}),[n,r]}}function Go(e,t,n,r){return r.query(t)?e.reduce((e,r)=>{if(!r.insert)return e;if(r.attributes&&r.attributes[t])return e.push(r);const i=n?{[t]:n}:{};return e.insert(r.insert,{...i,...r.attributes})},new Ji):e}function Yo(e,t){let n="";for(let r=e.ops.length-1;r>=0&&n.length<t.length;--r){const t=e.ops[r];if("string"!=typeof t.insert)break;n=t.insert+n}return n.slice(-1*t.length)===t}function Jo(e,t){if(!(e instanceof Element))return!1;const n=t.query(e);return!(n&&n.prototype instanceof Ai)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(e.tagName.toLowerCase())}t(Zo,"DEFAULTS",{matchers:[]});const Xo=new WeakMap;function Qo(e){return null!=e&&(Xo.has(e)||("PRE"===e.tagName?Xo.set(e,!0):Xo.set(e,Qo(e.parentNode))),Xo.get(e))}function el(e,t,n,r,i){return t.nodeType===t.TEXT_NODE?r.reduce((n,r)=>r(t,n,e),new Ji):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((s,o)=>{let l=el(e,o,n,r,i);return o.nodeType===t.ELEMENT_NODE&&(l=n.reduce((t,n)=>n(o,t,e),l),l=(i.get(o)||[]).reduce((t,n)=>n(o,t,e),l)),s.concat(l)},new Ji):new Ji}function tl(e){return(t,n,r)=>Go(n,e,!0,r)}function nl(e,t,n){if(!Yo(t,"\n")){if(Jo(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert("\n");if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;null!=r;){if(Jo(r,n))return t.insert("\n");const e=n.query(r);if(e&&e.prototype instanceof ss)return t.insert("\n");r=r.firstChild}}}return t}class rl extends Ls{constructor(e,n){super(e,n),t(this,"lastRecorded",0),t(this,"ignoreChange",!1),t(this,"stack",{undo:[],redo:[]}),t(this,"currentRange",null),this.quill.on(Ws.events.EDITOR_CHANGE,(e,t,n,r)=>{e===Ws.events.SELECTION_CHANGE?t&&r!==Ws.sources.SILENT&&(this.currentRange=t):e===Ws.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==Ws.sources.USER?this.transform(t):this.record(t,n)),this.currentRange=sl(this.currentRange,t))}),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",e=>{"historyUndo"===e.inputType?(this.undo(),e.preventDefault()):"historyRedo"===e.inputType&&(this.redo(),e.preventDefault())})}change(e,t){if(0===this.stack[e].length)return;const n=this.stack[e].pop();if(!n)return;const r=this.quill.getContents(),i=n.delta.invert(r);this.stack[t].push({delta:i,range:sl(n.range,i)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,Ws.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,t){if(0===e.ops.length)return;this.stack.redo=[];let n=e.invert(t),r=this.currentRange;const i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){const e=this.stack.undo.pop();e&&(n=n.compose(e.delta),r=e.range)}else this.lastRecorded=i;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){il(this.stack.undo,e),il(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,Ws.sources.USER);else{const t=function(e,t){const n=t.reduce((e,t)=>e+(t.delete||0),0);let r=t.length()-n;(function(e,t){const n=t.ops[t.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(t=>null!=e.query(t,ti.BLOCK));return!1})(e,t)&&(r-=1);return r}(this.quill.scroll,e.delta);this.quill.setSelection(t,Ws.sources.USER)}}}function il(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){const t=e[r];e[r]={delta:n.transform(t.delta,!0),range:t.range&&sl(t.range,n)},n=t.delta.transform(n),0===e[r].delta.length()&&e.splice(r,1)}}function sl(e,t){if(!e)return e;const n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}t(rl,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class ol extends Ls{constructor(e,t){super(e,t),e.root.addEventListener("drop",t=>{var n;t.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(t.clientX,t.clientY);else if(document.caretPositionFromPoint){const e=document.caretPositionFromPoint(t.clientX,t.clientY);r=document.createRange(),r.setStart(e.offsetNode,e.offset),r.setEnd(e.offsetNode,e.offset)}const i=r&&e.selection.normalizeNative(r);if(i){const r=e.selection.normalizedToRange(i);(null==(n=t.dataTransfer)?void 0:n.files)&&this.upload(r,t.dataTransfer.files)}})}upload(e,t){const n=[];Array.from(t).forEach(e=>{var t;e&&(null==(t=this.options.mimetypes)?void 0:t.includes(e.type))&&n.push(e)}),n.length>0&&this.options.handler.call(this,e,n)}}ol.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(e,t){if(!this.quill.scroll.query("image"))return;const n=t.map(e=>new Promise(t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));Promise.all(n).then(t=>{const n=t.reduce((e,t)=>e.insert({image:t}),(new Ji).retain(e.index).delete(e.length));this.quill.updateContents(n,xs.sources.USER),this.quill.setSelection(e.index+t.length,xs.sources.SILENT)})}};const ll=["insertText","insertReplacementText"];const al=/Mac/i.test(navigator.platform);Ws.register({"blots/block":is,"blots/block/embed":ss,"blots/break":Xi,"blots/container":eo,"blots/cursor":cs,"blots/embed":Rs,"blots/inline":rs,"blots/scroll":ro,"blots/text":Qi,"modules/clipboard":Zo,"modules/history":rl,"modules/keyboard":Oo,"modules/uploader":ol,"modules/input":class extends Ls{constructor(e,t){super(e,t),e.root.addEventListener("beforeinput",e=>{this.handleBeforeInput(e)}),/Android/i.test(navigator.userAgent)||e.on(Ws.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(e){Ro({range:e,quill:this.quill})}replaceText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===e.length)return!1;if(t){const n=this.quill.getFormat(e.index,1);this.deleteRange(e),this.quill.updateContents((new Ji).retain(e.index).insert(t,n),Ws.sources.USER)}else this.deleteRange(e);return this.quill.setSelection(e.index+t.length,0,Ws.sources.SILENT),!0}handleBeforeInput(e){if(this.quill.composition.isComposing||e.defaultPrevented||!ll.includes(e.inputType))return;const t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||!0===t.collapsed)return;const n=function(e){var t;if("string"==typeof e.data)return e.data;if(null==(t=e.dataTransfer)?void 0:t.types.includes("text/plain"))return e.dataTransfer.getData("text/plain");return null}(e);if(null==n)return;const r=this.quill.selection.normalizeNative(t),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&e.preventDefault()}handleCompositionStart(){const e=this.quill.getSelection();e&&this.replaceText(e)}},"modules/uiNode":class extends Ls{constructor(e,n){super(e,n),t(this,"isListening",!1),t(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,t){let{line:n,event:r}=t;if(!(n instanceof bi&&n.uiNode))return!0;const i="rtl"===getComputedStyle(n.domNode).direction;return!!(i&&"ArrowRight"!==r.key||!i&&"ArrowLeft"!==r.key)||(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),Ws.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&(e=>"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key||"Home"===e.key||!(!al||"a"!==e.key||!0!==e.ctrlKey))(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const t=e.getRangeAt(0);if(!0!==t.collapsed||0!==t.startOffset)return;const n=this.quill.scroll.find(t.startContainer);if(!(n instanceof bi&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}}});const cl=new class extends li{add(e,t){let n=0;if("+1"===t||"-1"===t){const r=this.value(e)||0;n="+1"===t?r+1:r-1}else"number"==typeof t&&(n=t);return 0===n?(this.remove(e),!0):super.add(e,n.toString())}canAdd(e,t){return super.canAdd(e,t)||super.canAdd(e,parseInt(t,10))}value(e){return parseInt(super.value(e),10)||void 0}}("indent","ql-indent",{scope:ti.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class ul extends is{}t(ul,"blotName","blockquote"),t(ul,"tagName","blockquote");class dl extends is{static formats(e){return this.tagName.indexOf(e.tagName)+1}}t(dl,"blotName","header"),t(dl,"tagName",["H1","H2","H3","H4","H5","H6"]);class hl extends eo{}hl.blotName="list-container",hl.tagName="OL";class fl extends is{static create(e){const t=super.create();return t.setAttribute("data-list",e),t}static formats(e){return e.getAttribute("data-list")||void 0}static register(){Ws.register(hl)}constructor(e,t){super(e,t);const n=t.ownerDocument.createElement("span"),r=n=>{if(!e.isEnabled())return;const r=this.statics.formats(t,e);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-list",t):super.format(e,t)}}fl.blotName="list",fl.tagName="LI",hl.allowedChildren=[fl],fl.requiredContainer=hl;class pl extends rs{static create(){return super.create()}static formats(){return!0}optimize(e){super.optimize(e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}t(pl,"blotName","bold"),t(pl,"tagName",["STRONG","B"]);class ml extends pl{}t(ml,"blotName","italic"),t(ml,"tagName",["EM","I"]);class gl extends rs{static create(e){const t=super.create(e);return t.setAttribute("href",this.sanitize(e)),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t}static formats(e){return e.getAttribute("href")}static sanitize(e){return vl(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("href",this.constructor.sanitize(t)):super.format(e,t)}}function vl(e,t){const n=document.createElement("a");n.href=e;const r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}t(gl,"blotName","link"),t(gl,"tagName","A"),t(gl,"SANITIZED_URL","about:blank"),t(gl,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class bl extends rs{static create(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):super.create(e)}static formats(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}t(bl,"blotName","script"),t(bl,"tagName",["SUB","SUP"]);class yl extends pl{}t(yl,"blotName","strike"),t(yl,"tagName",["S","STRIKE"]);class xl extends rs{}t(xl,"blotName","underline"),t(xl,"tagName","U");class wl extends Rs{static create(e){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const t=super.create(e);return"string"==typeof e&&(window.katex.render(e,t,{throwOnError:!1,errorColor:"#f00"}),t.setAttribute("data-value",e)),t}static value(e){return e.getAttribute("data-value")}html(){const{formula:e}=this.value();return`<span>${e}</span>`}}t(wl,"blotName","formula"),t(wl,"className","ql-formula"),t(wl,"tagName","SPAN");const Nl=["alt","height","width"];class El extends Ai{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("src",this.sanitize(e)),t}static formats(e){return Nl.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static match(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}static sanitize(e){return vl(e,["http","https","data"])?e:"//:0"}static value(e){return e.getAttribute("src")}format(e,t){Nl.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}t(El,"blotName","image"),t(El,"tagName","IMG");const kl=["height","width"];class Al extends ss{static create(e){const t=super.create(e);return t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen","true"),t.setAttribute("src",this.sanitize(e)),t}static formats(e){return kl.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return gl.sanitize(e)}static value(e){return e.getAttribute("src")}format(e,t){kl.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}html(){const{video:e}=this.value();return`<a href="${e}">${e}</a>`}}t(Al,"blotName","video"),t(Al,"className","ql-video"),t(Al,"tagName","IFRAME");const Sl=new li("code-token","hljs",{scope:ti.INLINE});class Cl extends rs{static formats(e,t){for(;null!=e&&e!==t.domNode;){if(e.classList&&e.classList.contains(go.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),Sl.add(this.domNode,n)}format(e,t){e!==Cl.blotName?super.format(e,t):t?Sl.add(this.domNode,t):(Sl.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),Sl.value(this.domNode)||this.unwrap()}}Cl.blotName="code-token",Cl.className="ql-token";class jl extends go{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("data-language",e),t}static formats(e){return e.getAttribute("data-language")||"plain"}static register(){}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-language",t):super.format(e,t)}replaceWith(e,t){return this.formatAt(0,this.length(),Cl.blotName,!1),super.replaceWith(e,t)}}class Ol extends mo{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===jl.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===jl.blotName&&(this.forceNext=!0),super.formatAt(e,t,n,r)}highlight(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).map(e=>e.textContent).join("\n")}\n`,r=jl.formats(this.children.head.domNode);if(t||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const t=this.children.reduce((e,t)=>e.concat(os(t,!1)),new Ji),i=e(n,r);t.diff(i).reduce((e,t)=>{let{retain:n,attributes:r}=t;return n?(r&&Object.keys(r).forEach(t=>{[jl.blotName,Cl.blotName].includes(t)&&this.formatAt(e,n,t,r[t])}),e+n):e},0)}this.cachedText=n,this.forceNext=!1}}html(e,t){const[n]=this.children.find(e);return`<pre data-language="${n?jl.formats(n.domNode):"plain"}">\n${ts(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const e=jl.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}Ol.allowedChildren=[jl],jl.requiredContainer=Ol,jl.allowedChildren=[Cl,cs,Qi,Xi];class ql extends Ls{static register(){Ws.register(Cl,!0),Ws.register(jl,!0),Ws.register(Ol,!0)}constructor(e,t){if(super(e,t),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((e,t)=>{let{key:n}=t;return e[n]=!0,e},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(Ws.events.SCROLL_BLOT_MOUNT,e=>{if(!(e instanceof Ol))return;const t=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(e=>{let{key:n,label:r}=e;const i=t.ownerDocument.createElement("option");i.textContent=r,i.setAttribute("value",n),t.appendChild(i)}),t.addEventListener("change",()=>{e.format(jl.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),null==e.uiNode&&(e.attachUI(t),e.children.head&&(t.value=jl.formats(e.children.head.domNode)))})}initTimer(){let e=null;this.quill.on(Ws.events.SCROLL_OPTIMIZE,()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.highlight(),e=null},this.options.interval)})}highlight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(Ws.sources.USER);const n=this.quill.getSelection();(null==e?this.quill.scroll.descendants(Ol):[e]).forEach(e=>{e.highlight(this.highlightBlot,t)}),this.quill.update(Ws.sources.SILENT),null!=n&&this.quill.setSelection(n,Ws.sources.SILENT)}highlightBlot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(t=this.languages[t]?t:"plain","plain"===t)return ts(e).split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[go.blotName]:t}),e.insert(n)),new Ji);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(go.className),n.innerHTML=((e,t,n)=>{if("string"==typeof e.versionString){const r=e.versionString.split(".")[0];if(parseInt(r,10)>=11)return e.highlight(n,{language:t}).value}return e.highlight(t,n).value})(this.options.hljs,t,e),el(this.quill.scroll,n,[(e,t)=>{const n=Sl.value(e);return n?t.compose((new Ji).retain(t.length(),{[Cl.blotName]:n})):t}],[(e,n)=>e.data.split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[go.blotName]:t}),e.insert(n)),n)],new WeakMap)}}ql.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 _l=class e extends is{static create(e){const t=super.create();return e?t.setAttribute("data-row",e):t.setAttribute("data-row",Ml()),t}static formats(e){if(e.hasAttribute("data-row"))return e.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,n){t===e.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(t,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};t(_l,"blotName","table"),t(_l,"tagName","TD");let Tl=_l;class Ll extends eo{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return e.table===t.table&&e.table===n.table&&e.table===r.table}return!1}optimize(e){super.optimize(e),this.children.forEach(e=>{if(null==e.next)return;const t=e.formats(),n=e.next.formats();if(t.table!==n.table){const t=this.splitAfter(e);t&&t.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}t(Ll,"blotName","table-row"),t(Ll,"tagName","TR");class Il extends eo{}t(Il,"blotName","table-body"),t(Il,"tagName","TBODY");class Rl extends eo{balanceCells(){const e=this.descendants(Ll),t=e.reduce((e,t)=>Math.max(t.children.length,e),0);e.forEach(e=>{new Array(t-e.children.length).fill(0).forEach(()=>{let t;null!=e.children.head&&(t=Tl.formats(e.children.head.domNode));const n=this.scroll.create(Tl.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){const[t]=this.descendant(Il);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e);null!=n&&n.remove()})}insertColumn(e){const[t]=this.descendant(Il);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e),r=Tl.formats(t.children.head.domNode),i=this.scroll.create(Tl.blotName,r);t.insertBefore(i,n)})}insertRow(e){const[t]=this.descendant(Il);if(null==t||null==t.children.head)return;const n=Ml(),r=this.scroll.create(Ll.blotName);t.children.head.children.forEach(()=>{const e=this.scroll.create(Tl.blotName,n);r.appendChild(e)});const i=t.children.at(e);t.insertBefore(r,i)}rows(){const e=this.children.head;return null==e?[]:e.children.map(e=>e)}}function Ml(){return`row-${Math.random().toString(36).slice(2,6)}`}t(Rl,"blotName","table-container"),t(Rl,"tagName","TABLE"),Rl.allowedChildren=[Il],Il.requiredContainer=Rl,Il.allowedChildren=[Ll],Ll.requiredContainer=Il,Ll.allowedChildren=[Tl],Tl.requiredContainer=Ll;const Bl=bs("quill:toolbar");class Dl extends Ls{constructor(e,t){var n,r;if(super(e,t),Array.isArray(this.options.container)){const t=document.createElement("div");t.setAttribute("role","toolbar"),function(e,t){Array.isArray(t[0])||(t=[t]);t.forEach(t=>{const n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(e=>{if("string"==typeof e)Pl(n,e);else{const t=Object.keys(e)[0],r=e[t];Array.isArray(r)?function(e,t,n){const r=document.createElement("select");r.classList.add(`ql-${t}`),n.forEach(e=>{const t=document.createElement("option");!1!==e?t.setAttribute("value",String(e)):t.setAttribute("selected","selected"),r.appendChild(t)}),e.appendChild(r)}(n,t,r):Pl(n,t,r)}}),e.appendChild(n)})}(t,this.options.container),null==(r=null==(n=e.container)?void 0:n.parentNode)||r.insertBefore(t,e.container),this.container=t}else"string"==typeof this.options.container?this.container=document.querySelector(this.options.container):this.container=this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(e=>{var t;const n=null==(t=this.options.handlers)?void 0:t[e];n&&this.addHandler(e,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(e=>{this.attach(e)}),this.quill.on(Ws.events.EDITOR_CHANGE,()=>{const[e]=this.quill.selection.getRange();this.update(e)})):Bl.error("Container required for toolbar",this.options)}addHandler(e,t){this.handlers[e]=t}attach(e){let t=Array.from(e.classList).find(e=>0===e.indexOf("ql-"));if(!t)return;if(t=t.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[t]&&null==this.quill.scroll.query(t))return void Bl.warn("ignoring attaching to nonexistent format",t,e);const n="SELECT"===e.tagName?"change":"click";e.addEventListener(n,n=>{let r;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;const t=e.options[e.selectedIndex];r=!t.hasAttribute("selected")&&(t.value||!1)}else r=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),n.preventDefault();this.quill.focus();const[i]=this.quill.selection.getRange();if(null!=this.handlers[t])this.handlers[t].call(this,r);else if(this.quill.scroll.query(t).prototype instanceof Ai){if(r=prompt(`Enter ${t}`),!r)return;this.quill.updateContents((new Ji).retain(i.index).delete(i.length).insert({[t]:r}),Ws.sources.USER)}else this.quill.format(t,r,Ws.sources.USER);this.update(i)}),this.controls.push([t,e])}update(e){const t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(n=>{const[r,i]=n;if("SELECT"===i.tagName){let n=null;if(null==e)n=null;else if(null==t[r])n=i.querySelector("option[selected]");else if(!Array.isArray(t[r])){let e=t[r];"string"==typeof e&&(e=e.replace(/"/g,'\\"')),n=i.querySelector(`option[value="${e}"]`)}null==n?(i.value="",i.selectedIndex=-1):n.selected=!0}else if(null==e)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const e=t[r],n=e===i.getAttribute("value")||null!=e&&e.toString()===i.getAttribute("value")||null==e&&!i.getAttribute("value");i.classList.toggle("ql-active",n),i.setAttribute("aria-pressed",n.toString())}else{const e=null!=t[r];i.classList.toggle("ql-active",e),i.setAttribute("aria-pressed",e.toString())}})}}function Pl(e,t,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${t}: ${n}`)):r.setAttribute("aria-label",t),e.appendChild(r)}Dl.DEFAULTS={},Dl.DEFAULTS={container:null,handlers:{clean(){const e=this.quill.getSelection();if(null!=e)if(0===e.length){const e=this.quill.getFormat();Object.keys(e).forEach(e=>{null!=this.quill.scroll.query(e,ti.INLINE)&&this.quill.format(e,!1,Ws.sources.USER)})}else this.quill.removeFormat(e.index,e.length,Ws.sources.USER)},direction(e){const{align:t}=this.quill.getFormat();"rtl"===e&&null==t?this.quill.format("align","right",Ws.sources.USER):e||"right"!==t||this.quill.format("align",!1,Ws.sources.USER),this.quill.format("direction",e,Ws.sources.USER)},indent(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0,10);if("+1"===e||"-1"===e){let t="+1"===e?1:-1;"rtl"===n.direction&&(t*=-1),this.quill.format("indent",r+t,Ws.sources.USER)}},link(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,Ws.sources.USER)},list(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,Ws.sources.USER):this.quill.format("list","unchecked",Ws.sources.USER):this.quill.format("list",e,Ws.sources.USER)}}};const Fl='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',Ul={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:Fl,"code-block":Fl,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let $l=0;function zl(e,t){e.setAttribute(t,`${!("true"===e.getAttribute(t))}`)}class Vl{constructor(e){this.select=e,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()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),zl(this.label,"aria-expanded"),zl(this.options,"aria-hidden")}buildItem(e){const t=document.createElement("span");t.tabIndex="0",t.setAttribute("role","button"),t.classList.add("ql-picker-item");const n=e.getAttribute("value");return n&&t.setAttribute("data-value",n),e.textContent&&t.setAttribute("data-label",e.textContent),t.addEventListener("click",()=>{this.selectItem(t,!0)}),t.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.selectItem(t,!0),e.preventDefault();break;case"Escape":this.escape(),e.preventDefault()}}),t}buildLabel(){const e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}buildOptions(){const e=document.createElement("span");e.classList.add("ql-picker-options"),e.setAttribute("aria-hidden","true"),e.tabIndex="-1",e.id=`ql-picker-options-${$l}`,$l+=1,this.label.setAttribute("aria-controls",e.id),this.options=e,Array.from(this.select.options).forEach(t=>{const n=this.buildItem(t);e.appendChild(n),!0===t.selected&&this.selectItem(n)}),this.container.appendChild(e)}buildPicker(){Array.from(this.select.attributes).forEach(e=>{this.container.setAttribute(e.name,e.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(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=Array.from(e.parentNode.children).indexOf(e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let e;if(this.select.selectedIndex>-1){const t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);const t=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",t)}}class Hl extends Vl{constructor(e,t){super(e),this.label.innerHTML=t,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(e=>{e.classList.add("ql-primary")})}buildItem(e){const t=super.buildItem(e);return t.style.backgroundColor=e.getAttribute("value")||"",t}selectItem(e,t){super.selectItem(e,t);const n=this.label.querySelector(".ql-color-label"),r=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Kl extends Vl{constructor(e,t){super(e),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(e=>{e.innerHTML=t[e.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(e,t){super.selectItem(e,t);const n=e||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class Wl{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(e=>{const{overflowY:t}=getComputedStyle(e,null);return"visible"!==t&&"clip"!==t})(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(e){const t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=`${t}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect();let s=0;if(i.right>r.right&&(s=r.right-i.right,this.root.style.left=`${t+s}px`),i.left<r.left&&(s=r.left-i.left,this.root.style.left=`${t+s}px`),i.bottom>r.bottom){const t=i.bottom-i.top,r=e.bottom-e.top+t;this.root.style.top=n-r+"px",this.root.classList.add("ql-flip")}return s}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const Zl=[!1,"center","right","justify"],Gl=["#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"],Yl=[!1,"serif","monospace"],Jl=["1","2","3",!1],Xl=["small",!1,"large","huge"];class Ql extends Ds{constructor(e,t){super(e,t);const n=t=>{document.body.contains(e.root)?(null==this.tooltip||this.tooltip.root.contains(t.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(e=>{e.container.contains(t.target)||e.close()})):document.body.removeEventListener("click",n)};e.emitter.listenDOM("click",document.body,n)}addModule(e){const t=super.addModule(e);return"toolbar"===e&&this.extendToolbar(t),t}buildButtons(e,t){Array.from(e).forEach(e=>{(e.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=t[n]))if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{const r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}buildPickers(e,t){this.pickers=Array.from(e).map(e=>{if(e.classList.contains("ql-align")&&(null==e.querySelector("option")&&ta(e,Zl),"object"==typeof t.align))return new Kl(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){const n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&ta(e,Gl,"background"===n?"#ffffff":"#000000"),new Hl(e,t[n])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?ta(e,Yl):e.classList.contains("ql-header")?ta(e,Jl):e.classList.contains("ql-size")&&ta(e,Xl)),new Vl(e)});this.quill.on(xs.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}}Ql.DEFAULTS=ei({},Ds.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let e=this.container.querySelector("input.ql-image[type=file]");null==e&&(e=document.createElement("input"),e.setAttribute("type","file"),e.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),e.classList.add("ql-image"),e.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,e.files),e.value=""}),this.container.appendChild(e)),e.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class ea extends Wl{constructor(e,t){super(e,t),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",e=>{"Enter"===e.key?(this.save(),e.preventDefault()):"Escape"===e.key&&(this.cancel(),e.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${e}`)||""),this.root.setAttribute("data-mode",e)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:e}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:t}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,xs.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,xs.sources.USER)),this.quill.root.scrollTop=t;break}case"video":e=function(e){let t=e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(t)return`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`;if(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`;return e}(e);case"formula":{if(!e)break;const t=this.quill.getSelection(!0);if(null!=t){const n=t.index+t.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,xs.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",xs.sources.USER),this.quill.setSelection(n+2,xs.sources.USER)}break}}this.textbox.value="",this.hide()}}function ta(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(t=>{const r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(t)),e.appendChild(r)})}const na=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class ra extends ea{constructor(e,t){super(e,t),this.quill.on(xs.events.EDITOR_CHANGE,(e,t,n,r)=>{if(e===xs.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&r===xs.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const e=this.quill.getLines(t.index,t.length);if(1===e.length){const e=this.quill.getBounds(t);null!=e&&this.position(e)}else{const n=e[e.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,t.index+t.length-r),s=this.quill.getBounds(new Ns(r,i));null!=s&&this.position(s)}}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(xs.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const e=this.quill.getSelection();if(null!=e){const t=this.quill.getBounds(e);null!=t&&this.position(t)}},1)})}cancel(){this.show()}position(e){const t=super.position(e),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==t&&(n.style.marginLeft=-1*t-n.offsetWidth/2+"px"),t}}t(ra,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class ia extends Ql{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=na),super(e,t),this.quill.container.classList.add("ql-bubble")}extendToolbar(e){this.tooltip=new ra(this.quill,this.options.bounds),null!=e.container&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll("button"),Ul),this.buildPickers(e.container.querySelectorAll("select"),Ul))}}ia.DEFAULTS=ei({},Ql.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1,Ws.sources.USER)}}}}});const sa=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class oa extends ea{constructor(){super(...arguments),t(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(null!=this.linkRange){const e=this.linkRange;this.restoreFocus(),this.quill.formatText(e,"link",!1,xs.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(xs.events.SELECTION_CHANGE,(e,t,n)=>{if(null!=e){if(0===e.length&&n===xs.sources.USER){const[t,n]=this.quill.scroll.descendant(gl,e.index);if(null!=t){this.linkRange=new Ns(e.index-n,t.length());const r=gl.formats(t.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const i=this.quill.getBounds(this.linkRange);return void(null!=i&&this.position(i))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}t(oa,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class la extends Ql{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=sa),super(e,t),this.quill.container.classList.add("ql-snow")}extendToolbar(e){null!=e.container&&(e.container.classList.add("ql-snow"),this.buildButtons(e.container.querySelectorAll("button"),Ul),this.buildPickers(e.container.querySelectorAll("select"),Ul),this.tooltip=new oa(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(t,n)=>{e.handlers.link.call(e,!n.format.link)}))}}la.DEFAULTS=ei({},Ql.DEFAULTS,{modules:{toolbar:{handlers:{link(e){if(e){const e=this.quill.getSelection();if(null==e||0===e.length)return;let t=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(t)&&0!==t.indexOf("mailto:")&&(t=`mailto:${t}`);const{tooltip:n}=this.quill.theme;n.edit("link",t)}else this.quill.format("link",!1,Ws.sources.USER)}}}}}),Ws.register({"attributors/attribute/direction":yo,"attributors/class/align":lo,"attributors/class/background":fo,"attributors/class/color":uo,"attributors/class/direction":xo,"attributors/class/font":Eo,"attributors/class/size":Ao,"attributors/style/align":ao,"attributors/style/background":po,"attributors/style/color":ho,"attributors/style/direction":wo,"attributors/style/font":ko,"attributors/style/size":So},!0),Ws.register({"formats/align":lo,"formats/direction":xo,"formats/indent":cl,"formats/background":po,"formats/color":ho,"formats/font":Eo,"formats/size":Ao,"formats/blockquote":ul,"formats/code-block":go,"formats/header":dl,"formats/list":fl,"formats/bold":pl,"formats/code":vo,"formats/italic":ml,"formats/link":gl,"formats/script":bl,"formats/strike":yl,"formats/underline":xl,"formats/formula":wl,"formats/image":El,"formats/video":Al,"modules/syntax":ql,"modules/table":class extends Ls{static register(){Ws.register(Tl),Ws.register(Ll),Ws.register(Il),Ws.register(Rl)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Rl).forEach(e=>{e.balanceCells()})}deleteColumn(){const[e,,t]=this.getTable();null!=t&&(e.deleteColumn(t.cellOffset()),this.quill.update(Ws.sources.USER))}deleteRow(){const[,e]=this.getTable();null!=e&&(e.remove(),this.quill.update(Ws.sources.USER))}deleteTable(){const[e]=this.getTable();if(null==e)return;const t=e.offset();e.remove(),this.quill.update(Ws.sources.USER),this.quill.setSelection(t,Ws.sources.SILENT)}getTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==e)return[null,null,null,-1];const[t,n]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==Tl.blotName)return[null,null,null,-1];const r=t.parent;return[r.parent.parent,r,t,n]}insertColumn(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=i.cellOffset();n.insertColumn(s+e),this.quill.update(Ws.sources.USER);let o=r.rowOffset();0===e&&(o+=1),this.quill.setSelection(t.index+o,t.length,Ws.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=r.rowOffset();n.insertRow(s+e),this.quill.update(Ws.sources.USER),e>0?this.quill.setSelection(t,Ws.sources.SILENT):this.quill.setSelection(t.index+r.children.length,t.length,Ws.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(e,t){const n=this.quill.getSelection();if(null==n)return;const r=new Array(e).fill(0).reduce(e=>{const n=new Array(t).fill("\n").join("");return e.insert(n,{table:Ml()})},(new Ji).retain(n.index));this.quill.updateContents(r,Ws.sources.USER),this.quill.setSelection(n.index,Ws.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(Ws.events.SCROLL_OPTIMIZE,e=>{e.some(e=>!!["TD","TR","TBODY","TABLE"].includes(e.target.tagName)&&(this.quill.once(Ws.events.TEXT_CHANGE,(e,t,n)=>{n===Ws.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":Dl,"themes/bubble":ia,"themes/snow":la,"ui/icons":Ul,"ui/picker":Vl,"ui/icon-picker":Kl,"ui/color-picker":Hl,"ui/tooltip":Wl},!0);const aa=({value:e,onChange:t,placeholder:i,style:s})=>{const o=r.useRef(null),l=r.useRef(null);return r.useEffect(()=>{if(o.current&&!l.current){l.current=new Ws(o.current,{theme:"snow",modules:{toolbar:[[{header:[1,2,!1]}],["bold","italic","underline"],["link","image"]]},placeholder:i});const e=l.current;e.on("text-change",(n,r,i)=>{if("user"===i){const n=e.root.innerHTML;null==t||t("<p><br></p>"===n?"":n)}})}},[i]),r.useEffect(()=>{const t=l.current;if(t&&e!==t.root.innerHTML){const n=0===t.getText().trim().length;!e&&n||t.clipboard.dangerouslyPasteHTML(e||"")}},[e]),n.jsx("div",{ref:o,style:{minHeight:"200px",...s}})},ca="_fileUploadWrapper_byo9w_1",ua=({value:e,onChange:t,accept:o=".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar",listType:l="text",maxCount:a=1,key:c,disabled:u=!1,maxSize:d=1e3,buttonText:h="上传文件"})=>{const[p,m]=r.useState(!1),[g,v]=r.useState(""),[b,y]=r.useState(""),[x,w]=r.useState("none"),[N,E]=r.useState([]),[k,A]=r.useState(!1),S=e=>{try{const n=e.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(t){}return r||"未知文件"}catch(n){return"未知文件"}},C=e=>e?Array.isArray(e)?e.filter(Boolean):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const t=C(e);return JSON.stringify(t)},[e]),O=r.useRef(N);r.useEffect(()=>{O.current=N},[N]),r.useEffect(()=>{if(k)return void A(!1);const t=C(e),n=O.current.filter(e=>"done"===e.status).map(e=>e.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(t))if(t.length>0){const e=t.map((e,t)=>({uid:`-${t+1}`,name:S(e),status:"done",url:e}));E(e)}else E([])},[j,k]);const q=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:ca,children:[n.jsx(i.Upload,{accept:o,listType:l,fileList:N,onPreview:async e=>{const t=e.url||e.preview,n=e.name||"",r=(e=>{const t=e.substring(e.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(t)?"image":[".txt",".json",".xml",".log"].includes(t)?"text":"none"})(n);y(n),w(r),"image"===r?(e.url||e.preview||!e.originFileObj||(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),v(e.url||e.preview),m(!0)):t?window.open(t,"_blank"):i.message.info("文件预览不可用")},onChange:({file:e,fileList:t})=>{var n,r;if(A(!0),"done"===e.status){if(null==(n=e.response)?void 0:n.data){i.message.success(`${e.name} 文件上传成功`);const n=t.map(t=>{var n;return t.uid===e.uid&&(null==(n=t.response)?void 0:n.data)?{...t,url:t.response.data,name:t.name}:t});E(n);const r=n.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(r[0]||void 0):null==q||q(r.length>0?r:void 0)}else i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),E(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 文件已移除`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(void 0):null==q||q(n.length>0?n:void 0)}else if("error"===e.status){i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(n[0]||void 0):null==q||q(n.length>0?n:void 0)}else E(t)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:o,onProgress:l}=e,a=1024*d*1024;if(o instanceof File&&o.size>a)return i.message.error(`文件大小不能超过 ${d}MB`),void r(new Error(`文件大小不能超过 ${d}MB`));const c=new FormData;c.append("file",o);const u=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;u&&c.append("orgId",u.toString());try{const e=await(async(e,t)=>{const n=f.getToken();try{return(await s.post("/api/sterilization-service/common/uploadFile",e,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==t?void 0:t.headers},onUploadProgress:null==t?void 0:t.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&l({percent:e.loaded/e.total*100})}});e&&e.data?n(e,o):r(new Error("上传成功但响应中缺少文件URL"),e)}catch(h){r(h)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:e=>!0,children:N.length>=(a||1)?null:n.jsx(i.Button,{icon:n.jsx(Je,{}),disabled:u,type:"primary",children:h})},c),n.jsxs(i.Modal,{visible:p,title:b,footer:null,onCancel:()=>{m(!1),v(""),w("none")},width:"image"===x?800:600,children:["image"===x&&n.jsx("img",{alt:"预览",style:{width:"100%"},src:g}),"text"===x&&n.jsx("pre",{style:{maxHeight:"500px",overflow:"auto",whiteSpace:"pre-wrap"},children:g})]})]})},da="_treeselectEllipsis_1cbt4_1",ha="_addonAfterSelect_1cbt4_19",fa="_customDisabled_1cbt4_23",pa=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}),ma=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,maxSize:a=5,disabled:c=!1,...u})=>{const[d,h]=r.useState(!1),[f,p]=r.useState(""),[m,g]=r.useState(""),[v,b]=r.useState([]),y=e=>e?e.startsWith("data:")?e:`data:image/png;base64,${e}`:"",x=e=>e?e.includes(",")?e.split(",")[1]:e:"";r.useEffect(()=>{if(e&&Array.isArray(e)&&e.length>0){const t=e.map((e,t)=>{let n="",r="";if("string"==typeof e)r=x(e),n=y(e);else if(Array.isArray(e)&&e.length>0&&"number"==typeof e[0]){const t=(e=>{try{const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return`data:image/png;base64,${btoa(n)}`}catch(t){return""}})(e);r=x(t),n=t}return{uid:`-${t}`,name:`image-${t}.png`,status:"done",url:n,thumbUrl:n,response:{data:r,url:n}}});b(t)}else b([])},[e]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{children:[n.jsx($e,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:v,onPreview:async e=>{let t=e.url;if(t||e.preview||!e.originFileObj?!t&&e.preview&&(t=e.preview):(e.preview=await pa(e.originFileObj),t=e.preview),!t)return void i.message.error("无法预览图片:未找到图片数据");p(t),h(!0);const n=e.name||"预览图片";g(n)},onChange:async({file:e,fileList:t})=>{var n,r,s;const o=e=>{var t,n;return(null==(t=e.response)?void 0:t.data)&&"string"==typeof e.response.data?x(e.response.data):(null==(n=e.response)?void 0:n.url)&&"string"==typeof e.response.url?x(e.response.url):e.url&&"string"==typeof e.url?x(e.url):e.preview&&"string"==typeof e.preview?x(e.preview):null};if("done"===e.status){const s=(null==(n=e.response)?void 0:n.data)||(null==(r=e.response)?void 0:r.url)||e.url||e.preview;if(s&&"string"==typeof s){i.message.success(`${e.name} 处理成功`);const n=y(s),r=t.map(t=>t.uid===e.uid?{...t,url:n,thumbUrl:n,response:{...e.response,data:x(s),url:n}}:t);b(r);const l=r.filter(e=>"done"===e.status).map(o).filter(Boolean);w(l.length>0?l:void 0)}else i.message.error(`${e.name} 处理失败:无法获取图片数据`),b(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 已移除`),b(t);const n=t.filter(e=>"done"===e.status).map(o).filter(Boolean);w(n.length>0?n:void 0)}else"error"===e.status?(i.message.error(`${e.name} 处理失败: ${(null==(s=e.error)?void 0:s.message)||"未知错误"}`),b(t)):b(t)},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e,o=1024*a*1024;if(r instanceof File&&r.size>o)return i.message.error(`图片大小不能超过 ${a}MB`),void(null==n||n(new Error(`图片大小不能超过 ${a}MB`)));try{s({percent:0});const e=await pa(r),n=x(e);s({percent:100});t({data:n,url:e,preview:e},r)}catch(l){i.message.error((null==l?void 0:l.message)||"图片处理失败"),n(l)}},beforeUpload:e=>{const t=1024*a*1024;if(e.size>t)return i.message.error(`图片大小不能超过 ${a}MB`),i.Upload.LIST_IGNORE;return!!e.type.startsWith("image/")||(i.message.error("只能上传图片文件"),i.Upload.LIST_IGNORE)},maxCount:l,disabled:c,...u,children:l&&v.length>=l?null:N}),n.jsx(i.Modal,{open:d,title:m,footer:null,onCancel:()=>h(!1),width:800,children:n.jsx("img",{alt:"preview",style:{width:"100%"},src:f})})]})},{RangePicker:ga}=i.DatePicker,{TextArea:va}=i.Input,ba=r.forwardRef((e,t)=>{var s;const{visible:c,mode:u,config:d,initialValues:h,onOk:p,onCancel:m,title:g,loading:v=!1,oneditFormChange:b,modalProps:y={},CustomModalFooter:x,tab:w=!1,validateConfig:N}=e,[E]=i.Form.useForm(),k="view"==u;r.useImperativeHandle(t,()=>({setFieldsValue:e=>{E.setFieldsValue(e)},getFieldsValue:()=>E.getFieldsValue()})),r.useEffect(()=>{if(c)if(E.resetFields(),"edit"!==u&&"view"!==u||!h){const e=[];w?d.forEach(t=>{t.children.forEach(t=>{var n,r;e.push({...t,defaultValue:t.defaultValue||(null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value)||t.defaultValue})})}):d.forEach(t=>{e.push({...t,defaultValue:t.defaultValue||t.defaultValue})}),(null==e?void 0:e.length)>0&&(null==e||e.forEach(e=>{E.setFieldsValue({[null==e?void 0:e.name]:null==e?void 0:e.defaultValue})})),L(E.getFieldValue("useOrgId")||O)}else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else{const e={...h};d.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else E.resetFields()},[c,u,h,E]),r.useEffect(()=>{if(c)if("edit"!==u&&"view"!==u||!h)L(E.getFieldValue("useOrgId")||O);else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else{const e={...h};d.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else E.resetFields()},[d]);const A=r.useCallback(e=>{if(w){for(const t of d)if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n.label}}else{const t=d.find(t=>t.name===e);if(t)return t.label}return e},[d,w]),S=r.useCallback((e,t)=>{const n=[];let r="";const i=new Set;return t&&Array.isArray(t)&&t.length>0&&(t.forEach(t=>{const s=e.filter(e=>t.includes(e.field)&&!i.has(e.field));if(s.length>1){const e=s.map(e=>A(e.field)).join("、")+"同时重复";s.forEach(t=>{n.push({name:t.field,errors:[e]}),i.add(t.field)}),r||(r=e)}else if(1===s.length){const e=s[0],t=A(e.field)+"重复";n.push({name:e.field,errors:[t]}),i.add(e.field),r||(r=t)}}),e.forEach(e=>{if(!i.has(e.field)){const t=A(e.field)+"重复";n.push({name:e.field,errors:[t]}),r||(r=t)}})),{errorFields:n,errorMessage:r||"验证失败"}},[A]),C=r.useMemo(()=>{if(!(null==N?void 0:N.realtime))return()=>{};const e=N.realtimeDelay||500;return l.debounce((e,t)=>{(async(e,t)=>{if(!N||!N.realtime)return;const{validateApi:n,validateFields:r,validateMethod:i="POST",validateParams:s,validateMessage:o="验证失败",union:l=!0,group:a}=N,c=t&&r.includes(t)?[t]:r,u=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;let d;if(s)d=s(e);else{const t={};c.forEach(n=>{void 0!==e[n]&&null!==e[n]&&""!==e[n]&&(t[n]=e[n])}),d={field:c,value:t,id:u,union:l?1:0,group:a}}const f="GET"===i?await _(d,n):await q(d,n);if(200===f.code&&Array.isArray(f.data)){const e=f.data.filter(e=>!0===e.value);if(f.data.forEach(e=>{!1===e.value&&E.setFields([{name:e.field,errors:[]}])}),e.length>0){let t=[];if(a&&Array.isArray(a)&&a.length>0){const n=S(e,a);t=n.errorFields}else if(l&&e.length>1){const n=e.map(e=>A(e.field)).join("、")+"同时重复";e.forEach(e=>{t.push({name:e.field,errors:[n]})})}else e.forEach(e=>{const n=A(e.field);t.push({name:e.field,errors:[n+"重复"]})});t.length>0&&E.setFields(t)}}})(e,t).catch(()=>{})},e)},[N]),j=(e,t)=>{if("name"==t.name&&!(null==E?void 0:E.getFieldValue("pyCode"))){const t=(n=e.target.value,a.pinyin(n,{pattern:"first",toneType:"none",type:"array",nonZh:"consecutive"}).join("").toUpperCase());E.setFieldsValue({pyCode:t})}var n},O=null==(s=f.getOrgInfo())?void 0:s.orgId,[T,L]=r.useState(O),I=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"deptSelect"===e.type):"deptSelect"===e.type),[d,w]),M=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"orgSelect"===e.type):"orgSelect"===e.type),[d,w]);r.useEffect(()=>{I&&U()},[T,I]),r.useEffect(()=>{M&&$()},[M]);const[B,D]=r.useState([]),[P,F]=r.useState([]),U=async()=>{const e=await q({orgId:T,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===e.code){const t=[{name:"通用",id:-1},...e.data||[]];D(t||[])}},$=async()=>{const e=await q({loginOrgId:O,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&F((null==e?void 0:e.data)||[])},z=e=>{if("view"!==u)return;const t=E.getFieldValue(e);if(null==t||""===t)return void i.message.warning("没有内容可复制");let n="";if("object"==typeof t)if(o.isDayjs(t))n=t.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(t))n=t.map(e=>o.isDayjs(e)?e.format("YYYY-MM-DD HH:mm:ss"):String(e)).join(", ");else if(t.addProvince){const e=[t.addProvince,t.addCity,t.addCounty,t.addStreet,t.address].filter(Boolean);n=e.join("-")}else n=JSON.stringify(t);else n=String(t);navigator.clipboard.writeText(n).then(()=>{i.message.success("已复制到剪贴板")}).catch(()=>{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),i.message.success("已复制到剪贴板")}catch(t){}document.body.removeChild(e)})},V=e=>{var t,r,s,o;const{type:l,name:a,placeholder:c,options:u,rules:d,...h}=e,f=k?"":c||`请输入${e.label}`,p=k?"":c||`请选择${e.label}`;switch(l){case"input":return n.jsx(i.Input,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a),onBlur:t=>j(t,e)});case"inputoption":return n.jsx(i.Input,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a),addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(r=null==(t=e.options)?void 0:t[0])?void 0:r.value,children:n.jsx(R,{disabled:k,options:e.options,allowClear:!k})})});case"inputnumberoption":return n.jsx(i.InputNumber,{className:ha,placeholder:f,addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(o=null==(s=e.options)?void 0:s[0])?void 0:o.value,children:n.jsx(R,{disabled:k,options:e.options,allowClear:!k})}),...h});case"password":return n.jsx(i.Input.Password,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)});case"rangePicker":return n.jsx(ga,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:[p||"开始日期",p||"结束日期"],...h,disabled:k||h.disabled,allowClear:!k});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:p,...h,disabled:k||h.disabled,allowClear:!k});case"InputNumber":return n.jsx(i.InputNumber,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)});case"Radio":return n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(i.Radio.Group,{style:{pointerEvents:k?"none":"auto",...h.style},disabled:k||h.disabled,options:u,...h})});case"Checkbox":return n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(i.Checkbox.Group,{style:{width:"100%",pointerEvents:k?"none":"auto",...h.style||{}},options:u,disabled:k||h.disabled,...h})});case"treeSelect":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(R,{className:da,allowClear:!k,style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:k||h.disabled})})})}case"select":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(R,{className:da,allowClear:!k,style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:k||h.disabled})})})}case"upload":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(nt,{value:e.value,...h},`upload_${e.name}`)})});case"file":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ua,{...h})})});case"textarea":return n.jsx(va,{rows:4,placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)});case"area":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(tt,{...h,disabled:k})})});case"richText":const{style:l,...c}=h;return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(aa,{style:l})})});case"doubleValue":return n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx(i.Form.Item,{name:e.firstLabel||"first",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:e.firstPlaceholder||`请输入${e.firstLabel||"最小值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.separator||"至"}),n.jsx(i.Form.Item,{name:e.secondLabel||"second",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:e.secondPlaceholder||`请输入${e.secondLabel||"最大值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.lastUnit})]});case"deptSelect":return n.jsx(R,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:B,disabled:k||h.disabled,...h});case"orgSelect":return n.jsx(R,{onChange:e=>{L(e)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:P,disabled:k||h.disabled,...h});case"uploadByte":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ma,{disabled:k||h.disabled,...h})})});default:return n.jsx(i.Input,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)})}},H=g||("add"===u?"新增":"edit"===u?"编辑":"查看"),K=e=>{const t=e.findIndex(e=>"upload"===e.type||"uploadByte"===e.type);if(-1===t||1===(e[t].uploadRowSpan||1))return n.jsx(i.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))});const r=e[t],s=r.colSpan||6,o=r.uploadRowSpan||1,l=e.slice(0,t),a=e.slice(t+1);let c=0,u=[];const d=[];for(const n of a){const e=n.colSpan||6;c+e>24?(u.length&&d.push(u),u=[n],c=e):(u.push(n),c+=e)}u.length&&d.push(u);const h=d.slice(0,o),f=d.slice(o);return n.jsxs(n.Fragment,{children:[l.length>0&&n.jsx(i.Row,{gutter:24,justify:"start",children:l.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))}),n.jsxs("div",{style:{display:"flex",alignItems:"flex-start"},children:[n.jsx("div",{style:{width:s/24*100+"%",flexShrink:0,paddingRight:12},children:n.jsx(i.Form.Item,{label:r.label,name:r.name,rules:r.rules,initialValue:r.defaultValue,className:k||r.disabled?fa:"",children:V(r)},r.name)}),n.jsx("div",{style:{flex:1,overflow:"hidden"},children:h.map((e,t)=>n.jsx(i.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))},t))})]}),f.map((e,t)=>n.jsx(i.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))},`below-${t}`))]})},W=()=>w?n.jsx(i.Tabs,{children:d.map(e=>n.jsx(i.Tabs.TabPane,{tab:e.label,children:K((null==e?void 0:e.children)||[])},e.label))}):K(d);return n.jsx(i.Modal,{title:H,open:c,onOk:async()=>{try{const e=await E.validateFields();N&&await(async e=>{var t,n,r,i,s,o;if(!N)return;const{validateApi:l,validateFields:a,validateMethod:c="POST",validateParams:u,validateMessage:d="验证失败",union:f=!1,group:p=[]}=N,m=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;if(u){const r=u(e),i="GET"===c?await _(r,l):await q(r,l);if(200!==i.code){const e=i.msg||d;throw new Error(e)}if(Array.isArray(i.data)){const e=i.data.filter(e=>!0===e.value);if(e.length>0){const t=e.map(e=>({name:e.field,errors:[d]}));throw E.setFields(t),new Error(d)}}else if(!1===i.data||!1===(null==(t=i.data)?void 0:t.valid)){const e=(null==(n=i.data)?void 0:n.message)||i.msg||d;throw new Error(e)}return}if(p&&p.length>0){const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0,group:p},s="GET"===c?await _(n,l):await q(n,l);if(200!==s.code){const e=s.msg||d;throw new Error(e)}if(Array.isArray(s.data)){const e=s.data.filter(e=>!0===e.value);if(e.length>0){const{errorFields:t,errorMessage:n}=S(e,p);throw E.setFields(t),new Error(n)}}else if(!1===s.data||!1===(null==(r=s.data)?void 0:r.valid)){const e=(null==(i=s.data)?void 0:i.message)||s.msg||d;throw new Error(e)}}else{const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0},r="GET"===c?await _(n,l):await q(n,l);if(200!==r.code){const e=r.msg||d;throw new Error(e)}if(Array.isArray(r.data)){const e=r.data.filter(e=>!0===e.value);if(e.length>0){let t=[],n=d;if(p&&Array.isArray(p)&&p.length>0){const r=S(e,p);t=r.errorFields,n=r.errorMessage}else if(f&&e.length>1){const r=e.map(e=>A(e.field));n=r.join("、")+"同时重复",t=e.map(e=>({name:e.field,errors:[n]}))}else t=e.map(e=>{const t=A(e.field);return{name:e.field,errors:[t+"重复"]}}),1===e.length&&(n=A(e[0].field)+"重复");throw E.setFields(t),new Error(n)}}else if(!1===r.data||!1===(null==(s=r.data)?void 0:s.valid)){const e=(null==(o=r.data)?void 0:o.message)||r.msg||d;throw new Error(e)}}})(e);const t={...e},n=[];w?d.forEach(e=>{e.children&&n.push(...e.children)}):n.push(...d),n.forEach(e=>{var n,r,i,s;if(void 0===e.defaultValue||void 0!==t[e.name]&&null!==t[e.name]||(t[e.name]=e.defaultValue),"datePicker"===e.type&&t[e.name])o.isDayjs(t[e.name])&&(t[e.name]=e.dateFormat?t[e.name].format(e.dateFormat):t[e.name].toISOString());else if("rangePicker"===e.type&&t[e.name])if("string"==typeof e.name&&e.name.includes("/")){const[n,r]=e.name.split("/");if(Array.isArray(t[e.name])&&2===t[e.name].length){const[i,s]=t[e.name],l=t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t;t[n]=l(i),t[r]=l(s),delete t[e.name]}}else Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t));if("select"===e.type&&e.labelName){const i=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t[e.name]}),s=i?i[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0;t[e.labelName]=s}if("treeSelect"===e.type&&e.multiple&&(t[e.name]=null==(i=t[e.name])?void 0:i.join(","),e.labelName)){const n=((null==(s=t[e.name])?void 0:s.split(","))||[]).map(t=>{var n,r;const i=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t});return i?i[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0}).filter(Boolean);t[e.labelName]=n.join(",")}if("Radio"===e.type&&e.options&&void 0!==t[e.name]&&null!==t[e.name]){const n=e.options.find(n=>n.value==t[e.name]);n&&"number"==typeof n.value&&(t[e.name]=Number(t[e.name]))}}),await p(t)}catch(e){(null==e?void 0:e.message)&&(i.message.error(e.message),(null==e?void 0:e.errorFields)&&E.setFields(e.errorFields))}},onCancel:m,width:y.width||800,confirmLoading:v,destroyOnClose:!0,maskClosable:!1,styles:{body:{maxHeight:"70vh",overflow:"auto",padding:"0px"}},footer:(e,{OkBtn:t,CancelBtn:r})=>n.jsxs(n.Fragment,{children:[x&&x(E.getFieldsValue()),n.jsx(r,{}),n.jsx(t,{})]}),...y,children:n.jsx(i.Form,{form:E,name:`modal_form_${u}`,layout:"vertical",onValuesChange:(e,t)=>{if(b&&b(e,t),null==N?void 0:N.realtime){const n=Object.keys(e)[0];C(t,n)}},children:n.jsx(W,{})})})}),ya="_container_18q8s_1",xa="_searchForm_18q8s_9",wa="_tableContainer_18q8s_15",Na="_pagination_18q8s_44",Ea="_selectedRow_18q8s_63",ka=r.forwardRef(({searchFormConfig:e,addFormConfig:t,tableColumns:s,URL:o,editText:a,viewText:c,delText:u,CustomOperations:d,classjson:h,postParams:f,proplist:p,topHeight:m,isnopage:g,PropOtherButton:v,CustomModalFooter:b,editdclickback:y,oneditFormChange:x,onSearchFormChange:w,addisdisabled:N={isdisabled:!1,message:""},tableHeight:E=150,limit:k={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:A,onRowClick:S,onDelete:C,tableId:j,isaddtab:O=!1,validateConfig:_,tableConfig:L,isReset:I=!1,isResetdefault:R=!1,actionDisabled:M,actionToolTips:D,notoken:P=!1,...F},U)=>{r.useImperativeHandle(U,()=>({getList:async()=>fe(),setFieldsValue:e=>{var t;null==(t=oe.current)||t.setFieldsValue(e)},getFieldsValue:()=>{var e;return null==(e=oe.current)?void 0:e.getFieldsValue()},reload:()=>{fe()},setCurrentRecord:e=>{Q(e)},getSearchFieldsValue:()=>{var e;return null==(e=he.current)?void 0:e.getFieldsValue()},setSearchFieldsValue:e=>{var t;null==(t=he.current)||t.setFieldsValue(e)}}));const[$,z]=r.useState(!1),[V,H]=r.useState([]),[K,W]=r.useState({current:1,pageSize:50,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}),[Z,G]=r.useState(!1),[Y,J]=r.useState("add"),[X,Q]=r.useState(null),[ee,te]=r.useState([]),[ne,re]=r.useState([]),[ie,se]=r.useState([]),oe=r.useRef(null),le=r.useRef(f),ae=r.useRef(K),ce=r.useRef(null),[ue,de]=r.useState(0),he=r.useRef(null);r.useEffect(()=>{le.current=f},[f]),r.useEffect(()=>{ae.current=K},[K]),r.useEffect(()=>{Z||Q(null)},[Z]);const fe=l.debounce(async e=>{var t,n;if(!(null==o?void 0:o.search))return;const r=he.current.getFieldsValue(),i={...null==(t=le.current)?void 0:t.searchParams,...e,pageNum:ae.current.current,pageSize:ae.current.pageSize,...r};g&&delete i.pageNum,g&&delete i.pageSize,z(!0);try{const e=P?T:q,t=await e(i,o.search);if(200===t.code){const e=(null==(n=null==t?void 0:t.data)?void 0:n.list)||(null==t?void 0:t.data),r=e.map(e=>(e.hasOwnProperty("addCountyCode")&&(e.alladdress={...e}),e)).map(e=>(e.alladdress={...e},e));H(r||[]),W(e=>{var n,r;return{...e,current:null==(n=null==t?void 0:t.data)?void 0:n.pageNum,total:null==(r=null==t?void 0:t.data)?void 0:r.total}})}else H([]),W(e=>({...e,total:0,current:1}))}catch(s){H([]),W(e=>({...e,total:0,current:1}))}finally{z(!1)}},100);r.useEffect(()=>{(null==o?void 0:o.search)&&fe()},[K.current,K.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(ce.current&&ie.length>0){const e=ce.current.offsetHeight;de(e)}},[ie]);const pe=r.useRef(null);r.useEffect(()=>{const e={title:"操作",key:"action",align:"center",width:A||150,fixed:"right",render:(e,t)=>{const r=M?M(t):{},s=D?D(t):{},l=r.edit||!1,h=r.view||!1,f=r.delete||!1,p=(e,t,r,s,o)=>{const l=e?n.jsx("span",{style:{color:"rgba(0,0,0,0.25)",cursor:"not-allowed",...o},children:r}):n.jsx("a",{onClick:s,style:o,children:r});return t?n.jsx(i.Tooltip,{title:t,children:l}):l};return n.jsx(n.Fragment,{children:n.jsxs(i.Space,{size:"small",ref:pe,children:["function"==typeof d?d(t):d,o.edit&&k.editLimit&&p(l,s.editTooltip,a||"编辑",()=>ge(t)),(o.view||o.edit)&&k.addLimit&&p(h,s.viewTooltip,c||"查看",()=>ve(t)),o.delete&&k.delLimit&&p(f,s.deleteTooltip,u||"删除",()=>be(t),{color:f?"rgba(0,0,0,0.25)":"#f5222d"})]})})}},t=o.edit||o.delete||o.view||d,r=[...s],l=t?[...r,e]:r;re(l)},[]),r.useEffect(()=>{e&&se(e)},[e]),r.useEffect(()=>{t&&te(t)},[t]);const me=()=>{Q(null),J("add"),G(!0),y&&y()},ge=e=>{Q(e),J("edit"),G(!0),y&&y(e)},ve=e=>{Q(e),J("view"),G(!0)},be=async e=>{o.delete&&i.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{z(!0);const t=P?T:q;if(200===(await t({id:e.id,...null==f?void 0:f.delParams},o.delete)).code){C&&C(e),i.message.success(`${u||"删除"}成功`);const t=K.current,n=K.pageSize,r=K.total-1;r>0&&(t-1)*n>=r&&t>1?(W(e=>({...e,current:e.current-1})),setTimeout(()=>{fe()},0)):fe()}}catch(t){}finally{z(!1)}}})},ye=window.parent!==window.self,xe={"--table-height":ye?`calc(100vh - ${ue}px - ${E}px + 39px)`:`calc(100vh - ${ue}px - ${E}px - 16px)`,height:ye?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:ya,style:xe,children:[ie.length>0||!m?n.jsx("div",{className:xa,ref:ce,children:n.jsx(B,{config:ie,onSearch:()=>{W(e=>({...e,current:1})),fe()},onReset:()=>{W(e=>({...e,current:1})),fe()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:v||(()=>o.add&&k.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(i.Tooltip,{title:N.isdisabled?N.message:"",children:n.jsx(i.Button,{type:"primary",onClick:me,disabled:N.isdisabled,children:"新建"})})})),ref:he,onSearchFormChange:(e,t)=>{w&&w(e,t)},isReset:I,isResetdefault:R})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:wa,style:{height:`calc(100% - ${ue}px-35px)`},children:[n.jsx(et,{page:K,virtual:g,tableId:j,scroll:{x:"1200px",y:"calc(100vh - 500px)"},onRowClick:(e,t)=>((e,t)=>{S&&S(e,t),Q(e)})(e,t),rowClassName:e=>e.id===(null==X?void 0:X.id)?Ea:"",columns:ne,dataSource:p||V,loading:$,pagination:!1,onChange:e=>{W(t=>({...t,current:e.current,pageSize:e.pageSize}))},rowKey:"id",...L,...F}),!g&&n.jsx("div",{className:Na,children:n.jsx(i.Pagination,{size:"small",onChange:(e,t)=>{W(n=>({...n,current:e,pageSize:t}))},...K,showQuickJumper:!1})})]}),n.jsx(ba,{validateConfig:_,CustomModalFooter:b,ref:oe,oneditFormChange:x,visible:Z,mode:Y,config:"view"===Y?ee.map(e=>({...e,disabled:!0})):ee,initialValues:X,onOk:async e=>{if(e.alladdress&&(e={...e,...e.alladdress}),"view"!==Y){z(!0);try{let t;const n=P?T:q;t="add"==Y?await n({...e,...null==f?void 0:f.addParams},o.add):await n({id:null==X?void 0:X.id,...e,...null==f?void 0:f.editParams},o.edit),200==t.code&&(i.message.success(("add"===Y?"添加":"更新")+"成功"),G(!1),fe())}catch(t){}finally{z(!1)}}else G(!1)},onCancel:()=>G(!1),title:(()=>{switch(Y){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:$,tab:O,modalProps:"view"===Y?{footer:[n.jsx(i.Button,{onClick:()=>G(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),Aa=r.memo(ka);exports.CommonPage=Aa,exports.CustomAdd=ba,exports.CustomForm=B,exports.CustomTable=et,exports.NomalSelect=R;
|
|
6
|
+
*/const J=W((Z||(Z=1,G=Y,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var i=arguments[t];i&&(e=r(e,n(i)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var i="";for(var s in n)e.call(n,s)&&n[s]&&(i=r(i,s));return i}function r(e,t){return t?e?e+" "+t:e+t:e}G.exports?(t.default=t,G.exports=t):window.classNames=t}()),Y.exports)),X=Math.round;function Q(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const ee=(e,t,n)=>0===n?e:e/100;function te(e,t){const n=t||255;return e>n?n:e<0?0:e}class ne{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(V(this,"isValid",!0),V(this,"r",0),V(this,"g",0),V(this,"b",0),V(this,"a",1),V(this,"_h",void 0),V(this,"_s",void 0),V(this,"_l",void 0),V(this,"_v",void 0),V(this,"_max",void 0),V(this,"_min",void 0),V(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof ne)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=te(e.r),this.g=te(e.g),this.b=te(e.b),this.a="number"==typeof e.a?te(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:X(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,i=e=>(n[e]-this[e])*r+this[e],s={r:X(i("r")),g:X(i("g")),b:X(i("b")),a:X(100*i("a"))/100};return this._c(s)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>X((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=X(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=X(100*this.getSaturation()),n=X(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=te(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=X(255*n);this.r=e,this.g=e,this.b=e}let i=0,s=0,o=0;const l=e/60,a=(1-Math.abs(2*n-1))*t,c=a*(1-Math.abs(l%2-1));l>=0&&l<1?(i=a,s=c):l>=1&&l<2?(i=c,s=a):l>=2&&l<3?(s=a,o=c):l>=3&&l<4?(s=c,o=a):l>=4&&l<5?(i=c,o=a):l>=5&&l<6&&(i=a,o=c);const u=n-a/2;this.r=X(255*(i+u)),this.g=X(255*(s+u)),this.b=X(255*(o+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const i=X(255*n);if(this.r=i,this.g=i,this.b=i,t<=0)return;const s=e/60,o=Math.floor(s),l=s-o,a=X(n*(1-t)*255),c=X(n*(1-t*l)*255),u=X(n*(1-t*(1-l))*255);switch(o){case 0:this.g=u,this.b=a;break;case 1:this.r=c,this.b=a;break;case 2:this.r=a,this.b=u;break;case 3:this.r=a,this.g=c;break;case 4:this.r=u,this.g=a;break;default:this.g=a,this.b=c}}fromHsvString(e){const t=Q(e,ee);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Q(e,ee);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Q(e,(e,t)=>t.includes("%")?X(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var re=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function ie(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function se(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function oe(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var le=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}le.primary=le[5];var ue="data-rc-order",de="data-rc-priority",he=new Map;function fe(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function pe(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function me(e){return Array.from((he.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function ge(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,i=t.priority,s=void 0===i?0:i,o=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(ue,o),l&&s&&a.setAttribute(de,"".concat(s)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=e;var c=pe(t),u=c.firstChild;if(r){if(l){var d=(t.styles||me(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(ue)))return!1;var t=Number(e.getAttribute(de)||0);return s>=t});if(d.length)return c.insertBefore(a,d[d.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=pe(n),i=me(r),s=ce(ce({},n),{},{styles:i});!function(e,t){var n=he.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=ge("",t),i=r.parentNode;he.set(e,i),e.removeChild(r)}}(r,s);var o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=pe(t);return(t.styles||me(n)).find(function(n){return n.getAttribute(fe(t))===e})}(t,s);if(o){var l,a,c;if(null!==(l=s.csp)&&void 0!==l&&l.nonce&&o.nonce!==(null===(a=s.csp)||void 0===a?void 0:a.nonce))o.nonce=null===(c=s.csp)||void 0===c?void 0:c.nonce;return o.innerHTML!==e&&(o.innerHTML=e),o}var u=ge(e,s);return u.setAttribute(fe(s),t),u}function be(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function ye(e){return function(e){return be(e)instanceof ShadowRoot}(e)?be(e):null}var xe={},we=[];function Ne(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)we.reduce(function(e,t){return t(null!=e?e:"","warning")},t)}function Ee(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)we.reduce(function(e,t){return t(null!=e?e:"","note")},t)}function ke(e,t,n){t||xe[n]||(e(!1,n),xe[n]=!0)}function Ae(e,t){ke(Ne,e,t)}function Se(e){return"object"===$(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===$(e.icon)||"function"==typeof e.icon)}function Ce(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,i=e[n];if("class"===n)t.className=i,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=i;return t},{})}function je(e,t,n){return n?r.createElement(e.tag,ce(ce({key:t},Ce(e.attrs)),n),(e.children||[]).map(function(n,r){return je(n,"".concat(t,"-").concat(e.tag,"-").concat(r))})):r.createElement(e.tag,ce({key:t},Ce(e.attrs)),(e.children||[]).map(function(n,r){return je(n,"".concat(t,"-").concat(e.tag,"-").concat(r))}))}function Oe(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new ne(e),i=r.toHsv(),s=5;s>0;s-=1){var o=new ne({h:ie(i,s,!0),s:se(i,s,!0),v:oe(i,s,!0)});n.push(o)}n.push(r);for(var l=1;l<=4;l+=1){var a=new ne({h:ie(i,l),s:se(i,l),v:oe(i,l)});n.push(a)}return"dark"===t.theme?re.map(function(e){var r=e.index,i=e.amount;return new ne(t.backgroundColor||"#141414").mix(n[r],i).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function qe(e){return e?Array.isArray(e)?e:[e]:[]}Ae.preMessage=function(e){we.push(e)},Ae.resetWarned=function(){xe={}},Ae.noteOnce=function(e,t){ke(Ee,e,t)};var _e=["icon","className","onClick","style","primaryColor","secondaryColor"],Te={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var Le=function(e){var t,n,i,s,o,l,a,c,d=e.icon,h=e.className,f=e.onClick,p=e.style,m=e.primaryColor,g=e.secondaryColor,v=H(e,_e),b=u.useRef(),y=Te;if(m&&(y={primaryColor:m,secondaryColor:g||Oe(m)}),t=b,n=r.useContext(D),i=n.csp,s=n.prefixCls,o=n.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",s&&(l=l.replace(/anticon/g,s)),o&&(l="@layer ".concat(o," {\n").concat(l,"\n}")),r.useEffect(function(){var e=ye(t.current);ve(l,"@ant-design-icons",{prepend:!o,csp:i,attachTo:e})},[]),a=Se(d),c="icon should be icon definiton, but got ".concat(d),Ae(a,"[@ant-design/icons] ".concat(c)),!Se(d))return null;var x=d;return x&&"function"==typeof x.icon&&(x=ce(ce({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),je(x.icon,"svg-".concat(x.name),ce(ce({className:h,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},v),{},{ref:b}))};function Ie(e){var t=U(qe(e),2),n=t[0],r=t[1];return Le.setTwoToneColors({primaryColor:n,secondaryColor:r})}Le.displayName="IconReact",Le.getTwoToneColors=function(){return ce({},Te)},Le.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;Te.primaryColor=t,Te.secondaryColor=n||Oe(t),Te.calculated=!!n};var Re=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Ie(le.primary);var Me=u.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,s=e.rotate,o=e.tabIndex,l=e.onClick,a=e.twoToneColor,c=H(e,Re),d=u.useContext(D),h=d.prefixCls,f=void 0===h?"anticon":h,p=d.rootClassName,m=J(p,f,V(V({},"".concat(f,"-").concat(r.name),!!r.name),"".concat(f,"-spin"),!!i||"loading"===r.name),n),g=o;void 0===g&&l&&(g=-1);var v=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,b=U(qe(a),2),y=b[0],x=b[1];return u.createElement("span",P({role:"img","aria-label":r.name},c,{ref:t,tabIndex:g,onClick:l,className:m}),u.createElement(Le,{icon:r,primaryColor:y,secondaryColor:x,style:v}))});Me.displayName="AntdIcon",Me.getTwoToneColor=function(){var e=Le.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Me.setTwoToneColor=Ie;var Be={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},De=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Be}))},Pe=u.forwardRef(De);"production"!==process.env.NODE_ENV&&(Pe.displayName="DownOutlined");var Fe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},Ue=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Fe}))},$e=u.forwardRef(Ue);"production"!==process.env.NODE_ENV&&($e.displayName="PlusOutlined");var ze={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},Ve=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:ze}))},He=u.forwardRef(Ve);"production"!==process.env.NODE_ENV&&(He.displayName="RightOutlined");var Ke={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},We=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Ke}))},Ze=u.forwardRef(We);"production"!==process.env.NODE_ENV&&(Ze.displayName="SettingOutlined");var Ge={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},Ye=function(e,t){return u.createElement(Me,P({},e,{ref:t,icon:Ge}))},Je=u.forwardRef(Ye);"production"!==process.env.NODE_ENV&&(Je.displayName="UploadOutlined");const{Option:Xe}=i.Select,Qe=e=>(t,n)=>{const r=null==t?void 0:t[e],i=null==n?void 0:n[e],s=null==r||""===r,o=null==i||""===i;if(s&&o)return 0;if(s)return 1;if(o)return-1;const l=Number(r),a=Number(i);if(!isNaN(l)&&!isNaN(a))return l-a;const c=String(r),u=String(i);return c.localeCompare(u,"zh-CN",{numeric:!0,sensitivity:"base"})},et=({columns:e,dataSource:t,pagination:s,tableId:o,size:a="middle",onRowClick:c,page:u,showTableConfig:d=!0,...h})=>{var p;const[m,g]=r.useState([]),[v,b]=r.useState([]),[y,x]=r.useState(!1),[w,N]=r.useState([]),[E,k]=r.useState([]),[A,C]=r.useState([]),[j]=i.Form.useForm(),[O,q]=r.useState([]),[_,T]=r.useState({field:null,order:null}),[L,I]=r.useState([]),R=f.getUserInfo(),M=null==(p=f.getOrgInfo())?void 0:p.orgId,B=r.useRef(void 0),D=r.useRef(void 0),P=r.useMemo(()=>(null==e?void 0:e.map(e=>e.dataIndex||e.key).join(","))||"",[e]),F=r.useCallback(async()=>{var t,n,r;const i=(null==e?void 0:e.map((e,t)=>({key:e.key||e.dataIndex||`col-${t}`,title:e.title,dataIndex:e.dataIndex,displayTitle:"string"==typeof e.title?e.title:`列 ${t+1}`,headerAlignment:e.align||"left",contentAlignment:e.align||"left",dataFormat:"字符串",width:e.width||100,enabled:!1!==e.enabled,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:t+1,render:e.render,fixed:e.fixed,originalColumn:{...e}})))||[];if(k(i),e.length>1)try{if(o){const l=await(s={userId:R.userId,tableId:o||"",orgId:M},S("/platform/business/common/getTableConfigByUser",s));if(null==(t=null==l?void 0:l.data)?void 0:t.content){const t=null==(r=JSON.parse(null==(n=null==l?void 0:l.data)?void 0:n.content))?void 0:r.map(t=>{var n;const r=null==(n=e.find(e=>e.key===t.key))?void 0:n.render;return{...t,render:r,originalColumn:{...t.originalColumn,render:r}}});N(t),C(t)}else N(i),C(i)}else N(i),C(i)}catch(l){N(i),C(i)}else N(i),C(i);var s},[e,o,R.userId]),U=r.useMemo(()=>l.debounce(F,100),[F]);r.useEffect(()=>{(B.current!==o||D.current!==P)&&(B.current=o,D.current=P,U())},[o,P,U]),r.useEffect(()=>{const t=w.filter(e=>e.enabled).sort((e,t)=>e.sort-t.sort).map(t=>{const n=e.find(e=>(e.key||e.dataIndex)===t.key),r={...t.originalColumn,...n,key:t.key,title:t.displayTitle,dataIndex:t.dataIndex,align:t.contentAlignment,width:Number(t.width),onHeaderCell:e=>{var r;const i=(null==n?void 0:n.onHeaderCell)||(null==(r=t.originalColumn)?void 0:r.onHeaderCell),s=i?i(e):{};return{...s,style:{...s.style,textAlign:t.headerAlignment}}}};return t.allowSorting&&t.dataIndex&&(r.sorter=!0,r.sortDirections=["ascend","descend"],r.sortOrder=_.field===t.dataIndex?_.order:null),r}),s=[...d?[{title:n.jsxs(i.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(i.Tooltip,{title:"表格配置",children:n.jsx(Ze,{onClick:()=>x(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(e,t,r)=>{const s=e||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+r+1||r+1;return n.jsx(i.Tooltip,{title:String(s),children:n.jsx("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})})}}]:[],...t].map(e=>{const t=e.render;return{...e,render:(s,o,l)=>{const a=t?t(s,o,l):s;return r.isValidElement(a)?n.jsx("div",{style:{textAlign:e.align,width:"100%"},children:a}):"object"==typeof a&&null!==a?"":n.jsx(i.Tooltip,{title:null!=a?String(a):"",children:n.jsx("div",{style:{display:"block",width:"100%",textAlign:e.align,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",paddingLeft:"left"===e.align?0:void 0,paddingRight:"right"===e.align?0:void 0},children:null!=a?a:""})})}}});g(s)},[w,d,u,_,e]),r.useEffect(()=>{const e=(t,n,r)=>t.map((t,i)=>{const s=`${n}.${i+1}`,o={...t,parentId:(null==t?void 0:t.parentId)||r,id:(null==t?void 0:t.id)||`${r}-${i+1}`,INDEX:s};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(o.children=e(t.children,s,o.id)),o}),n=(t||[]).map((t,n)=>{const r=(null==t?void 0:t.INDEX)||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+n+1||n+1,i={...t,parentId:(null==t?void 0:t.parentId)||null,id:(null==t?void 0:t.id)||n+1,INDEX:r};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(i.children=e(t.children,r,i.id)),i});if(q(n.map(e=>e.id)),I(n),_.field&&_.order&&n.length>0){const e=[...n].sort((e,t)=>{const n=Qe(_.field)(e,t);return"descend"===_.order?-n:n});b(e)}else b(n)},[t]);const $=r.useRef(null),z=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(e,t)=>n.jsx(i.Input,{size:"small",defaultValue:e,onBlur:e=>V(t.key,"displayTitle",e.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>V(t.key,"headerAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"内容对齐",dataIndex:"contentAlignment",key:"contentAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>V(t.key,"contentAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"数据格式",dataIndex:"dataFormat",key:"dataFormat",render:(e,t)=>n.jsxs(i.Select,{size:"small",defaultValue:e,style:{width:80},onChange:e=>V(t.key,"dataFormat",e),children:[n.jsx(Xe,{value:"字符串",children:"字符串"}),n.jsx(Xe,{value:"数字",children:"数字"}),n.jsx(Xe,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>V(t.key,"width",e.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>V(t.key,"enabled",e)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>V(t.key,"allowSorting",e)})},{title:"显示顺序",dataIndex:"sort",key:"sort",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>V(t.key,"sort",e.target.value)})}],V=(e,t,n)=>{C(r=>r.map(r=>r.key===e?{...r,[t]:n}:r))},H=async()=>{try{const t=await(e={tableId:o||"",userId:R.userId,content:JSON.stringify(A)},S("/platform/business/common/saveUserTableConfig",e));N(A),200===(null==t?void 0:t.code)&&(i.message.success("保存成功"),U())}catch(t){}var e},K=()=>{x(!1)},W=(e,t=!1)=>{q(t?O.filter(t=>t!==(null==e?void 0:e.id)):[...O,null==e?void 0:e.id])},Z=r.useCallback(e=>{const{field:t,order:n}=e,r=L||[];if(!t||!n)return T({field:null,order:null}),void b([...r]);if(T({field:t,order:n}),0===r.length)return void b([]);const i=[...r].sort((e,r)=>{const i=Qe(t)(e,r);return"descend"===n?-i:i});b(i)},[L]),G=r.useCallback((e,t,n,r)=>{"sort"!==(null==r?void 0:r.action)?(h.onChange&&h.onChange(e,t,n,r),h.handleTableChange&&h.handleTableChange(e,t,n)):Z(n)},[Z,h.onChange,h.handleTableChange]),Y=r.useMemo(()=>{if(!1===s)return!1;if(s&&"object"==typeof s){const e={pageSize:10,...s};return Array.isArray(e.pageSizeOptions)&&(e.pageSizeOptions=e.pageSizeOptions.filter(e=>null!=e)),e}return s},[s]);return n.jsxs(i.ConfigProvider,{theme:{components:{Table:{bodySortBg:"transparent",headerSortActiveBg:"#2569D8",headerSortHoverBg:"#2569D8"}}},children:[n.jsx(i.Table,{...h,columns:m,dataSource:v,bordered:!0,rowKey:"id",indentSize:24,pagination:Y,size:"small",onChange:G,onRow:(e,t)=>{const n=h.onRow?h.onRow(e,t):{};return{...n,onClick:t=>{var r;c&&c(e,t),null==(r=null==n?void 0:n.onClick)||r.call(n,t)}}},expandable:{expandedRowKeys:O,expandIcon:({expanded:e,onExpand:t,record:r})=>{var i;if((null==(i=null==r?void 0:r.children)?void 0:i.length)>0){const i={fontSize:"14px",color:"rgba(0, 0, 0, 0.45)",cursor:"pointer",position:"absolute",left:`${18+8*((null==r?void 0:r.INDEX)?String(r.INDEX).split(".").length-1:0)}px`,top:"13px"};return e?n.jsx(Pe,{onClick:e=>{t(r,e),W(r,!0)},style:i}):n.jsx(He,{onClick:e=>{t(r,e),W(r,!1)},style:i})}return null}}}),n.jsx(i.Modal,{title:"表格设置",visible:y,footer:[n.jsx(i.Button,{onClick:async()=>{var e;200===(await(e={userId:R.userId,tableId:o||""},S("/platform/business/common/restoreDefaultTableConfig",e))).code&&(N(E),C(E),x(!1),i.message.success("重置成功"))},children:"重置"},"reset"),n.jsx(i.Button,{onClick:K,children:"取消"},"cancel"),n.jsx(i.Button,{onClick:async()=>{try{const t=await(e={orgId:M,tableId:o||"",content:JSON.stringify(A)},S("/platform/business/common/saveCurOrgTableConfig",e));N(A),200===(null==t?void 0:t.code)&&(i.message.success("保存为机构配置成功"),x(!1))}catch(t){}var e},children:"保存为该机构配置"},"saveOrg"),n.jsx(i.Button,{type:"primary",onClick:()=>{x(!1),H()},children:"保存"},"submit")],onCancel:K,width:1e3,destroyOnClose:!0,maskClosable:!1,children:n.jsx(i.Spin,{spinning:!1,children:n.jsx(i.Form,{form:j,component:!1,children:n.jsx(i.Table,{ref:$,columns:z,dataSource:A.filter(e=>!e.isBuiltIn).sort((e,t)=>e.sort-t.sort),rowKey:"key",size:"small",pagination:!1,bordered:!0,scroll:{y:400}})})})})]})},tt=({label:e,id:t,value:s,onChange:o,disabled:l=!1})=>{const[a,c]=r.useState([]),[u,d]=r.useState(void 0),[h,f]=r.useState(!1),[p,m]=r.useState(void 0),[g,v]=r.useState(void 0),[b,y]=r.useState(void 0),[x,w]=r.useState(void 0),[N,E]=r.useState([]),[k,A]=r.useState(void 0),[S,C]=r.useState(!1),[j,O]=r.useState([]),[_,T]=r.useState(void 0),[L,I]=r.useState(!1),[R,M]=r.useState([]),[B,D]=r.useState(void 0),[P,F]=r.useState(!1),[U,$]=r.useState(""),[z,V]=r.useState({}),H=r.useRef(!1),K=r.useRef(!1),W=r.useCallback(e=>{o&&o(e)},[o]),Z=r.useCallback(async(e,t)=>{switch(e){case 1:f(!0);break;case 2:C(!0);break;case 3:I(!0);break;case 4:F(!0)}try{const n=await q({level:e,parent:t.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(e=>({value:e.code,label:e.name})):[]}catch(n){return[]}finally{switch(e){case 1:f(!1);break;case 2:C(!1);break;case 3:I(!1);break;case 4:F(!1)}}},[]);r.useEffect(()=>{Z(1,"0").then(e=>{c(e)})},[Z]),r.useEffect(()=>{s&&!H.current&&(H.current=!0,V(s),d(s.addProvinceCode),m(s.addProvince),s.addProvinceCode&&Z(2,s.addProvinceCode).then(e=>{E(e),A(s.addCityCode),v(s.addCity),s.addCityCode&&Z(3,s.addCityCode).then(e=>{O(e),T(s.addCountyCode),y(s.addCounty),s.addCountyCode&&Z(4,s.addCountyCode).then(e=>{M(e),D(s.addStreetCode),w(s.addStreet),$(s.address||"")})})}))},[s,Z]),r.useEffect(()=>{u?Z(2,u).then(e=>{E(e)}):(v(void 0),y(void 0),w(void 0),m(void 0),$(""),A(void 0),E([]),T(void 0),O([]),D(void 0),M([]))},[u,Z]),r.useEffect(()=>{k?Z(3,k).then(e=>{O(e)}):(T(void 0),O([]),D(void 0),M([]),$(""))},[k,Z]),r.useEffect(()=>{_?Z(4,_).then(e=>{M(e)}):(D(void 0),M([]),$(""))},[_,Z]),r.useEffect(()=>{H.current&&(K.current=!0,W({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:b,addCountyCode:_,addStreet:x,addStreetCode:B,address:U}),setTimeout(()=>{K.current=!1},0))},[p,g,b,u,k,_,B,x,U,W]);return n.jsxs("div",{children:[" ",n.jsxs(i.Space,{wrap:!0,id:t,children:[" ",n.jsx(i.Select,{style:{minWidth:100},options:a,value:u,onChange:e=>{var t;e===u&&void 0!==e||(d(e),m(null==(t=a.find(t=>t.value===e))?void 0:t.label),A(void 0),v(void 0),E([]),T(void 0),y(void 0),O([]),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择省",loading:h,disabled:l,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:N,value:k,onChange:e=>{var t;e===k&&void 0!==e||(A(e),v(null==(t=N.find(t=>t.value===e))?void 0:t.label),T(void 0),y(void 0),O([]),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择市",loading:S,disabled:l||!u||h,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:j,value:_,onChange:e=>{var t;e===_&&void 0!==e||(T(e),y(null==(t=j.find(t=>t.value===e))?void 0:t.label),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择区/县",loading:L,disabled:l||!k||S,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:R,value:B,onChange:e=>{var t;e===B&&void 0!==e||(D(e),w(null==(t=R.find(t=>t.value===e))?void 0:t.label),$(""))},placeholder:"请选择乡/镇",loading:P,disabled:l||!_||L,allowClear:!0}),n.jsx(i.Input,{placeholder:"请输入详细地址",disabled:l||!_,value:U,onChange:e=>$(e.target.value)})]})]})},nt=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,key:a,disabled:c=!1})=>{const[u,d]=r.useState(!1),[h,f]=r.useState(""),[p,m]=r.useState(""),[g,v]=r.useState([]);r.useEffect(()=>{v(e?[{uid:"-1",name:"image.png",status:"done",url:e}]:[])},[e]);const b=r.useCallback(e=>{t&&t(e)},[t]),y=n.jsxs("div",{children:[n.jsx($e,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:g,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),f(e.url||e.preview),d(!0),m(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n,r;if(v(t),"done"===e.status){const r=null==(n=e.response)?void 0:n.data;r?(i.message.success(`${e.name} 文件上传成功`),null==b||b(r)):(i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),v(t.filter(t=>t.uid!==e.uid)))}else"removed"===e.status?(i.message.success(`${e.name} 文件已移除`),null==b||b(void 0)):"error"===e.status&&(i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),null==b||b(void 0))},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e;if(r instanceof File&&r.size>8388608)return i.message.error("文件大小不能超过 8MB"),void(null==n||n(new Error("文件大小不能超过 8MB")));const o=new FormData;o.append("file",r);try{const e=await(l=o,a={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&s({percent:e.loaded/e.total*100})}},S("/platform/general/upload",l,a));e&&e.data?(null==b||b(e.data),t(e,r)):n(new Error("上传成功但响应中缺少图片URL"),e)}catch(c){n(c)}var l,a},maxCount:l,disabled:c,onRemove:e=>!0,children:g.length>=(l||1)?null:y},a),n.jsx(i.Modal,{visible:u,title:p,footer:null,onCancel:()=>d(!1),children:n.jsx("img",{alt:"example",style:{width:"100%"},src:h})})]})};var rt="object"==typeof global&&global&&global.Object===Object&&global,it="object"==typeof self&&self&&self.Object===Object&&self,st=rt||it||Function("return this")(),ot=st.Symbol,lt=Object.prototype,at=lt.hasOwnProperty,ct=lt.toString,ut=ot?ot.toStringTag:void 0;var dt=Object.prototype.toString;var ht=ot?ot.toStringTag:void 0;function ft(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ht&&ht in Object(e)?function(e){var t=at.call(e,ut),n=e[ut];try{e[ut]=void 0;var r=!0}catch(s){}var i=ct.call(e);return r&&(t?e[ut]=n:delete e[ut]),i}(e):function(e){return dt.call(e)}(e)}function pt(e){return null!=e&&"object"==typeof e}var mt=Array.isArray;function gt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function vt(e){return e}function bt(e){if(!gt(e))return!1;var t=ft(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var yt,xt=st["__core-js_shared__"],wt=(yt=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+yt:"";var Nt=Function.prototype.toString;function Et(e){if(null!=e){try{return Nt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var kt=/^\[object .+?Constructor\]$/,At=Function.prototype,St=Object.prototype,Ct=At.toString,jt=St.hasOwnProperty,Ot=RegExp("^"+Ct.call(jt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qt(e){return!(!gt(e)||(t=e,wt&&wt in t))&&(bt(e)?Ot:kt).test(Et(e));var t}function _t(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return qt(n)?n:void 0}var Tt=_t(st,"WeakMap"),Lt=Object.create,It=function(){function e(){}return function(t){if(!gt(t))return{};if(Lt)return Lt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Rt=Date.now;var Mt,Bt,Dt,Pt=function(){try{var e=_t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Ft=Pt?function(e,t){return Pt(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:vt,Ut=(Mt=Ft,Bt=0,Dt=0,function(){var e=Rt(),t=16-(e-Dt);if(Dt=e,t>0){if(++Bt>=800)return arguments[0]}else Bt=0;return Mt.apply(void 0,arguments)});var $t=/^(?:0|[1-9]\d*)$/;function zt(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&$t.test(e))&&e>-1&&e%1==0&&e<t}function Vt(e,t,n){"__proto__"==t&&Pt?Pt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ht(e,t){return e===t||e!=e&&t!=t}var Kt=Object.prototype.hasOwnProperty;function Wt(e,t,n){var r=e[t];Kt.call(e,t)&&Ht(r,n)&&(void 0!==n||t in e)||Vt(e,t,n)}var Zt=Math.max;function Gt(e,t){return Ut(function(e,t,n){return t=Zt(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=Zt(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,l)}}(e,t,vt),e+"")}function Yt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Jt(e){return null!=e&&Yt(e.length)&&!bt(e)}var Xt=Object.prototype;function Qt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Xt)}function en(e){return pt(e)&&"[object Arguments]"==ft(e)}var tn=Object.prototype,nn=tn.hasOwnProperty,rn=tn.propertyIsEnumerable,sn=en(function(){return arguments}())?en:function(e){return pt(e)&&nn.call(e,"callee")&&!rn.call(e,"callee")};var on="object"==typeof exports&&exports&&!exports.nodeType&&exports,ln=on&&"object"==typeof module&&module&&!module.nodeType&&module,an=ln&&ln.exports===on?st.Buffer:void 0,cn=(an?an.isBuffer:void 0)||function(){return!1},un={};function dn(e){return function(t){return e(t)}}un["[object Float32Array]"]=un["[object Float64Array]"]=un["[object Int8Array]"]=un["[object Int16Array]"]=un["[object Int32Array]"]=un["[object Uint8Array]"]=un["[object Uint8ClampedArray]"]=un["[object Uint16Array]"]=un["[object Uint32Array]"]=!0,un["[object Arguments]"]=un["[object Array]"]=un["[object ArrayBuffer]"]=un["[object Boolean]"]=un["[object DataView]"]=un["[object Date]"]=un["[object Error]"]=un["[object Function]"]=un["[object Map]"]=un["[object Number]"]=un["[object Object]"]=un["[object RegExp]"]=un["[object Set]"]=un["[object String]"]=un["[object WeakMap]"]=!1;var hn="object"==typeof exports&&exports&&!exports.nodeType&&exports,fn=hn&&"object"==typeof module&&module&&!module.nodeType&&module,pn=fn&&fn.exports===hn&&rt.process,mn=function(){try{var e=fn&&fn.require&&fn.require("util").types;return e||pn&&pn.binding&&pn.binding("util")}catch(t){}}(),gn=mn&&mn.isTypedArray,vn=gn?dn(gn):function(e){return pt(e)&&Yt(e.length)&&!!un[ft(e)]},bn=Object.prototype.hasOwnProperty;function yn(e,t){var n=mt(e),r=!n&&sn(e),i=!n&&!r&&cn(e),s=!n&&!r&&!i&&vn(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!t&&!bn.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||zt(c,a))||l.push(c);return l}function xn(e,t){return function(n){return e(t(n))}}var wn=xn(Object.keys,Object),Nn=Object.prototype.hasOwnProperty;function En(e){return Jt(e)?yn(e):function(e){if(!Qt(e))return wn(e);var t=[];for(var n in Object(e))Nn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var kn=Object.prototype.hasOwnProperty;function An(e){if(!gt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Qt(e),n=[];for(var r in e)("constructor"!=r||!t&&kn.call(e,r))&&n.push(r);return n}function Sn(e){return Jt(e)?yn(e,!0):An(e)}var Cn=_t(Object,"create");var jn=Object.prototype.hasOwnProperty;var On=Object.prototype.hasOwnProperty;function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function _n(e,t){for(var n=e.length;n--;)if(Ht(e[n][0],t))return n;return-1}qn.prototype.clear=function(){this.__data__=Cn?Cn(null):{},this.size=0},qn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qn.prototype.get=function(e){var t=this.__data__;if(Cn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return jn.call(t,e)?t[e]:void 0},qn.prototype.has=function(e){var t=this.__data__;return Cn?void 0!==t[e]:On.call(t,e)},qn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Cn&&void 0===t?"__lodash_hash_undefined__":t,this};var Tn=Array.prototype.splice;function Ln(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ln.prototype.clear=function(){this.__data__=[],this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=_n(t,e);return!(n<0)&&(n==t.length-1?t.pop():Tn.call(t,n,1),--this.size,!0)},Ln.prototype.get=function(e){var t=this.__data__,n=_n(t,e);return n<0?void 0:t[n][1]},Ln.prototype.has=function(e){return _n(this.__data__,e)>-1},Ln.prototype.set=function(e,t){var n=this.__data__,r=_n(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var In=_t(st,"Map");function Rn(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(In||Ln),string:new qn}},Mn.prototype.delete=function(e){var t=Rn(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Rn(this,e).get(e)},Mn.prototype.has=function(e){return Rn(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Rn(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var Bn=xn(Object.getPrototypeOf,Object),Dn=Function.prototype,Pn=Object.prototype,Fn=Dn.toString,Un=Pn.hasOwnProperty,$n=Fn.call(Object);function zn(e){var t=this.__data__=new Ln(e);this.size=t.size}zn.prototype.clear=function(){this.__data__=new Ln,this.size=0},zn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},zn.prototype.get=function(e){return this.__data__.get(e)},zn.prototype.has=function(e){return this.__data__.has(e)},zn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ln){var r=n.__data__;if(!In||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(r)}return n.set(e,t),this.size=n.size,this};var Vn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Hn=Vn&&"object"==typeof module&&module&&!module.nodeType&&module,Kn=Hn&&Hn.exports===Vn?st.Buffer:void 0,Wn=Kn?Kn.allocUnsafe:void 0;function Zn(e,t){if(t)return e.slice();var n=e.length,r=Wn?Wn(n):new e.constructor(n);return e.copy(r),r}var Gn=Object.prototype.propertyIsEnumerable,Yn=Object.getOwnPropertySymbols,Jn=Yn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(Yn(e),function(t){return Gn.call(e,t)}))}:function(){return[]};function Xn(e){return function(e,t,n){var r=t(e);return mt(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,En,Jn)}var Qn=_t(st,"DataView"),er=_t(st,"Promise"),tr=_t(st,"Set"),nr="[object Map]",rr="[object Promise]",ir="[object Set]",sr="[object WeakMap]",or="[object DataView]",lr=Et(Qn),ar=Et(In),cr=Et(er),ur=Et(tr),dr=Et(Tt),hr=ft;(Qn&&hr(new Qn(new ArrayBuffer(1)))!=or||In&&hr(new In)!=nr||er&&hr(er.resolve())!=rr||tr&&hr(new tr)!=ir||Tt&&hr(new Tt)!=sr)&&(hr=function(e){var t=ft(e),n="[object Object]"==t?e.constructor:void 0,r=n?Et(n):"";if(r)switch(r){case lr:return or;case ar:return nr;case cr:return rr;case ur:return ir;case dr:return sr}return t});var fr=Object.prototype.hasOwnProperty;var pr=st.Uint8Array;function mr(e){var t=new e.constructor(e.byteLength);return new pr(t).set(new pr(e)),t}var gr=/\w*$/;var vr=ot?ot.prototype:void 0,br=vr?vr.valueOf:void 0;function yr(e,t){var n=t?mr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function xr(e,t,n){var r,i,s,o,l,a=e.constructor;switch(t){case"[object ArrayBuffer]":return mr(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return l=mr((o=e).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return yr(e,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(s=new(i=e).constructor(i.source,gr.exec(i))).lastIndex=i.lastIndex,s;case"[object Symbol]":return r=e,br?Object(br.call(r)):{}}}function wr(e){return"function"!=typeof e.constructor||Qt(e)?{}:It(Bn(e))}var Nr=mn&&mn.isMap,Er=Nr?dn(Nr):function(e){return pt(e)&&"[object Map]"==hr(e)};var kr=mn&&mn.isSet,Ar=kr?dn(kr):function(e){return pt(e)&&"[object Set]"==hr(e)},Sr="[object Arguments]",Cr="[object Function]",jr="[object Object]",Or={};function qr(e,t,n,r,i,s){var o,l=1&t;if(void 0!==o)return o;if(!gt(e))return e;var a=mt(e);if(a)o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&fr.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=hr(e),u=c==Cr||"[object GeneratorFunction]"==c;if(cn(e))return Zn(e,l);if(c==jr||c==Sr||u&&!i)o=u?{}:wr(e);else{if(!Or[c])return i?e:{};o=xr(e,c,l)}}s||(s=new zn);var d=s.get(e);if(d)return d;s.set(e,o),Ar(e)?e.forEach(function(r){o.add(qr(r,t,n,r,e,s))}):Er(e)&&e.forEach(function(r,i){o.set(i,qr(r,t,n,i,e,s))});var h=a?void 0:Xn(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(h||e,function(r,i){h&&(r=e[i=r]),Wt(o,i,qr(r,t,n,i,e,s))}),o}Or[Sr]=Or["[object Array]"]=Or["[object ArrayBuffer]"]=Or["[object DataView]"]=Or["[object Boolean]"]=Or["[object Date]"]=Or["[object Float32Array]"]=Or["[object Float64Array]"]=Or["[object Int8Array]"]=Or["[object Int16Array]"]=Or["[object Int32Array]"]=Or["[object Map]"]=Or["[object Number]"]=Or[jr]=Or["[object RegExp]"]=Or["[object Set]"]=Or["[object String]"]=Or["[object Symbol]"]=Or["[object Uint8Array]"]=Or["[object Uint8ClampedArray]"]=Or["[object Uint16Array]"]=Or["[object Uint32Array]"]=!0,Or["[object Error]"]=Or[Cr]=Or["[object WeakMap]"]=!1;function _r(e){return qr(e,5)}function Tr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Mn;++t<n;)this.add(e[t])}function Lr(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}Tr.prototype.add=Tr.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Tr.prototype.has=function(e){return this.__data__.has(e)};function Ir(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e),u=s.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,f=2&n?new Tr:void 0;for(s.set(e,t),s.set(t,e);++d<l;){var p=e[d],m=t[d];if(r)var g=o?r(m,p,d,t,e,s):r(p,m,d,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(f){if(!Lr(t,function(e,t){if(o=t,!f.has(o)&&(p===e||i(p,e,n,r,s)))return f.push(t);var o})){h=!1;break}}else if(p!==m&&!i(p,m,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Rr(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Mr(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Br=ot?ot.prototype:void 0,Dr=Br?Br.valueOf:void 0;var Pr=Object.prototype.hasOwnProperty;var Fr="[object Arguments]",Ur="[object Array]",$r="[object Object]",zr=Object.prototype.hasOwnProperty;function Vr(e,t,n,r,i,s){var o=mt(e),l=mt(t),a=o?Ur:hr(e),c=l?Ur:hr(t),u=(a=a==Fr?$r:a)==$r,d=(c=c==Fr?$r:c)==$r,h=a==c;if(h&&cn(e)){if(!cn(t))return!1;o=!0,u=!1}if(h&&!u)return s||(s=new zn),o||vn(e)?Ir(e,t,n,r,i,s):function(e,t,n,r,i,s,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new pr(e),new pr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ht(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=Rr;case"[object Set]":var a=1&r;if(l||(l=Mr),e.size!=t.size&&!a)return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var u=Ir(l(e),l(t),r,i,s,o);return o.delete(e),u;case"[object Symbol]":if(Dr)return Dr.call(e)==Dr.call(t)}return!1}(e,t,a,n,r,i,s);if(!(1&n)){var f=u&&zr.call(e,"__wrapped__"),p=d&&zr.call(t,"__wrapped__");if(f||p){var m=f?e.value():e,g=p?t.value():t;return s||(s=new zn),i(m,g,n,r,s)}}return!!h&&(s||(s=new zn),function(e,t,n,r,i,s){var o=1&n,l=Xn(e),a=l.length;if(a!=Xn(t).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in t:Pr.call(t,u)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var f=!0;s.set(e,t),s.set(t,e);for(var p=o;++c<a;){var m=e[u=l[c]],g=t[u];if(r)var v=o?r(g,m,u,t,e,s):r(m,g,u,e,t,s);if(!(void 0===v?m===g||i(m,g,n,r,s):v)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var b=e.constructor,y=t.constructor;b==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(f=!1)}return s.delete(e),s.delete(t),f}(e,t,n,r,i,s))}function Hr(e,t,n,r,i){return e===t||(null==e||null==t||!pt(e)&&!pt(t)?e!=e&&t!=t:Vr(e,t,n,r,Hr,i))}var Kr=function(e,t,n){for(var r=-1,i=Object(e),s=n(e),o=s.length;o--;){var l=s[++r];if(!1===t(i[l],l,i))break}return e};function Wr(e,t,n){(void 0!==n&&!Ht(e[t],n)||void 0===n&&!(t in e))&&Vt(e,t,n)}function Zr(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function Gr(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i],l=void 0;void 0===l&&(l=e[o]),r?Vt(n,o,l):Wt(n,o,l)}return n}(e,Sn(e))}function Yr(e,t,n,r,i,s,o){var l=Zr(e,n),a=Zr(t,n),c=o.get(a);if(c)Wr(e,n,c);else{var u,d=s?s(l,a,n+"",e,t,o):void 0,h=void 0===d;if(h){var f=mt(a),p=!f&&cn(a),m=!f&&!p&&vn(a);d=a,f||p||m?mt(l)?d=l:pt(u=l)&&Jt(u)?d=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(l):p?(h=!1,d=Zn(a,!0)):m?(h=!1,d=yr(a,!0)):d=[]:function(e){if(!pt(e)||"[object Object]"!=ft(e))return!1;var t=Bn(e);if(null===t)return!0;var n=Un.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fn.call(n)==$n}(a)||sn(a)?(d=l,sn(l)?d=Gr(l):gt(l)&&!bt(l)||(d=wr(a))):h=!1}h&&(o.set(a,d),i(d,a,r,s,o),o.delete(a)),Wr(e,n,d)}}function Jr(e,t,n,r,i){e!==t&&Kr(t,function(s,o){if(i||(i=new zn),gt(s))Yr(e,t,o,n,Jr,r,i);else{var l=r?r(Zr(e,o),s,o+"",e,t,i):void 0;void 0===l&&(l=s),Wr(e,o,l)}},Sn)}function Xr(e,t){return Hr(e,t)}var Qr,ei=(Qr=function(e,t,n){Jr(e,t,n)},Gt(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,s=r>2?t[2]:void 0;for(i=Qr.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(e,t,n){if(!gt(n))return!1;var r=typeof t;return!!("number"==r?Jt(n)&&zt(t,n.length):"string"==r&&t in n)&&Ht(n[t],e)}(t[0],t[1],s)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var o=t[n];o&&Qr(e,o,n,i)}return e})),ti=(e=>(e[e.TYPE=3]="TYPE",e[e.LEVEL=12]="LEVEL",e[e.ATTRIBUTE=13]="ATTRIBUTE",e[e.BLOT=14]="BLOT",e[e.INLINE=7]="INLINE",e[e.BLOCK=11]="BLOCK",e[e.BLOCK_BLOT=10]="BLOCK_BLOT",e[e.INLINE_BLOT=6]="INLINE_BLOT",e[e.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",e[e.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",e[e.ANY=15]="ANY",e))(ti||{});class ni{constructor(e,t,n={}){this.attrName=e,this.keyName=t;const r=ti.TYPE&ti.ATTRIBUTE;this.scope=null!=n.scope?n.scope&ti.LEVEL|r:ti.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(e){return Array.from(e.attributes).map(e=>e.name)}add(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)}canAdd(e,t){return null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1)}remove(e){e.removeAttribute(this.keyName)}value(e){const t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""}}class ri extends Error{constructor(e){super(e="[Parchment] "+e),this.message=e,this.name=this.constructor.name}}const ii=class e{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(e,t=!1){if(null==e)return null;if(this.blots.has(e))return this.blots.get(e)||null;if(t){let n=null;try{n=e.parentNode}catch{return null}return this.find(n,t)}return null}create(t,n,r){const i=this.query(n);if(null==i)throw new ri(`Unable to create ${n} blot`);const s=i,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:s.create(r),l=new s(t,o,r);return e.blots.set(l.domNode,l),l}find(t,n=!1){return e.find(t,n)}query(e,t=ti.ANY){let n;return"string"==typeof e?n=this.types[e]||this.attributes[e]:e instanceof Text||e.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof e?e&ti.LEVEL&ti.BLOCK?n=this.types.block:e&ti.LEVEL&ti.INLINE&&(n=this.types.inline):e instanceof Element&&((e.getAttribute("class")||"").split(/\s+/).some(e=>(n=this.classes[e],!!n)),n=n||this.tags[e.tagName]),null==n?null:"scope"in n&&t&ti.LEVEL&n.scope&&t&ti.TYPE&n.scope?n:null}register(...e){return e.map(e=>{const t="blotName"in e,n="attrName"in e;if(!t&&!n)throw new ri("Invalid definition");if(t&&"abstract"===e.blotName)throw new ri("Cannot register abstract class");const r=t?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?"string"==typeof e.keyName&&(this.attributes[e.keyName]=e):t&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(e=>e.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(t=>{(null==this.tags[t]||null==e.className)&&(this.tags[t]=e)}))),e})}};ii.blots=new WeakMap;let si=ii;function oi(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(e=>0===e.indexOf(`${t}-`))}const li=class extends ni{static keys(e){return(e.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(`${this.keyName}-${t}`),!0)}remove(e){oi(e,this.keyName).forEach(t=>{e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")}value(e){const t=(oi(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""}};function ai(e){const t=e.split("-"),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("");return t[0]+n}const ci=class extends ni{static keys(e){return(e.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(e,t){return!!this.canAdd(e,t)&&(e.style[ai(this.keyName)]=t,!0)}remove(e){e.style[ai(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")}value(e){const t=e.style[ai(this.keyName)];return this.canAdd(e,t)?t:""}};const ui=class{constructor(e){this.attributes={},this.domNode=e,this.build()}attribute(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])}build(){this.attributes={};const e=si.find(this.domNode);if(null==e)return;const t=ni.keys(this.domNode),n=li.keys(this.domNode),r=ci.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{const n=e.scroll.query(t,ti.ATTRIBUTE);n instanceof ni&&(this.attributes[n.attrName]=n)})}copy(e){Object.keys(this.attributes).forEach(t=>{const n=this.attributes[t].value(this.domNode);e.format(t,n)})}move(e){this.copy(e),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((e,t)=>(e[t]=this.attributes[t].value(this.domNode),e),{})}},di=class{constructor(e,t){this.scroll=e,this.domNode=t,si.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(null==this.tagName)throw new ri("Blot definition missing tagName");let t,n;return Array.isArray(this.tagName)?("string"==typeof e?(n=e.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof e&&(n=e),t="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t}get statics(){return this.constructor}attach(){}clone(){const e=this.domNode.cloneNode(!1);return this.scroll.create(e)}detach(){null!=this.parent&&this.parent.removeChild(this),si.blots.delete(this.domNode)}deleteAt(e,t){this.isolate(e,t).remove()}formatAt(e,t,n,r){const i=this.isolate(e,t);if(null!=this.scroll.query(n,ti.BLOT)&&r)i.wrap(n,r);else if(null!=this.scroll.query(n,ti.ATTRIBUTE)){const e=this.scroll.create(this.statics.scope);i.wrap(e),e.format(n,r)}}insertAt(e,t,n){const r=null==n?this.scroll.create("text",t):this.scroll.create(t,n),i=this.split(e);this.parent.insertBefore(r,i||void 0)}isolate(e,t){const n=this.split(e);if(null==n)throw new Error("Attempt to isolate at end");return n.split(t),n}length(){return 1}offset(e=this.parent){return null==this.parent||this===e?0:this.parent.children.offset(this)+this.parent.offset(e)}optimize(e){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(e,t){return 0===e?this:this.next}update(e,t){}wrap(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new ri(`Cannot wrap ${e}`);return n.appendChild(this),n}};di.blotName="abstract";let hi=di;const fi=class extends hi{static value(e){return!0}index(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1}position(e,t){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};fi.scope=ti.INLINE_BLOT;const pi=fi;class mi{constructor(){this.head=null,this.tail=null,this.length=0}append(...e){if(this.insertBefore(e[0],null),e.length>1){const t=e.slice(1);this.append(...t)}}at(e){const t=this.iterator();let n=t();for(;n&&e>0;)e-=1,n=t();return n}contains(e){const t=this.iterator();let n=t();for(;n;){if(n===e)return!0;n=t()}return!1}indexOf(e){const t=this.iterator();let n=t(),r=0;for(;n;){if(n===e)return r;r+=1,n=t()}return-1}insertBefore(e,t){null!=e&&(this.remove(e),e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)}offset(e){let t=0,n=this.head;for(;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return-1}remove(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)}iterator(e=this.head){return()=>{const t=e;return null!=e&&(e=e.next),t}}find(e,t=!1){const n=this.iterator();let r=n();for(;r;){const i=r.length();if(e<i||t&&e===i&&(null==r.next||0!==r.next.length()))return[r,e];e-=i,r=n()}return[null,0]}forEach(e){const t=this.iterator();let n=t();for(;n;)e(n),n=t()}forEachAt(e,t,n){if(t<=0)return;const[r,i]=this.find(e);let s=e-i;const o=this.iterator(r);let l=o();for(;l&&s<e+t;){const r=l.length();e>s?n(l,e-s,Math.min(t,s+r-e)):n(l,0,Math.min(r,e+t-s)),s+=r,l=o()}}map(e){return this.reduce((t,n)=>(t.push(e(n)),t),[])}reduce(e,t){const n=this.iterator();let r=n();for(;r;)t=e(t,r),r=n();return t}}function gi(e,t){const n=t.find(e);if(n)return n;try{return t.create(e)}catch{const n=t.create(ti.INLINE);return Array.from(e.childNodes).forEach(e=>{n.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(n.domNode,e),n.attach(),n}}const vi=class e extends hi{constructor(e,t){super(e,t),this.uiNode=null,this.build()}appendChild(e){this.insertBefore(e)}attach(){super.attach(),this.children.forEach(e=>{e.attach()})}attachUI(t){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=t,e.uiClass&&this.uiNode.classList.add(e.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new mi,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{const t=gi(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(t){if(t instanceof ri)return;throw t}})}deleteAt(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,(e,t,n)=>{e.deleteAt(t,n)})}descendant(t,n=0){const[r,i]=this.children.find(n);return null==t.blotName&&t(r)||null!=t.blotName&&r instanceof t?[r,i]:r instanceof e?r.descendant(t,i):[null,-1]}descendants(t,n=0,r=Number.MAX_VALUE){let i=[],s=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&i.push(n),n instanceof e&&(i=i.concat(n.descendants(t,r,s))),s-=o}),i}detach(){this.children.forEach(e=>{e.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(n=>{t||this.statics.allowedChildren.some(e=>n instanceof e)||(n.statics.scope===ti.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),t=!0):n instanceof e?n.unwrap():n.remove())})}formatAt(e,t,n,r){this.children.forEachAt(e,t,(e,t,i)=>{e.formatAt(t,i,n,r)})}insertAt(e,t,n){const[r,i]=this.children.find(e);if(r)r.insertAt(i,t,n);else{const e=null==n?this.scroll.create("text",t):this.scroll.create(t,n);this.appendChild(e)}}insertBefore(e,t){null!=e.parent&&e.parent.children.remove(e);let n=null;this.children.insertBefore(e,t||null),e.parent=this,null!=t&&(n=t.domNode),(this.domNode.parentNode!==e.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(e.domNode,n),e.attach()}length(){return this.children.reduce((e,t)=>e+t.length(),0)}moveChildren(e,t){this.children.forEach(n=>{e.insertBefore(n,t)})}optimize(e){if(super.optimize(e),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,n=!1){const[r,i]=this.children.find(t,n),s=[[this,t]];return r instanceof e?s.concat(r.path(i,n)):(null!=r&&s.push([r,i]),s)}removeChild(e){this.children.remove(e)}replaceWith(t,n){const r="string"==typeof t?this.scroll.create(t,n):t;return r instanceof e&&this.moveChildren(r),super.replaceWith(r)}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(e,this.length(),(e,r,i)=>{const s=e.split(r,t);null!=s&&n.appendChild(s)}),n}splitAfter(e){const t=this.clone();for(;null!=e.next;)t.appendChild(e.next);return this.parent&&this.parent.insertBefore(t,this.next||void 0),t}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(e,t){const n=[],r=[];e.forEach(e=>{e.target===this.domNode&&"childList"===e.type&&(n.push(...e.addedNodes),r.push(...e.removedNodes))}),r.forEach(e=>{if(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const t=this.scroll.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===this.domNode)&&t.detach()}),n.filter(e=>e.parentNode===this.domNode&&e!==this.uiNode).sort((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(e=>{let t=null;null!=e.nextSibling&&(t=this.scroll.find(e.nextSibling));const n=gi(e,this.scroll);(n.next!==t||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};vi.uiClass="";const bi=vi;const yi=class e extends bi{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ui(this.domNode)}format(t,n){if(t!==this.statics.blotName||n){const e=this.scroll.query(t,ti.INLINE);if(null==e)return;e instanceof ni?this.attributes.attribute(e,n):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n)}else this.children.forEach(t=>{t instanceof e||(t=t.wrap(e.blotName,!0)),this.attributes.copy(t)}),this.unwrap()}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.formats()[n]||this.scroll.query(n,ti.ATTRIBUTE)?this.isolate(e,t).format(n,r):super.formatAt(e,t,n,r)}optimize(t){super.optimize(t);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof e&&r.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}wrap(t,n){const r=super.wrap(t,n);return r instanceof e&&this.attributes.move(r),r}};yi.allowedChildren=[yi,pi],yi.blotName="inline",yi.scope=ti.INLINE_BLOT,yi.tagName="SPAN";const xi=yi,wi=class e extends bi{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ui(this.domNode)}format(t,n){const r=this.scroll.query(t,ti.BLOCK);null!=r&&(r instanceof ni?this.attributes.attribute(r,n):t!==this.statics.blotName||n?n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n):this.replaceWith(e.blotName))}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.scroll.query(n,ti.BLOCK)?this.format(n,r):super.formatAt(e,t,n,r)}insertAt(e,t,n){if(null==n||null!=this.scroll.query(t,ti.INLINE))super.insertAt(e,t,n);else{const r=this.split(e);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const e=this.scroll.create(t,n);r.parent.insertBefore(e,r)}}}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}};wi.blotName="block",wi.scope=ti.BLOCK_BLOT,wi.tagName="P",wi.allowedChildren=[xi,wi,pi];const Ni=wi,Ei=class extends bi{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(e,t){super.deleteAt(e,t),this.enforceAllowedChildren()}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.enforceAllowedChildren()}insertAt(e,t,n){super.insertAt(e,t,n),this.enforceAllowedChildren()}optimize(e){super.optimize(e),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};Ei.blotName="container",Ei.scope=ti.BLOCK_BLOT;const ki=Ei;const Ai=class extends pi{static formats(e,t){}format(e,t){super.formatAt(0,this.length(),e,t)}formatAt(e,t,n,r){0===e&&t===this.length()?this.format(n,r):super.formatAt(e,t,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},Si={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},Ci=class extends bi{constructor(e,t){super(null,t),this.registry=e,this.scroll=this,this.build(),this.observer=new MutationObserver(e=>{this.update(e)}),this.observer.observe(this.domNode,Si),this.attach()}create(e,t){return this.registry.create(this,e,t)}find(e,t=!1){const n=this.registry.find(e,t);return n?n.scroll===this?n:t?this.find(n.scroll.domNode.parentNode,!0):null:null}query(e,t=ti.ANY){return this.registry.query(e,t)}register(...e){return this.registry.register(...e)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(e,t){this.update(),0===e&&t===this.length()?this.children.forEach(e=>{e.remove()}):super.deleteAt(e,t)}formatAt(e,t,n,r){this.update(),super.formatAt(e,t,n,r)}insertAt(e,t,n){this.update(),super.insertAt(e,t,n)}optimize(e=[],t={}){super.optimize(t);const n=t.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)e.push(r.pop());const i=(e,t=!0)=>{null==e||e===this||null!=e.domNode.parentNode&&(n.has(e.domNode)||n.set(e.domNode,[]),t&&i(e.parent))},s=e=>{n.has(e.domNode)&&(e instanceof bi&&e.children.forEach(s),n.delete(e.domNode),e.optimize(t))};let o=e;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(e=>{const t=this.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(i(this.find(e.previousSibling,!1)),Array.from(e.addedNodes).forEach(e=>{const t=this.find(e,!1);i(t,!1),t instanceof bi&&t.children.forEach(e=>{i(e,!1)})})):"attributes"===e.type&&i(t.prev)),i(t))}),this.children.forEach(s),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)e.push(r.pop())}}update(e,t={}){e=e||this.observer.takeRecords();const n=new WeakMap;e.map(e=>{const t=this.find(e.target,!0);return null==t?null:n.has(t.domNode)?(n.get(t.domNode).push(e),null):(n.set(t.domNode,[e]),t)}).forEach(e=>{null!=e&&e!==this&&n.has(e.domNode)&&e.update(n.get(e.domNode)||[],t)}),t.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),t),this.optimize(e,t)}};Ci.blotName="scroll",Ci.defaultChild=Ni,Ci.allowedChildren=[Ni,ki],Ci.scope=ti.BLOCK_BLOT,Ci.tagName="DIV";const ji=Ci,Oi=class e extends pi{static create(e){return document.createTextNode(e)}static value(e){return e.data}constructor(e,t){super(e,t),this.text=this.statics.value(this.domNode)}deleteAt(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)}index(e,t){return this.domNode===e?t:-1}insertAt(e,t,n){null==n?(this.text=this.text.slice(0,e)+t+this.text.slice(e),this.domNode.data=this.text):super.insertAt(e,t,n)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(e,t=!1){return[this.domNode,e]}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(e,t){e.some(e=>"characterData"===e.type&&e.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};Oi.blotName="text",Oi.scope=ti.INLINE_BLOT;const qi=Oi,_i=Object.freeze(Object.defineProperty({__proto__:null,Attributor:ni,AttributorStore:ui,BlockBlot:Ni,ClassAttributor:li,ContainerBlot:ki,EmbedBlot:Ai,InlineBlot:xi,LeafBlot:pi,ParentBlot:bi,Registry:si,Scope:ti,ScrollBlot:ji,StyleAttributor:ci,TextBlot:qi},Symbol.toStringTag,{value:"Module"}));var Ti,Li,Ii={exports:{}};function Ri(){if(Li)return Ti;Li=1;var e=-1;function t(h,f,p,m,v){if(h===f)return h?[[0,h]]:[];if(null!=p){var b=function(e,t,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,i="number"==typeof n?null:n.newRange,s=e.length,o=t.length;if(0===r.length&&(null===i||0===i.length)){var l=r.index,a=e.slice(0,l),c=e.slice(l),u=i?i.index:null,d=l+o-s;if((null===u||u===d)&&!(d<0||d>o)){var h=t.slice(0,d);if((m=t.slice(d))===c){var f=Math.min(l,d);if((b=a.slice(0,f))===(x=h.slice(0,f)))return g(b,a.slice(f),h.slice(f),c)}}if(null===u||u===l){var p=l,m=(h=t.slice(0,p),t.slice(p));if(h===a){var v=Math.min(s-p,o-p);if((y=c.slice(c.length-v))===(w=m.slice(m.length-v)))return g(a,c.slice(0,c.length-v),m.slice(0,m.length-v),y)}}}if(r.length>0&&i&&0===i.length){var b=e.slice(0,r.index),y=e.slice(r.index+r.length);if(!(o<(f=b.length)+(v=y.length))){var x=t.slice(0,f),w=t.slice(o-v);if(b===x&&y===w)return g(b,e.slice(f,s-v),t.slice(f,o-v),y)}}return null}(h,f,p);if(b)return b}var y=r(h,f),x=h.substring(0,y);y=s(h=h.substring(y),f=f.substring(y));var w=h.substring(h.length-y),N=function(i,o){var l;if(!i)return[[1,o]];if(!o)return[[e,i]];var a=i.length>o.length?i:o,c=i.length>o.length?o:i,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],i.length>o.length&&(l[0][0]=l[2][0]=e),l;if(1===c.length)return[[e,i],[1,o]];var d=function(e,t){var n=e.length>t.length?e:t,i=e.length>t.length?t:e;if(n.length<4||2*i.length<n.length)return null;function o(e,t,n){for(var i,o,l,a,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,d="";-1!==(u=t.indexOf(c,u+1));){var h=r(e.substring(n),t.substring(u)),f=s(e.substring(0,n),t.substring(0,u));d.length<f+h&&(d=t.substring(u-f,u)+t.substring(u,u+h),i=e.substring(0,n-f),o=e.substring(n+h),l=t.substring(0,u-f),a=t.substring(u+h))}return 2*d.length>=e.length?[i,o,l,a,d]:null}var l,a,c,u,d,h=o(n,i,Math.ceil(n.length/4)),f=o(n,i,Math.ceil(n.length/2));if(!h&&!f)return null;l=f?h&&h[4].length>f[4].length?h:f:h;e.length>t.length?(a=l[0],c=l[1],u=l[2],d=l[3]):(u=l[0],d=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,d,p]}(i,o);if(d){var h=d[0],f=d[1],p=d[2],m=d[3],g=d[4],v=t(h,p),b=t(f,m);return v.concat([[0,g]],b)}return function(t,r){for(var i=t.length,s=r.length,o=Math.ceil((i+s)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),d=0;d<a;d++)c[d]=-1,u[d]=-1;c[l+1]=0,u[l+1]=0;for(var h=i-s,f=h%2!=0,p=0,m=0,g=0,v=0,b=0;b<o;b++){for(var y=-b+p;y<=b-m;y+=2){for(var x=l+y,w=(S=y===-b||y!==b&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-y;S<i&&w<s&&t.charAt(S)===r.charAt(w);)S++,w++;if(c[x]=S,S>i)m+=2;else if(w>s)p+=2;else if(f){if((k=l+h-y)>=0&&k<a&&-1!==u[k])if(S>=(E=i-u[k]))return n(t,r,S,w)}}for(var N=-b+g;N<=b-v;N+=2){for(var E,k=l+N,A=(E=N===-b||N!==b&&u[k-1]<u[k+1]?u[k+1]:u[k-1]+1)-N;E<i&&A<s&&t.charAt(i-E-1)===r.charAt(s-A-1);)E++,A++;if(u[k]=E,E>i)v+=2;else if(A>s)g+=2;else if(!f){if((x=l+h-N)>=0&&x<a&&-1!==c[x]){var S;w=l+(S=c[x])-x;if(S>=(E=i-E))return n(t,r,S,w)}}}}return[[e,t],[1,r]]}(i,o)}(h=h.substring(0,h.length-y),f=f.substring(0,f.length-y));return x&&N.unshift([0,x]),w&&N.push([0,w]),d(N,v),m&&function(t){var n=!1,r=[],h=0,f=null,p=0,m=0,g=0,v=0,b=0;for(;p<t.length;)0==t[p][0]?(r[h++]=p,m=v,g=b,v=0,b=0,f=t[p][1]):(1==t[p][0]?v+=t[p][1].length:b+=t[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(v,b)&&(t.splice(r[h-1],0,[e,f]),t[r[h-1]+1][0]=1,h--,p=--h>0?r[h-1]:-1,m=0,g=0,v=0,b=0,f=null,n=!0)),p++;n&&d(t);(function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(o),s=r.match(o),d=i&&n.match(l),h=s&&r.match(l),f=d&&n.match(a),p=h&&r.match(a),m=f&&e.match(c),g=p&&t.match(u);return m||g?5:f||p?4:i&&!d&&h?3:d||h?2:i||s?1:0}var n=1;for(;n<e.length-1;){if(0==e[n-1][0]&&0==e[n+1][0]){var r=e[n-1][1],i=e[n][1],d=e[n+1][1],h=s(r,i);if(h){var f=i.substring(i.length-h);r=r.substring(0,r.length-h),i=f+i.substring(0,i.length-h),d=f+d}for(var p=r,m=i,g=d,v=t(r,i)+t(i,d);i.charAt(0)===d.charAt(0);){r+=i.charAt(0),i=i.substring(1)+d.charAt(0),d=d.substring(1);var b=t(r,i)+t(i,d);b>=v&&(v=b,p=r,m=i,g=d)}e[n-1][1]!=p&&(p?e[n-1][1]=p:(e.splice(n-1,1),n--),e[n][1]=m,g?e[n+1][1]=g:(e.splice(n+1,1),n--))}n++}})(t),p=1;for(;p<t.length;){if(t[p-1][0]==e&&1==t[p][0]){var y=t[p-1][1],x=t[p][1],w=i(y,x),N=i(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(t.splice(p,0,[0,x.substring(0,w)]),t[p-1][1]=y.substring(0,y.length-w),t[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(t.splice(p,0,[0,y.substring(0,N)]),t[p-1][0]=1,t[p-1][1]=x.substring(0,x.length-N),t[p+1][0]=e,t[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(e,n,r,i){var s=e.substring(0,r),o=n.substring(0,i),l=e.substring(r),a=n.substring(i),c=t(s,o),u=t(l,a);return c.concat(u)}function r(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(s,i)==t.substring(s,i)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return h(e.charCodeAt(i-1))&&i--,i}function i(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var s=0,o=1;;){var l=e.substring(i-o),a=t.indexOf(l);if(-1==a)return s;o+=a,0!=a&&e.substring(i-o)!=t.substring(0,o)||(s=o,o++)}}function s(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(e.length-i,e.length-s)==t.substring(t.length-i,t.length-s)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return f(e.charCodeAt(e.length-i))&&i--,i}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,c=/\n\r?\n$/,u=/^\r?\n\r?\n/;function d(t,n){t.push([0,""]);for(var i,o=0,l=0,a=0,c="",u="";o<t.length;)if(o<t.length-1&&!t[o][1])t.splice(o,1);else switch(t[o][0]){case 1:a++,u+=t[o][1],o++;break;case e:l++,c+=t[o][1],o++;break;case 0:var h=o-a-l-1;if(n){if(h>=0&&m(t[h][1])){var f=t[h][1].slice(-1);if(t[h][1]=t[h][1].slice(0,-1),c=f+c,u=f+u,!t[h][1]){t.splice(h,1),o--;var g=h-1;t[g]&&1===t[g][0]&&(a++,u=t[g][1]+u,g--),t[g]&&t[g][0]===e&&(l++,c=t[g][1]+c,g--),h=g}}if(p(t[o][1])){f=t[o][1].charAt(0);t[o][1]=t[o][1].slice(1),c+=f,u+=f}}if(o<t.length-1&&!t[o][1]){t.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(i=r(u,c))&&(h>=0?t[h][1]+=u.substring(0,i):(t.splice(0,0,[0,u.substring(0,i)]),o++),u=u.substring(i),c=c.substring(i)),0!==(i=s(u,c))&&(t[o][1]=u.substring(u.length-i)+t[o][1],u=u.substring(0,u.length-i),c=c.substring(0,c.length-i)));var v=a+l;0===c.length&&0===u.length?(t.splice(o-v,v),o-=v):0===c.length?(t.splice(o-v,v,[1,u]),o=o-v+1):0===u.length?(t.splice(o-v,v,[e,c]),o=o-v+1):(t.splice(o-v,v,[e,c],[1,u]),o=o-v+2)}0!==o&&0===t[o-1][0]?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,l=0,c="",u=""}""===t[t.length-1][1]&&t.pop();var b=!1;for(o=1;o<t.length-1;)0===t[o-1][0]&&0===t[o+1][0]&&(t[o][1].substring(t[o][1].length-t[o-1][1].length)===t[o-1][1]?(t[o][1]=t[o-1][1]+t[o][1].substring(0,t[o][1].length-t[o-1][1].length),t[o+1][1]=t[o-1][1]+t[o+1][1],t.splice(o-1,1),b=!0):t[o][1].substring(0,t[o+1][1].length)==t[o+1][1]&&(t[o-1][1]+=t[o+1][1],t[o][1]=t[o][1].substring(t[o+1][1].length)+t[o+1][1],t.splice(o+1,1),b=!0)),o++;b&&d(t,n)}function h(e){return e>=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function p(e){return f(e.charCodeAt(0))}function m(e){return h(e.charCodeAt(e.length-1))}function g(t,n,r,i){return m(t)||p(i)?null:function(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}([[0,t],[e,n],[1,r],[0,i]])}function v(e,n,r,i){return t(e,n,r,i,!0)}return v.INSERT=1,v.DELETE=e,v.EQUAL=0,Ti=v}var Mi,Bi={exports:{}};function Di(){return Mi||(Mi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Boolean]",o="[object Date]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",u="[object Number]",d="[object Object]",h="[object Promise]",f="[object RegExp]",p="[object Set]",m="[object String]",g="[object Symbol]",v="[object WeakMap]",b="[object ArrayBuffer]",y="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",N="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",A="[object Uint8Array]",S="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",O=/\w*$/,q=/^\[object .+?Constructor\]$/,_=/^(?:0|[1-9]\d*)$/,T={};T[i]=T["[object Array]"]=T[b]=T[y]=T[s]=T[o]=T[x]=T[w]=T[N]=T[E]=T[k]=T[c]=T[u]=T[d]=T[f]=T[p]=T[m]=T[g]=T[A]=T[S]=T[C]=T[j]=!0,T["[object Error]"]=T[l]=T[v]=!1;var L="object"==typeof K&&K&&K.Object===Object&&K,I="object"==typeof self&&self&&self.Object===Object&&self,R=L||I||Function("return this")(),M=t&&!t.nodeType&&t,B=M&&e&&!e.nodeType&&e,D=B&&B.exports===M;function P(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function U(e,t,n,r){for(var i=-1,s=e?e.length:0;++i<s;)n=t(n,e[i],i,e);return n}function $(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function z(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function V(e,t){return function(n){return e(t(n))}}function H(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var W=Array.prototype,Z=Function.prototype,G=Object.prototype,Y=R["__core-js_shared__"],J=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),X=Z.toString,Q=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=D?R.Buffer:void 0,re=R.Symbol,ie=R.Uint8Array,se=V(Object.getPrototypeOf,Object),oe=Object.create,le=G.propertyIsEnumerable,ae=W.splice,ce=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,de=V(Object.keys,Object),he=Be(R,"DataView"),fe=Be(R,"Map"),pe=Be(R,"Promise"),me=Be(R,"Set"),ge=Be(R,"WeakMap"),ve=Be(Object,"create"),be=$e(he),ye=$e(fe),xe=$e(pe),we=$e(me),Ne=$e(ge),Ee=re?re.prototype:void 0,ke=Ee?Ee.valueOf:void 0;function Ae(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new Se(e)}function Oe(e,t){var n=Ve(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&He(e)}(e)&&Q.call(e,"callee")&&(!le.call(e,"callee")||ee.call(e)==i)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,s=!!r;for(var o in e)!Q.call(e,o)||s&&("length"==o||Fe(o,r))||n.push(o);return n}function qe(e,t,n){var r=e[t];Q.call(e,t)&&ze(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function _e(e,t){for(var n=e.length;n--;)if(ze(e[n][0],t))return n;return-1}function Te(e,t,n,r,h,v,q){var _;if(r&&(_=v?r(e,h,v,q):r(e)),void 0!==_)return _;if(!Ze(e))return e;var L=Ve(e);if(L){if(_=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,_)}else{var I=Pe(e),R=I==l||I==a;if(Ke(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(I==d||I==i||R&&!v){if($(e))return v?e:{};if(_=function(e){return"function"!=typeof e.constructor||Ue(e)?{}:(t=se(e),Ze(t)?oe(t):{});var t}(R?{}:e),!t)return function(e,t){return Re(e,De(e),t)}(e,function(e,t){return e&&Re(t,Ge(t),e)}(_,e))}else{if(!T[I])return v?e:{};_=function(e,t,n,r){var i=e.constructor;switch(t){case b:return Ie(e);case s:case o:return new i(+e);case y:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case x:case w:case N:case E:case k:case A:case S:case C:case j:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(z(e),!0):z(e);return U(r,P,new e.constructor)}(e,r,n);case u:case m:return new i(e);case f:return function(e){var t=new e.constructor(e.source,O.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(H(e),!0):H(e);return U(r,F,new e.constructor)}(e,r,n);case g:return l=e,ke?Object(ke.call(l)):{}}var l}(e,I,Te,t)}}q||(q=new je);var M=q.get(e);if(M)return M;if(q.set(e,_),!L)var B=n?function(e){return function(e,t,n){var r=t(e);return Ve(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,Ge,De)}(e):Ge(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(B||e,function(i,s){B&&(i=e[s=i]),qe(_,s,Te(i,t,n,r,s,e,q))}),_}function Le(e){return!(!Ze(e)||function(e){return!!J&&J in e}(e))&&(We(e)||$(e)?te:q).test($e(e))}function Ie(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Re(e,t,n,r){n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i];qe(n,o,e[o])}return n}function Me(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Be(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}Ae.prototype.clear=function(){this.__data__=ve?ve(null):{}},Ae.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ae.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Ae.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Q.call(t,e)},Ae.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?n:t,this},Se.prototype.clear=function(){this.__data__=[]},Se.prototype.delete=function(e){var t=this.__data__,n=_e(t,e);return!(n<0)&&(n==t.length-1?t.pop():ae.call(t,n,1),!0)},Se.prototype.get=function(e){var t=this.__data__,n=_e(t,e);return n<0?void 0:t[n][1]},Se.prototype.has=function(e){return _e(this.__data__,e)>-1},Se.prototype.set=function(e,t){var n=this.__data__,r=_e(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ce.prototype.clear=function(){this.__data__={hash:new Ae,map:new(fe||Se),string:new Ae}},Ce.prototype.delete=function(e){return Me(this,e).delete(e)},Ce.prototype.get=function(e){return Me(this,e).get(e)},Ce.prototype.has=function(e){return Me(this,e).has(e)},Ce.prototype.set=function(e,t){return Me(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new Se},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Se){var r=n.__data__;if(!fe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ce(r)}return n.set(e,t),this};var De=ce?V(ce,Object):function(){return[]},Pe=function(e){return ee.call(e)};function Fe(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||_.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function $e(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function ze(e,t){return e===t||e!=e&&t!=t}(he&&Pe(new he(new ArrayBuffer(1)))!=y||fe&&Pe(new fe)!=c||pe&&Pe(pe.resolve())!=h||me&&Pe(new me)!=p||ge&&Pe(new ge)!=v)&&(Pe=function(e){var t=ee.call(e),n=t==d?e.constructor:void 0,r=n?$e(n):void 0;if(r)switch(r){case be:return y;case ye:return c;case xe:return h;case we:return p;case Ne:return v}return t});var Ve=Array.isArray;function He(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!We(e)}var Ke=ue||function(){return!1};function We(e){var t=Ze(e)?ee.call(e):"";return t==l||t==a}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return He(e)?Oe(e):function(e){if(!Ue(e))return de(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Te(e,!0,!0)}}(Bi,Bi.exports)),Bi.exports}var Pi,Fi={exports:{}};function Ui(){return Pi||(Pi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",h="[object Object]",f="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",b="[object WeakMap]",y="[object ArrayBuffer]",x="[object DataView]",w=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[i]=E[s]=E[y]=E[o]=E[x]=E[l]=E[a]=E[c]=E[u]=E[d]=E[h]=E[p]=E[m]=E[g]=E[b]=!1;var k="object"==typeof K&&K&&K.Object===Object&&K,A="object"==typeof self&&self&&self.Object===Object&&self,S=k||A||Function("return this")(),C=t&&!t.nodeType&&t,j=C&&e&&!e.nodeType&&e,O=j&&j.exports===C,q=O&&k.process,_=function(){try{return q&&q.binding&&q.binding("util")}catch(e){}}(),T=_&&_.isTypedArray;function L(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function I(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function R(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,P=S["__core-js_shared__"],F=B.toString,U=D.hasOwnProperty,$=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),z=D.toString,V=RegExp("^"+F.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H=O?S.Buffer:void 0,W=S.Symbol,Z=S.Uint8Array,G=D.propertyIsEnumerable,Y=M.splice,J=W?W.toStringTag:void 0,X=Object.getOwnPropertySymbols,Q=H?H.isBuffer:void 0,ee=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),te=Oe(S,"DataView"),ne=Oe(S,"Map"),re=Oe(S,"Promise"),ie=Oe(S,"Set"),se=Oe(S,"WeakMap"),oe=Oe(Object,"create"),le=Le(te),ae=Le(ne),ce=Le(re),ue=Le(ie),de=Le(se),he=W?W.prototype:void 0,fe=he?he.valueOf:void 0;function pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ge;++t<n;)this.add(e[t])}function be(e){var t=this.__data__=new me(e);this.size=t.size}function ye(e,t){var n=Me(e),r=!n&&Re(e),i=!n&&!r&&Be(e),s=!n&&!r&&!i&&$e(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!U.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Te(c,a))||l.push(c);return l}function xe(e,t){for(var n=e.length;n--;)if(Ie(e[n][0],t))return n;return-1}function we(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?function(e){var t=U.call(e,J),n=e[J];try{e[J]=void 0;var r=!0}catch(s){}var i=z.call(e);r&&(t?e[J]=n:delete e[J]);return i}(e):function(e){return z.call(e)}(e)}function Ne(e){return Ue(e)&&we(e)==i}function Ee(e,t,n,r,c){return e===t||(null==e||null==t||!Ue(e)&&!Ue(t)?e!=e&&t!=t:function(e,t,n,r,c,f){var b=Me(e),w=Me(t),N=b?s:_e(e),E=w?s:_e(t),k=(N=N==i?h:N)==h,A=(E=E==i?h:E)==h,S=N==E;if(S&&Be(e)){if(!Be(t))return!1;b=!0,k=!1}if(S&&!k)return f||(f=new be),b||$e(e)?Se(e,t,n,r,c,f):function(e,t,n,r,i,s,c){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!s(new Z(e),new Z(t)));case o:case l:case d:return Ie(+e,+t);case a:return e.name==t.name&&e.message==t.message;case p:case g:return e==t+"";case u:var h=I;case m:var f=1&r;if(h||(h=R),e.size!=t.size&&!f)return!1;var b=c.get(e);if(b)return b==t;r|=2,c.set(e,t);var w=Se(h(e),h(t),r,i,s,c);return c.delete(e),w;case v:if(fe)return fe.call(e)==fe.call(t)}return!1}(e,t,N,n,r,c,f);if(!(1&n)){var C=k&&U.call(e,"__wrapped__"),j=A&&U.call(t,"__wrapped__");if(C||j){var O=C?e.value():e,q=j?t.value():t;return f||(f=new be),c(O,q,n,r,f)}}if(!S)return!1;return f||(f=new be),function(e,t,n,r,i,s){var o=1&n,l=Ce(e),a=l.length,c=Ce(t),u=c.length;if(a!=u&&!o)return!1;var d=a;for(;d--;){var h=l[d];if(!(o?h in t:U.call(t,h)))return!1}var f=s.get(e);if(f&&s.get(t))return f==t;var p=!0;s.set(e,t),s.set(t,e);var m=o;for(;++d<a;){var g=e[h=l[d]],v=t[h];if(r)var b=o?r(v,g,h,t,e,s):r(g,v,h,e,t,s);if(!(void 0===b?g===v||i(g,v,n,r,s):b)){p=!1;break}m||(m="constructor"==h)}if(p&&!m){var y=e.constructor,x=t.constructor;y==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,n,r,c,f)}(e,t,n,r,Ee,c))}function ke(e){return!(!Fe(e)||function(e){return!!$&&$ in e}(e))&&(De(e)?V:w).test(Le(e))}function Ae(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||D,t!==r)return ee(e);var t,n,r,i=[];for(var s in Object(e))U.call(e,s)&&"constructor"!=s&&i.push(s);return i}function Se(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var u=-1,d=!0,h=2&n?new ve:void 0;for(s.set(e,t),s.set(t,e);++u<l;){var f=e[u],p=t[u];if(r)var m=o?r(p,f,u,t,e,s):r(f,p,u,e,t,s);if(void 0!==m){if(m)continue;d=!1;break}if(h){if(!L(t,function(e,t){if(o=t,!h.has(o)&&(f===e||i(f,e,n,r,s)))return h.push(t);var o})){d=!1;break}}else if(f!==p&&!i(f,p,n,r,s)){d=!1;break}}return s.delete(e),s.delete(t),d}function Ce(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,ze,qe)}function je(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Oe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ke(n)?n:void 0}pe.prototype.clear=function(){this.__data__=oe?oe(null):{},this.size=0},pe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pe.prototype.get=function(e){var t=this.__data__;if(oe){var r=t[e];return r===n?void 0:r}return U.call(t,e)?t[e]:void 0},pe.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:U.call(t,e)},pe.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oe&&void 0===t?n:t,this},me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=xe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Y.call(t,n,1),--this.size,!0)},me.prototype.get=function(e){var t=this.__data__,n=xe(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return xe(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,r=xe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ge.prototype.clear=function(){this.size=0,this.__data__={hash:new pe,map:new(ne||me),string:new pe}},ge.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},ge.prototype.get=function(e){return je(this,e).get(e)},ge.prototype.has=function(e){return je(this,e).has(e)},ge.prototype.set=function(e,t){var n=je(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,n),this},ve.prototype.has=function(e){return this.__data__.has(e)},be.prototype.clear=function(){this.__data__=new me,this.size=0},be.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},be.prototype.get=function(e){return this.__data__.get(e)},be.prototype.has=function(e){return this.__data__.has(e)},be.prototype.set=function(e,t){var n=this.__data__;if(n instanceof me){var r=n.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ge(r)}return n.set(e,t),this.size=n.size,this};var qe=X?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(X(e),function(t){return G.call(e,t)}))}:function(){return[]},_e=we;function Te(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function Le(e){if(null!=e){try{return F.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ie(e,t){return e===t||e!=e&&t!=t}(te&&_e(new te(new ArrayBuffer(1)))!=x||ne&&_e(new ne)!=u||re&&_e(re.resolve())!=f||ie&&_e(new ie)!=m||se&&_e(new se)!=b)&&(_e=function(e){var t=we(e),n=t==h?e.constructor:void 0,r=n?Le(n):"";if(r)switch(r){case le:return x;case ae:return u;case ce:return f;case ue:return m;case de:return b}return t});var Re=Ne(function(){return arguments}())?Ne:function(e){return Ue(e)&&U.call(e,"callee")&&!G.call(e,"callee")},Me=Array.isArray;var Be=Q||function(){return!1};function De(e){if(!Fe(e))return!1;var t=we(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Fe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ue(e){return null!=e&&"object"==typeof e}var $e=T?function(e){return function(t){return e(t)}}(T):function(e){return Ue(e)&&Pe(e.length)&&!!E[we(e)]};function ze(e){return null!=(t=e)&&Pe(t.length)&&!De(t)?ye(e):Ae(e);var t}e.exports=function(e,t){return Ee(e,t)}}(Fi,Fi.exports)),Fi.exports}var $i,zi={};var Vi,Hi={};function Ki(){return Vi||(Vi=1,Object.defineProperty(Hi,"__esModule",{value:!0}),(e||(e={})).length=function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"object"==typeof e.retain&&null!==e.retain?1:"string"==typeof e.insert?e.insert.length:1},Hi.default=e),Hi;var e}var Wi,Zi,Gi={};var Yi=(Zi||(Zi=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const n=Ri(),r=Di(),i=Ui(),s=function(){if($i)return zi;$i=1,Object.defineProperty(zi,"__esModule",{value:!0});const e=Di(),t=Ui();var n,r;return(r=n||(n={})).compose=function(t={},n={},r=!1){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});let i=e(n);r||(i=Object.keys(i).reduce((e,t)=>(null!=i[t]&&(e[t]=i[t]),e),{}));for(const e in t)void 0!==t[e]&&void 0===n[e]&&(i[e]=t[e]);return Object.keys(i).length>0?i:void 0},r.diff=function(e={},n={}){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});const r=Object.keys(e).concat(Object.keys(n)).reduce((r,i)=>(t(e[i],n[i])||(r[i]=void 0===n[i]?null:n[i]),r),{});return Object.keys(r).length>0?r:void 0},r.invert=function(e={},t={}){e=e||{};const n=Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0!==e[r]&&(n[r]=t[r]),n),{});return Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0===t[r]&&(n[r]=null),n),n)},r.transform=function(e,t,n=!1){if("object"!=typeof e)return t;if("object"!=typeof t)return;if(!n)return t;const r=Object.keys(t).reduce((n,r)=>(void 0===e[r]&&(n[r]=t[r]),n),{});return Object.keys(r).length>0?r:void 0},zi.default=n,zi}();t.AttributeMap=s.default;const o=Ki();t.Op=o.default;const l=function(){if(Wi)return Gi;Wi=1,Object.defineProperty(Gi,"__esModule",{value:!0});const e=Ki();return Gi.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const n=this.ops[this.index];if(n){const r=this.offset,i=e.default.length(n);if(t>=i-r?(t=i-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof n.delete)return{delete:t};{const e={};return n.attributes&&(e.attributes=n.attributes),"number"==typeof n.retain?e.retain=t:"object"==typeof n.retain&&null!==n.retain?e.retain=n.retain:"string"==typeof n.insert?e.insert=n.insert.substr(r,t):e.insert=n.insert,e}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?e.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const e=this.ops[this.index];return e?"number"==typeof e.delete?"delete":"number"==typeof e.retain||"object"==typeof e.retain&&null!==e.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}return[]}},Gi}();t.OpIterator=l.default;const a=String.fromCharCode(0),c=(e,t)=>{if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);const n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]};class u{constructor(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){const t=this.handlers[e];if(!t)throw new Error(`no handlers for embed type "${e}"`);return t}insert(e,t){const n={};return"string"==typeof e&&0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if("number"==typeof e&&e<=0)return this;const n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=r(e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,n=this.ops[t-1],"object"!=typeof n))return this.ops.unshift(e),this;if(i(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){const e=this.ops[this.ops.length-1];return e&&"number"==typeof e.retain&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){const t=[],n=[];return this.forEach(r=>{(e(r)?t:n).push(r)}),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}changeLength(){return this.reduce((e,t)=>t.insert?e+o.default.length(t):t.delete?e-t.delete:e,0)}length(){return this.reduce((e,t)=>e+o.default.length(t),0)}slice(e=0,t=1/0){const n=[],r=new l.default(this.ops);let i=0;for(;i<t&&r.hasNext();){let s;i<e?s=r.next(e-i):(s=r.next(t-i),n.push(s)),i+=o.default.length(s)}return new u(n)}compose(e){const t=new l.default(this.ops),n=new l.default(e.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let e=o.retain;for(;"insert"===t.peekType()&&t.peekLength()<=e;)e-=t.peekLength(),r.push(t.next());o.retain-e>0&&n.next(o.retain-e)}const a=new u(r);for(;t.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===t.peekType())a.push(t.next());else{const e=Math.min(t.peekLength(),n.peekLength()),r=t.next(e),o=n.next(e);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?e:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const e=null==r.retain?"insert":"retain",[t,n,i]=c(r[e],o.retain),s=u.getHandler(t);l[e]={[t]:s.compose(n,i,"retain"===e)}}const d=s.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(d&&(l.attributes=d),a.push(l),!n.hasNext()&&i(a.ops[a.ops.length-1],l)){const e=new u(t.rest());return a.concat(e).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(e){const t=new u(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t}diff(e,t){if(this.ops===e.ops)return new u;const r=[this,e].map(t=>t.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],t,!0),d=new l.default(this.ops),h=new l.default(e.ops);return c.forEach(e=>{let t=e[1].length;for(;t>0;){let r=0;switch(e[0]){case n.INSERT:r=Math.min(h.peekLength(),t),o.push(h.next(r));break;case n.DELETE:r=Math.min(t,d.peekLength()),d.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(d.peekLength(),h.peekLength(),t);const e=d.next(r),l=h.next(r);i(e.insert,l.insert)?o.retain(r,s.default.diff(e.attributes,l.attributes)):o.push(l).delete(r)}t-=r}}),o.chop()}eachLine(e,t="\n"){const n=new l.default(this.ops);let r=new u,i=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const s=n.peek(),l=o.default.length(s)-n.peekLength(),a="string"==typeof s.insert?s.insert.indexOf(t,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===e(r,n.next(1).attributes||{},i))return;i+=1,r=new u}}r.length()>0&&e(r,{},i)}invert(e){const t=new u;return this.reduce((n,r)=>{if(r.insert)t.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return t.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const i=r.delete||r.retain;return e.slice(n,n+i).forEach(e=>{r.delete?t.push(e):r.retain&&r.attributes&&t.retain(o.default.length(e),s.default.invert(r.attributes,e.attributes))}),n+i}if("object"==typeof r.retain&&null!==r.retain){const i=e.slice(n,n+1),o=new l.default(i.ops).next(),[a,d,h]=c(r.retain,o.insert),f=u.getHandler(a);return t.retain({[a]:f.invert(d,h)},s.default.invert(r.attributes,o.attributes)),n+1}}return n},0),t.chop()}transform(e,t=!1){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);const n=e,r=new l.default(this.ops),i=new l.default(n.ops),a=new u;for(;r.hasNext()||i.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===i.peekType())if("insert"===i.peekType())a.push(i.next());else{const e=Math.min(r.peekLength(),i.peekLength()),n=r.next(e),o=i.next(e);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,i=o.retain;let l="object"==typeof i&&null!==i?i:e;if("object"==typeof r&&null!==r&&"object"==typeof i&&null!==i){const e=Object.keys(r)[0];if(e===Object.keys(i)[0]){const n=u.getHandler(e);n&&(l={[e]:n.transform(r[e],i[e],t)})}}a.retain(l,s.default.transform(n.attributes,o.attributes,t))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(e,t=!1){t=!!t;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=e;){const i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(r<e||!t)&&(e+=i),r+=i):e-=Math.min(i,e-r)}return e}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=s.default,u.handlers={},t.default=u,e.exports=u,e.exports.default=u}(Ii,Ii.exports)),Ii.exports);const Ji=W(Yi);class Xi extends Ai{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}Xi.blotName="break",Xi.tagName="BR";let Qi=class extends qi{};const es={"&":"&","<":"<",">":">",'"':""","'":"'"};function ts(e){return e.replace(/[&<>"']/g,e=>es[e])}const ns=class e extends xi{static compare(t,n){const r=e.order.indexOf(t),i=e.order.indexOf(n);return r>=0||i>=0?r-i:t===n?0:t<n?-1:1}formatAt(t,n,r,i){if(e.compare(this.statics.blotName,r)<0&&this.scroll.query(r,ti.BLOT)){const e=this.isolate(t,n);i&&e.wrap(r,i)}else super.formatAt(t,n,r,i)}optimize(t){if(super.optimize(t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};t(ns,"allowedChildren",[ns,Xi,Ai,Qi]),t(ns,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let rs=ns;class is extends Ni{constructor(){super(...arguments),t(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=os(this)),this.cache.delta}deleteAt(e,t){super.deleteAt(e,t),this.cache={}}formatAt(e,t,n,r){t<=0||(this.scroll.query(n,ti.BLOCK)?e+t===this.length()&&this.format(n,r):super.formatAt(e,Math.min(t,this.length()-e-1),n,r),this.cache={})}insertAt(e,t,n){if(null!=n)return super.insertAt(e,t,n),void(this.cache={});if(0===t.length)return;const r=t.split("\n"),i=r.shift();i.length>0&&(e<this.length()-1||null==this.children.tail?super.insertAt(Math.min(e,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});let s=this;r.reduce((e,t)=>(s=s.split(e,!0),s.insertAt(0,t),t.length),e+i.length)}insertBefore(e,t){const{head:n}=this.children;super.insertBefore(e,t),n instanceof Xi&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(e,t){super.moveChildren(e,t),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 t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t&&(0===e||e>=this.length()-1)){const t=this.clone();return 0===e?(this.parent.insertBefore(t,this),this):(this.parent.insertBefore(t,this.next),t)}const n=super.split(e,t);return this.cache={},n}}is.blotName="block",is.tagName="P",is.defaultChild=Xi,is.allowedChildren=[Xi,rs,Ai,Qi];class ss extends Ai{attach(){super.attach(),this.attributes=new ui(this.domNode)}delta(){return(new Ji).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(e,t){const n=this.scroll.query(e,ti.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}formatAt(e,t,n,r){this.format(n,r)}insertAt(e,t,n){if(null!=n)return void super.insertAt(e,t,n);const r=t.split("\n"),i=r.pop(),s=r.map(e=>{const t=this.scroll.create(is.blotName);return t.insertAt(0,e),t}),o=this.split(e);s.forEach(e=>{this.parent.insertBefore(e,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}}function os(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.descendants(pi).reduce((e,n)=>0===n.length()?e:e.insert(n.value(),ls(n,{},t)),new Ji).insert("\n",ls(e))}function ls(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==e?t:("formats"in e&&"function"==typeof e.formats&&(t={...t,...e.formats()},n&&delete t["code-token"]),null==e.parent||"scroll"===e.parent.statics.blotName||e.parent.statics.scope!==e.statics.scope?t:ls(e.parent,t,n))}ss.scope=ti.BLOCK_BLOT;const as=class e extends Ai{static value(){}constructor(t,n,r){super(t,n),this.selection=r,this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,n){if(0!==this.savedLength)return void super.format(t,n);let r=this,i=0;for(;null!=r&&r.statics.scope!==ti.BLOCK_BLOT;)i+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=e.CONTENTS.length,r.optimize(),r.formatAt(i,e.CONTENTS.length,t,n),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const n=this.prev instanceof Qi?this.prev:null,r=n?n.length():0,i=this.next instanceof Qi?this.next:null,s=i?i.text:"",{textNode:o}=this,l=o.data.split(e.CONTENTS).join("");let a;if(o.data=e.CONTENTS,n)a=n,(l||i)&&(n.insertAt(n.length(),l+s),i&&i.remove());else if(i)a=i,i.insertAt(0,l);else{const e=document.createTextNode(l);a=this.scroll.create(e),this.parent.insertBefore(a,this)}if(this.remove(),t){const e=(e,t)=>n&&e===n.domNode?t:e===o?r+t-1:i&&e===i.domNode?r+l.length+t:null,s=e(t.start.node,t.start.offset),c=e(t.end.node,t.end.offset);if(null!==s&&null!==c)return{startNode:a.domNode,startOffset:s,endNode:a.domNode,endOffset:c}}return null}update(e,t){if(e.some(e=>"characterData"===e.type&&e.target===this.textNode)){const e=this.restore();e&&(t.range=e)}}optimize(t){super.optimize(t);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=e.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};t(as,"blotName","cursor"),t(as,"className","ql-cursor"),t(as,"tagName","span"),t(as,"CONTENTS","\ufeff");let cs=as;var us,ds={exports:{}};var hs=(us||(us=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new i(r,s||e,o),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],l]:e._events[a].push(l):(e._events[a]=l,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i<s;i++)o[i]=r[i].fn;return o},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,i,s,o){var l=n?n+e:e;if(!this._events[l])return!1;var a,c,u=this._events[l],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,s),!0;case 6:return u.fn.call(u.context,t,r,i,s,o),!0}for(c=1,a=new Array(d-1);c<d;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,i);break;default:if(!a)for(h=1,a=new Array(d-1);h<d;h++)a[h-1]=arguments[h];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var l=this._events[s];if(l.fn)l.fn!==t||i&&!l.once||r&&l.context!==r||o(this,s);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==t||i&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}(ds)),ds.exports);const fs=W(hs),ps=new WeakMap,ms=["error","warn","log","info"];let gs="warn";function vs(e){if(gs&&ms.indexOf(e)<=ms.indexOf(gs))for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r]}function bs(e){return ms.reduce((t,n)=>(t[n]=vs.bind(console,n,e),t),{})}bs.level=e=>{gs=e},vs.level=bs.level;const ys=bs("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(e=>{document.addEventListener(e,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(e=>{const n=ps.get(e);n&&n.emitter&&n.emitter.handleDOM(...t)})})});class xs extends fs{constructor(){super(),this.domListeners={},this.on("error",ys.error)}emit(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ys.log.call(ys,...t),super.emit(...t)}handleDOM(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.domListeners[e.type]||[]).forEach(t=>{let{node:r,handler:i}=t;(e.target===r||r.contains(e.target))&&i(e,...n)})}listenDOM(e,t,n){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:n})}}t(xs,"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"}),t(xs,"sources",{API:"api",SILENT:"silent",USER:"user"});const ws=bs("quill:selection");class Ns{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=e,this.length=t}}class Es{constructor(e,t){this.emitter=t,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new Ns(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,xs.sources.USER),1)}),this.emitter.on(xs.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const e=this.getNativeRange();null!=e&&e.start.node!==this.cursor.textNode&&this.emitter.once(xs.events.SCROLL_UPDATE,(t,n)=>{try{this.root.contains(e.start.node)&&this.root.contains(e.end.node)&&this.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset);const r=n.some(e=>"characterData"===e.type||"childList"===e.type||"attributes"===e.type&&e.target===this.root);this.update(r?xs.sources.SILENT:t)}catch(r){}})}),this.emitter.on(xs.events.SCROLL_OPTIMIZE,(e,t)=>{if(t.range){const{startNode:e,startOffset:n,endNode:r,endOffset:i}=t.range;this.setNativeRange(e,n,r,i),this.update(xs.sources.SILENT)}}),this.update(xs.sources.SILENT)}handleComposition(){this.emitter.on(xs.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(xs.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const e=this.cursor.restore();if(!e)return;setTimeout(()=>{this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(xs.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(e,t){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(e,ti.BLOCK)){if(n.start.node!==this.cursor.textNode){const e=this.scroll.find(n.start.node,!1);if(null==e)return;if(e instanceof pi){const t=e.split(n.start.offset);e.parent.insertBefore(this.cursor,t)}else e.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;e=Math.min(e,n-1),t=Math.min(e+t,n-1)-e;let[i,s]=this.scroll.leaf(e);if(null==i)return null;if(t>0&&s===i.length()){const[t]=this.scroll.leaf(e+1);if(t){const[n]=this.scroll.line(e),[r]=this.scroll.line(e+1);n===r&&(i=t,s=0)}}[r,s]=i.position(s,!0);const o=document.createRange();if(t>0)return o.setStart(r,s),[i,s]=this.scroll.leaf(e+t),null==i?null:([r,s]=i.position(s,!0),o.setEnd(r,s),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;s<r.data.length?(o.setStart(r,s),o.setEnd(r,s+1)):(o.setStart(r,s-1),o.setEnd(r,s),a="right"),l=o.getBoundingClientRect()}else{if(!(i.domNode instanceof Element))return null;l=i.domNode.getBoundingClientRect(),s>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const e=document.getSelection();if(null==e||e.rangeCount<=0)return null;const t=e.getRangeAt(0);if(null==t)return null;const n=this.normalizeNative(t);return ws.info("getNativeRange",n),n}getRange(){const e=this.scroll.domNode;if("isConnected"in e&&!e.isConnected)return[null,null];const t=this.getNativeRange();if(null==t)return[null,null];return[this.normalizedToRange(t),t]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&ks(this.root,document.activeElement)}normalizedToRange(e){const t=[[e.start.node,e.start.offset]];e.native.collapsed||t.push([e.end.node,e.end.offset]);const n=t.map(e=>{const[t,n]=e,r=this.scroll.find(t,!0),i=r.offset(this.scroll);return 0===n?i:r instanceof pi?i+r.index(t,n):i+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),i=Math.min(r,...n);return new Ns(i,r-i)}normalizeNative(e){if(!ks(this.root,e.startContainer)||!e.collapsed&&!ks(this.root,e.endContainer))return null;const t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(e=>{let{node:t,offset:n}=e;for(;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else{if(t.childNodes.length!==n)break;t=t.lastChild,n=t instanceof Text?t.data.length:t.childNodes.length>0?t.childNodes.length:t.childNodes.length+1}e.node=t,e.offset=n}),t}rangeToNative(e){const t=this.scroll.length(),n=(e,n)=>{e=Math.min(t-1,e);const[r,i]=this.scroll.leaf(e);return r?r.position(i,n):[null,-1]};return[...n(e.index,!1),...n(e.index+e.length,!0)]}setNativeRange(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(ws.info("setNativeRange",e,t,n,r),null!=e&&(null==this.root.parentNode||null==e.parentNode||null==n.parentNode))return;const s=document.getSelection();if(null!=s)if(null!=e){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e instanceof Element&&"BR"===e.tagName&&(t=Array.from(e.parentNode.childNodes).indexOf(e),e=e.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const i=document.createRange();i.setStart(e,t),i.setEnd(n,r),s.removeAllRanges(),s.addRange(i)}}else s.removeAllRanges(),this.root.blur()}setRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xs.sources.API;if("string"==typeof t&&(n=t,t=!1),ws.info("setRange",e),null!=e){const n=this.rangeToNative(e);this.setNativeRange(...n,t)}else this.setNativeRange(null);this.update(n)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xs.sources.USER;const t=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Xr(t,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const e=this.cursor.restore();e&&this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}const n=[xs.events.SELECTION_CHANGE,_r(this.lastRange),_r(t),e];this.emitter.emit(xs.events.EDITOR_CHANGE,...n),e!==xs.sources.SILENT&&this.emitter.emit(...n)}}}function ks(e,t){try{t.parentNode}catch(n){return!1}return e.contains(t)}const As=/^[ -~]*$/;class Ss{constructor(e){this.scroll=e,this.delta=this.getDelta()}applyDelta(e){this.scroll.update();let t=this.scroll.length();this.scroll.batchStart();const n=_s(e),r=new Ji;return function(e){const t=[];return e.forEach(e=>{if("string"==typeof e.insert){e.insert.split("\n").forEach((n,r)=>{r&&t.push({insert:"\n",attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})})}else t.push(e)}),t}(n.ops.slice()).reduce((e,n)=>{const i=Yi.Op.length(n);let s=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(i),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(t<=e||!!this.scroll.descendant(ss,e)[0]),this.scroll.insertAt(e,r);const[i,o]=this.scroll.line(e);let a=ei({},ls(i));if(i instanceof is){const[e]=i.descendant(pi,o);e&&(a=ei(a,ls(e)))}s=Yi.AttributeMap.diff(a,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;const i=null!=this.scroll.query(r,ti.INLINE);if(i)(t<=e||this.scroll.descendant(ss,e)[0])&&(l=!0);else if(e>0){const[t,n]=this.scroll.descendant(pi,e-1);if(t instanceof Qi){"\n"!==t.value()[n]&&(o=!0)}else t instanceof Ai&&t.statics.scope===ti.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),i){const[t]=this.scroll.descendant(pi,e);if(t){const e=ei({},ls(t));s=Yi.AttributeMap.diff(e,s)||{}}}}t+=i}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const t=Object.keys(n.retain)[0];if(null==t)return e;this.scroll.updateEmbedAt(e,t,n.retain[t])}Object.keys(s).forEach(t=>{this.scroll.formatAt(e,i,t,s[t])});const a=o?1:0,c=l?1:0;return t+=a+c,r.retain(a),r.delete(c),e+i+a+c},0),r.reduce((e,t)=>"number"==typeof t.delete?(this.scroll.deleteAt(e,t.delete),e):e+Yi.Op.length(t),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(e,t){return this.scroll.deleteAt(e,t),this.update((new Ji).retain(e).delete(t))}formatLine(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(e,Math.max(t,1)).forEach(e=>{e.format(r,n[r])})}),this.scroll.optimize();const r=(new Ji).retain(e).retain(t,_r(n));return this.update(r)}formatText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t,r,n[r])});const r=(new Ji).retain(e).retain(t,_r(n));return this.update(r)}getContents(e,t){return this.delta.slice(e,e+t)}getDelta(){return this.scroll.lines().reduce((e,t)=>e.concat(t.delta()),new Ji)}getFormat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(e=>{const[t]=e;t instanceof is?n.push(t):t instanceof pi&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(pi,e,t));const[i,s]=[n,r].map(e=>{const t=e.shift();if(null==t)return{};let n=ls(t);for(;Object.keys(n).length>0;){const t=e.shift();if(null==t)return n;n=Os(ls(t),n)}return n});return{...i,...s}}getHTML(e,t){const[n,r]=this.scroll.line(e);if(n){const i=n.length();return!(n.length()>=r+t)||0===r&&t===i?js(this.scroll,e,t,!0):js(n,r,t,!0)}return""}getText(e,t){return this.getContents(e,t).filter(e=>"string"==typeof e.insert).map(e=>e.insert).join("")}insertContents(e,t){const n=_s(t),r=(new Ji).retain(e).concat(n);return this.scroll.insertContents(e,n),this.update(r)}insertEmbed(e,t,n){return this.scroll.insertAt(e,t,n),this.update((new Ji).retain(e).insert({[t]:n}))}insertText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t.length,r,n[r])}),this.update((new Ji).retain(e).insert(t,_r(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const e=this.scroll.children.head;if((null==e?void 0:e.statics.blotName)!==is.blotName)return!1;const t=e;return!(t.children.length>1)&&t.children.head instanceof Xi}removeFormat(e,t){const n=this.getText(e,t),[r,i]=this.scroll.line(e+t);let s=0,o=new Ji;null!=r&&(s=r.length()-i,o=r.delta().slice(i,i+s-1).insert("\n"));const l=this.getContents(e,t+s).diff((new Ji).insert(n).concat(o)),a=(new Ji).retain(e).concat(l);return this.applyDelta(a)}update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(As)&&this.scroll.find(t[0].target)){const i=this.scroll.find(t[0].target),s=ls(i),o=i.offset(this.scroll),l=t[0].oldValue.replace(cs.CONTENTS,""),a=(new Ji).insert(l),c=(new Ji).insert(i.value()),u=n&&{oldRange:Ts(n.oldRange,-o),newRange:Ts(n.newRange,-o)};e=(new Ji).retain(o).concat(a.diff(c,u)).reduce((e,t)=>t.insert?e.insert(t.insert,s):e.push(t),new Ji),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&Xr(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}function Cs(e,t,n){if(0===e.length){const[e]=qs(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${Cs([],t-1,n)}`}const[{child:r,offset:i,length:s,indent:o,type:l},...a]=e,[c,u]=qs(l);if(o>t)return n.push(l),o===t+1?`<${c}><li${u}>${js(r,i,s)}${Cs(a,o,n)}`:`<${c}><li>${Cs(e,t+1,n)}`;const d=n[n.length-1];if(o===t&&l===d)return`</li><li${u}>${js(r,i,s)}${Cs(a,o,n)}`;const[h]=qs(n.pop());return`</li></${h}>${Cs(e,t-1,n)}`}function js(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in e&&"function"==typeof e.html)return e.html(t,n);if(e instanceof Qi){return ts(e.value().slice(t,t+n)).replaceAll(" "," ")}if(e instanceof bi){if("list-container"===e.statics.blotName){const r=[];return e.children.forEachAt(t,n,(e,t,n)=>{const i="formats"in e&&"function"==typeof e.formats?e.formats():{};r.push({child:e,offset:t,length:n,indent:i.indent||0,type:i.list})}),Cs(r,-1,[])}const i=[];if(e.children.forEachAt(t,n,(e,t,n)=>{i.push(js(e,t,n))}),r||"list"===e.statics.blotName)return i.join("");const{outerHTML:s,innerHTML:o}=e.domNode,[l,a]=s.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${i.join("")}<${a}`:`${l}>${i.join("")}<${a}`}return e.domNode instanceof Element?e.domNode.outerHTML:""}function Os(e,t){return Object.keys(t).reduce((n,r)=>{if(null==e[r])return n;const i=t[r];return i===e[r]?n[r]=i:Array.isArray(i)?i.indexOf(e[r])<0?n[r]=i.concat([e[r]]):n[r]=i:n[r]=[i,e[r]],n},{})}function qs(e){const t="ordered"===e?"ol":"ul";switch(e){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function _s(e){return e.reduce((e,t)=>{if("string"==typeof t.insert){const n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new Ji)}function Ts(e,t){let{index:n,length:r}=e;return new Ns(n+t,r)}class Ls{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=e,this.options=t}}t(Ls,"DEFAULTS",{});const Is="\ufeff";class Rs extends Ai{constructor(e,t){super(e,t),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(e=>{this.contentNode.appendChild(e)}),this.leftGuard=document.createTextNode(Is),this.rightGuard=document.createTextNode(Is),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(e,t){return e===this.leftGuard?0:e===this.rightGuard?1:super.index(e,t)}restore(e){let t,n=null;const r=e.data.split(Is).join("");if(e===this.leftGuard)if(this.prev instanceof Qi){const e=this.prev.length();this.prev.insertAt(e,r),n={startNode:this.prev.domNode,startOffset:e+r.length}}else t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this),n={startNode:t,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof Qi?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this.next),n={startNode:t,startOffset:r.length}));return e.data=Is,n}update(e,t){e.forEach(e=>{if("characterData"===e.type&&(e.target===this.leftGuard||e.target===this.rightGuard)){const n=this.restore(e.target);n&&(t.range=n)}})}}class Ms{constructor(e,n){t(this,"isComposing",!1),this.scroll=e,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",e=>{this.isComposing||this.handleCompositionStart(e)}),this.scroll.domNode.addEventListener("compositionend",e=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(e)})})}handleCompositionStart(e){const t=e.target instanceof Node?this.scroll.find(e.target,!0):null;!t||t instanceof Rs||(this.emitter.emit(xs.events.COMPOSITION_BEFORE_START,e),this.scroll.batchStart(),this.emitter.emit(xs.events.COMPOSITION_START,e),this.isComposing=!0)}handleCompositionEnd(e){this.emitter.emit(xs.events.COMPOSITION_BEFORE_END,e),this.scroll.batchEnd(),this.emitter.emit(xs.events.COMPOSITION_END,e),this.isComposing=!1}}const Bs=class{constructor(e,n){t(this,"modules",{}),this.quill=e,this.options=n}init(){Object.keys(this.options.modules).forEach(e=>{null==this.modules[e]&&this.addModule(e)})}addModule(e){const t=this.quill.constructor.import(`modules/${e}`);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}};t(Bs,"DEFAULTS",{modules:{}}),t(Bs,"themes",{default:Bs});let Ds=Bs;const Ps=e=>e.parentElement||e.getRootNode().host||null,Fs=e=>{const t=e.getBoundingClientRect(),n="offsetWidth"in e&&Math.abs(t.width)/e.offsetWidth||1,r="offsetHeight"in e&&Math.abs(t.height)/e.offsetHeight||1;return{top:t.top,right:t.left+e.clientWidth*n,bottom:t.top+e.clientHeight*r,left:t.left}},Us=e=>{const t=parseInt(e,10);return Number.isNaN(t)?0:t},$s=(e,t,n,r,i,s)=>e<n&&t>r?0:e<n?-(n-e+i):t>r?t-e>r-n?e+i-n:t-r+s:0,zs=["block","break","cursor","inline","scroll","text"],Vs=bs("quill"),Hs=new si;bi.uiClass="ql-ui";const Ks=class e{static debug(e){!0===e&&(e="log"),bs.level(e)}static find(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ps.get(e)||Hs.find(e,t)}static import(e){return null==this.imports[e]&&Vs.error(`Cannot import ${e}. Are you sure it was registered?`),this.imports[e]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const e=arguments.length<=0?void 0:arguments[0],t=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in e?e.attrName:e.blotName;"string"==typeof n?this.register(`formats/${n}`,e,t):Object.keys(e).forEach(n=>{this.register(n,e[n],t)})}else{const e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[e]||n||Vs.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&t&&"boolean"!=typeof t&&"abstract"!==t.blotName&&Hs.register(t),"function"==typeof t.register&&t.register(Hs)}}constructor(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(e,t){const n=Zs(e);if(!n)throw new Error("Invalid Quill container");const r=!t.theme||t.theme===Ws.DEFAULTS.theme,i=r?Ds:Ws.import(`themes/${t.theme}`);if(!i)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:s,...o}=Ws.DEFAULTS,{modules:l,...a}=i.DEFAULTS;let c=Gs(t.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=ei({},Gs(s),Gs(l),c),d={...o,...Ys(a),...Ys(t)};let h=t.registry;h?t.formats&&Vs.warn('Ignoring "formats" option because "registry" is specified'):h=t.formats?((e,t,n)=>{const r=new si;return zs.forEach(e=>{const n=t.query(e);n&&r.register(n)}),e.forEach(e=>{let i=t.query(e);i||n.error(`Cannot register "${e}" specified in "formats" config. Are you sure it was registered?`);let s=0;for(;i;)if(r.register(i),i="blotName"in i?i.requiredContainer??null:null,s+=1,s>100){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r})(t.formats,d.registry,Vs):d.registry;return{...d,registry:h,container:n,theme:i,modules:Object.entries(u).reduce((e,t)=>{let[n,r]=t;if(!r)return e;const i=Ws.import(`modules/${n}`);return null==i?(Vs.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:ei({},i.DEFAULTS||{},r)}},{}),bounds:Zs(d.bounds)}}(t,n),this.container=this.options.container,null==this.container)return void Vs.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",ps.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new xs;const i=ji.blotName,s=this.options.registry.query(i);if(!s||!("blotName"in s))throw new Error(`Cannot initialize Quill without "${i}" blot`);if(this.scroll=new s(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new Ss(this.scroll),this.selection=new Es(this.scroll,this.emitter),this.composition=new Ms(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(xs.events.EDITOR_CHANGE,e=>{e===xs.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(xs.events.SCROLL_UPDATE,(e,t)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;Js.call(this,()=>this.editor.update(null,t,i),e)}),this.emitter.on(xs.events.SCROLL_EMBED_UPDATE,(t,n)=>{const r=this.selection.lastRange,[i]=this.selection.getRange(),s=r&&i?{oldRange:r,newRange:i}:void 0;Js.call(this,()=>{const e=(new Ji).retain(t.offset(this)).retain({[t.statics.blotName]:n});return this.editor.update(e,[],s)},e.sources.USER)}),r){const e=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(e)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){const t=e;(e=document.createElement("div")).classList.add(t)}return this.container.insertBefore(e,t),e}blur(){this.selection.setRange(null)}deleteText(e,t,n){return[e,t,,n]=Xs(e,t,n),Js.call(this,()=>this.editor.deleteText(e,t),n,e,-1*t)}disable(){this.enable(!1)}editReadOnly(e){this.allowReadOnlyEdits=!0;const t=e();return this.allowReadOnlyEdits=!1,t}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}focus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),e.preventScroll||this.scrollSelectionIntoView()}format(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xs.sources.API;return Js.call(this,()=>{const n=this.getSelection(!0);let r=new Ji;if(null==n)return r;if(this.scroll.query(e,ti.BLOCK))r=this.editor.formatLine(n.index,n.length,{[e]:t});else{if(0===n.length)return this.selection.format(e,t),r;r=this.editor.formatText(n.index,n.length,{[e]:t})}return this.setSelection(n,xs.sources.SILENT),r},n)}formatLine(e,t,n,r,i){let s;return[e,t,s,i]=Xs(e,t,n,r,i),Js.call(this,()=>this.editor.formatLine(e,t,s),i,e,0)}formatText(e,t,n,r,i){let s;return[e,t,s,i]=Xs(e,t,n,r,i),Js.call(this,()=>this.editor.formatText(e,t,s),i,e,0)}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length),!n)return null;const r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}getContents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e;return[e,t]=Xs(e,t),this.editor.getContents(e,t)}getFormat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}getIndex(e){return e.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(e){return this.scroll.leaf(e)}getLine(e){return this.scroll.line(e)}getLines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}getModule(e){return this.theme.modules[e]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Xs(e,t),this.editor.getHTML(e,t)}getText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Xs(e,t),this.editor.getText(e,t)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return Js.call(this,()=>this.editor.insertEmbed(t,n,r),i,t)}insertText(e,t,n,r,i){let s;return[e,,s,i]=Xs(e,0,n,r,i),Js.call(this,()=>this.editor.insertText(e,t,s),i,e,t.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(e,t,n){return[e,t,,n]=Xs(e,t,n),Js.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){((e,t)=>{var n,r,i;const s=e.ownerDocument;let o=t,l=e;for(;l;){const e=l===s.body,t=e?{top:0,right:(null==(n=window.visualViewport)?void 0:n.width)??s.documentElement.clientWidth,bottom:(null==(r=window.visualViewport)?void 0:r.height)??s.documentElement.clientHeight,left:0}:Fs(l),a=getComputedStyle(l),c=$s(o.left,o.right,t.left,t.right,Us(a.scrollPaddingLeft),Us(a.scrollPaddingRight)),u=$s(o.top,o.bottom,t.top,t.bottom,Us(a.scrollPaddingTop),Us(a.scrollPaddingBottom));if(c||u)if(e)null==(i=s.defaultView)||i.scrollBy(c,u);else{const{scrollLeft:e,scrollTop:t}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-e,r=l.scrollTop-t;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=e||"fixed"===a.position?null:Ps(l)}})(this.root,e)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const e=this.selection.lastRange,t=e&&this.selection.getBounds(e.index,e.length);t&&this.scrollRectIntoView(t)}setContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xs.sources.API;return Js.call(this,()=>{e=new Ji(e);const t=this.getLength(),n=this.editor.deleteText(0,t),r=this.editor.insertContents(0,e),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)},t)}setSelection(t,n,r){null==t?this.selection.setRange(null,n||e.sources.API):([t,n,,r]=Xs(t,n,r),this.selection.setRange(new Ns(Math.max(0,t),n),r),r!==xs.sources.SILENT&&this.scrollSelectionIntoView())}setText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xs.sources.API;const n=(new Ji).insert(e);return this.setContents(n,t)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xs.sources.USER;const t=this.scroll.update(e);return this.selection.update(e),t}updateContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xs.sources.API;return Js.call(this,()=>(e=new Ji(e),this.editor.applyDelta(e)),t,!0)}};t(Ks,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Hs,theme:"default"}),t(Ks,"events",xs.events),t(Ks,"sources",xs.sources),t(Ks,"version","2.0.3"),t(Ks,"imports",{delta:Ji,parchment:_i,"core/module":Ls,"core/theme":Ds});let Ws=Ks;function Zs(e){return"string"==typeof e?document.querySelector(e):e}function Gs(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:!0===r?{}:r}},{})}function Ys(e){return Object.fromEntries(Object.entries(e).filter(e=>void 0!==e[1]))}function Js(e,t,n,r){if(!this.isEnabled()&&t===xs.sources.USER&&!this.allowReadOnlyEdits)return new Ji;let i=null==n?null:this.getSelection();const s=this.editor.delta,o=e();if(null!=i&&(!0===n&&(n=i.index),null==r?i=Qs(i,o,t):0!==r&&(i=Qs(i,n,r,t)),this.setSelection(i,xs.sources.SILENT)),o.length()>0){const e=[xs.events.TEXT_CHANGE,o,s,t];this.emitter.emit(xs.events.EDITOR_CHANGE,...e),t!==xs.sources.SILENT&&this.emitter.emit(...e)}return o}function Xs(e,t,n,r,i){let s={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(i=r,r=n,n=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(i=r,r=n,n=t,t=0),"object"==typeof n?(s=n,i=r):"string"==typeof n&&(null!=r?s[n]=r:i=n),[e,t,s,i=i||xs.sources.API]}function Qs(e,t,n,r){const i="number"==typeof n?n:0;if(null==e)return null;let s,o;return t&&"function"==typeof t.transformPosition?[s,o]=[e.index,e.index+e.length].map(e=>t.transformPosition(e,r!==xs.sources.USER)):[s,o]=[e.index,e.index+e.length].map(e=>e<t||e===t&&r===xs.sources.USER?e:i>=0?e+i:Math.max(t,e+i)),new Ns(s,o-s)}class eo extends ki{}function to(e){return e instanceof is||e instanceof ss}function no(e){return"function"==typeof e.updateContent}class ro extends ji{constructor(e,t,n){let{emitter:r}=n;super(e,t),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",e=>this.handleDragStart(e))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const e=this.batch;this.batch=!1,this.update(e)}emitMount(e){this.emitter.emit(xs.events.SCROLL_BLOT_MOUNT,e)}emitUnmount(e){this.emitter.emit(xs.events.SCROLL_BLOT_UNMOUNT,e)}emitEmbedUpdate(e,t){this.emitter.emit(xs.events.SCROLL_EMBED_UPDATE,e,t)}deleteAt(e,t){const[n,r]=this.line(e),[i]=this.line(e+t);if(super.deleteAt(e,t),null!=i&&n!==i&&r>0){if(n instanceof ss||i instanceof ss)return void this.optimize();const e=i.children.head instanceof Xi?null:i.children.head;n.moveChildren(i,e),n.remove()}this.optimize()}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e?"true":"false")}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.optimize()}insertAt(e,t,n){if(e>=this.length())if(null==n||null==this.scroll.query(t,ti.BLOCK)){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e),null==n&&t.endsWith("\n")?e.insertAt(0,t.slice(0,-1),n):e.insertAt(0,t,n)}else{const e=this.scroll.create(t,n);this.appendChild(e)}else super.insertAt(e,t,n);this.optimize()}insertBefore(e,t){if(e.statics.scope===ti.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(e),super.insertBefore(n,t)}else super.insertBefore(e,t)}insertContents(e,t){const n=this.deltaToRenderBlocks(t.concat((new Ji).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const i=n.shift();if(i){const t="block"===i.type&&(0===i.delta.length()||!this.descendant(ss,e)[0]&&e<this.length()),n="block"===i.type?i.delta:(new Ji).insert({[i.key]:i.value});io(this,e,n);const r="block"===i.type?1:0,s=e+n.length()+r;t&&this.insertAt(s-1,"\n");const o=ls(this.line(e)[0]),l=Yi.AttributeMap.diff(o,i.attributes)||{};Object.keys(l).forEach(e=>{this.formatAt(s-1,1,e,l[e])}),e=s}let[s,o]=this.children.find(e);if(n.length&&(s&&(s=s.split(o),o=0),n.forEach(e=>{if("block"===e.type){io(this.createBlock(e.attributes,s||void 0),0,e.delta)}else{const t=this.create(e.key,e.value);this.insertBefore(t,s||void 0),Object.keys(e.attributes).forEach(n=>{t.format(n,e.attributes[n])})}})),"block"===r.type&&r.delta.length()){io(this,s?s.offset(s.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(e){const t=this.path(e).pop();if(!t)return[null,-1];const[n,r]=t;return n instanceof pi?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(to,e)}lines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(e,t,r)=>{let i=[],s=r;return e.children.forEachAt(t,r,(e,t,r)=>{to(e)?i.push(e):e instanceof ki&&(i=i.concat(n(e,t,s))),s-=r}),i};return n(this,e,t)}optimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(e,t),e.length>0&&this.emitter.emit(xs.events.SCROLL_OPTIMIZE,e,t))}path(e){return super.path(e).slice(1)}remove(){}update(e){if(this.batch)return void(Array.isArray(e)&&(this.batch=this.batch.concat(e)));let t=xs.sources.USER;"string"==typeof e&&(t=e),Array.isArray(e)||(e=this.observer.takeRecords()),(e=e.filter(e=>{let{target:t}=e;const n=this.find(t,!0);return n&&!no(n)})).length>0&&this.emitter.emit(xs.events.SCROLL_BEFORE_UPDATE,t,e),super.update(e.concat([])),e.length>0&&this.emitter.emit(xs.events.SCROLL_UPDATE,t,e)}updateEmbedAt(e,t,n){const[r]=this.descendant(e=>e instanceof ss,e);r&&r.statics.blotName===t&&no(r)&&r.updateContent(n)}handleDragStart(e){e.preventDefault()}deltaToRenderBlocks(e){const t=[];let n=new Ji;return e.forEach(e=>{const r=null==e?void 0:e.insert;if(r)if("string"==typeof r){const i=r.split("\n");i.slice(0,-1).forEach(r=>{n.insert(r,e.attributes),t.push({type:"block",delta:n,attributes:e.attributes??{}}),n=new Ji});const s=i[i.length-1];s&&n.insert(s,e.attributes)}else{const i=Object.keys(r)[0];if(!i)return;this.query(i,ti.INLINE)?n.push(e):(n.length()&&t.push({type:"block",delta:n,attributes:{}}),n=new Ji,t.push({type:"blockEmbed",key:i,value:r[i],attributes:e.attributes??{}}))}}),n.length()&&t.push({type:"block",delta:n,attributes:{}}),t}createBlock(e,t){let n;const r={};Object.entries(e).forEach(e=>{let[t,i]=e;null!=this.query(t,ti.BLOCK&ti.BLOT)?n=t:r[t]=i});const i=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(i,t||void 0);const s=i.length();return Object.entries(r).forEach(e=>{let[t,n]=e;i.formatAt(0,s,t,n)}),i}}function io(e,t,n){n.reduce((t,n)=>{const r=Yi.Op.length(n);let i=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;e.insertAt(t,r);const[s]=e.descendant(pi,t),o=ls(s);i=Yi.AttributeMap.diff(o,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;e.insertAt(t,r,n.insert[r]);if(null!=e.scroll.query(r,ti.INLINE)){const[n]=e.descendant(pi,t),r=ls(n);i=Yi.AttributeMap.diff(r,i)||{}}}return Object.keys(i).forEach(n=>{e.formatAt(t,r,n,i[n])}),t+r},t)}t(ro,"blotName","scroll"),t(ro,"className","ql-editor"),t(ro,"tagName","DIV"),t(ro,"defaultChild",is),t(ro,"allowedChildren",[is,ss,eo]);const so={scope:ti.BLOCK,whitelist:["right","center","justify"]},oo=new ni("align","align",so),lo=new li("align","ql-align",so),ao=new ci("align","text-align",so);class co extends ci{value(e){let t=super.value(e);if(!t.startsWith("rgb("))return t;t=t.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${t.split(",").map(e=>`00${parseInt(e,10).toString(16)}`.slice(-2)).join("")}`}}const uo=new li("color","ql-color",{scope:ti.INLINE}),ho=new co("color","color",{scope:ti.INLINE}),fo=new li("background","ql-bg",{scope:ti.INLINE}),po=new co("background","background-color",{scope:ti.INLINE});class mo extends eo{static create(e){const t=super.create(e);return t.setAttribute("spellcheck","false"),t}code(e,t){return this.children.map(e=>e.length()<=1?"":e.domNode.innerText).join("\n").slice(e,e+t)}html(e,t){return`<pre>\n${ts(this.code(e,t))}\n</pre>`}}class go extends is{static register(){Ws.register(mo)}}t(go,"TAB"," ");class vo extends rs{}vo.blotName="code",vo.tagName="CODE",go.blotName="code-block",go.className="ql-code-block",go.tagName="DIV",mo.blotName="code-block-container",mo.className="ql-code-block-container",mo.tagName="DIV",mo.allowedChildren=[go],go.allowedChildren=[Qi,Xi,cs],go.requiredContainer=mo;const bo={scope:ti.BLOCK,whitelist:["rtl"]},yo=new ni("direction","dir",bo),xo=new li("direction","ql-direction",bo),wo=new ci("direction","direction",bo),No={scope:ti.INLINE,whitelist:["serif","monospace"]},Eo=new li("font","ql-font",No);const ko=new class extends ci{value(e){return super.value(e).replace(/["']/g,"")}}("font","font-family",No),Ao=new li("size","ql-size",{scope:ti.INLINE,whitelist:["small","large","huge"]}),So=new ci("size","font-size",{scope:ti.INLINE,whitelist:["10px","18px","32px"]}),Co=bs("quill:keyboard"),jo=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Oo extends Ls{static match(e,t){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!t[n]!==e[n]&&null!==t[n])&&(t.key===e.key||t.key===e.which)}constructor(e,t){super(e,t),this.bindings={},Object.keys(this.options.bindings).forEach(e=>{this.options.bindings[e]&&this.addBinding(this.options.bindings[e])}),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(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(e){if("string"==typeof e||"number"==typeof e)e={key:e};else{if("object"!=typeof e)return null;e=_r(e)}e.shortKey&&(e[jo]=e.shortKey,delete e.shortKey);return e}(e);if(null==r)return void Co.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(e=>{const i={...r,key:e,...t,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)})}listen(){this.quill.root.addEventListener("keydown",e=>{if(e.defaultPrevented||e.isComposing)return;if(229===e.keyCode&&("Enter"===e.key||"Backspace"===e.key))return;const t=(this.bindings[e.key]||[]).concat(this.bindings[e.which]||[]).filter(t=>Oo.match(e,t));if(0===t.length)return;const n=Ws.find(e.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[i,s]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof qi?o.value().slice(0,l):"",d=a instanceof qi?a.value().slice(c):"",h={collapsed:0===r.length,empty:0===r.length&&i.length()<=1,format:this.quill.getFormat(r),line:i,offset:s,prefix:u,suffix:d,event:e};t.some(e=>{if(null!=e.collapsed&&e.collapsed!==h.collapsed)return!1;if(null!=e.empty&&e.empty!==h.empty)return!1;if(null!=e.offset&&e.offset!==h.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(e=>null==h.format[e]))return!1}else if("object"==typeof e.format&&!Object.keys(e.format).every(t=>!0===e.format[t]?null!=h.format[t]:!1===e.format[t]?null==h.format[t]:Xr(e.format[t],h.format[t])))return!1;return!(null!=e.prefix&&!e.prefix.test(h.prefix))&&(!(null!=e.suffix&&!e.suffix.test(h.suffix))&&!0!==e.handler.call(this,r,h,e))})&&e.preventDefault()})}handleBackspace(e,t){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;if(0===e.index||this.quill.getLength()<=1)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Ji).retain(e.index-n).delete(n);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(t){if(!("block"===t.statics.blotName&&t.length()<=1)){const t=i.formats(),n=this.quill.getFormat(e.index-1,1);if(r=Yi.AttributeMap.diff(t,n)||{},Object.keys(r).length>0){const t=(new Ji).retain(e.index+i.length()-2).retain(1,r);s=s.compose(t)}}}}this.quill.updateContents(s,Ws.sources.USER),this.quill.focus()}handleDelete(e,t){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(e.index>=this.quill.getLength()-n)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Ji).retain(e.index).delete(n);if(t.offset>=i.length()-1){const[t]=this.quill.getLine(e.index+1);if(t){const n=i.formats(),o=this.quill.getFormat(e.index,1);r=Yi.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(s=s.retain(t.length()-1).retain(1,r))}}this.quill.updateContents(s,Ws.sources.USER),this.quill.focus()}handleDeleteRange(e){Ro({range:e,quill:this.quill}),this.quill.focus()}handleEnter(e,t){const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,ti.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{}),r=(new Ji).retain(e.index).delete(e.length).insert("\n",n);this.quill.updateContents(r,Ws.sources.USER),this.quill.setSelection(e.index+1,Ws.sources.SILENT),this.quill.focus()}}const qo={bindings:{bold:Lo("bold"),italic:Lo("italic"),underline:Lo("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","+1",Ws.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","-1",Ws.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(e,t){null!=t.format.indent?this.quill.format("indent","-1",Ws.sources.USER):null!=t.format.list&&this.quill.format("list",!1,Ws.sources.USER)}},"indent code-block":_o(!0),"outdent code-block":_o(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(e){this.quill.deleteText(e.index-1,1,Ws.sources.USER)}},tab:{key:"Tab",handler(e,t){if(t.format.table)return!0;this.quill.history.cutoff();const n=(new Ji).retain(e.index).delete(e.length).insert("\t");return this.quill.updateContents(n,Ws.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,Ws.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,Ws.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(e,t){const n={list:!1};t.format.indent&&(n.indent=!1),this.quill.formatLine(e.index,e.length,n,Ws.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(e){const[t,n]=this.quill.getLine(e.index),r={...t.formats(),list:"checked"},i=(new Ji).retain(e.index).insert("\n",r).retain(t.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,Ws.sources.USER),this.quill.setSelection(e.index+1,Ws.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(e,t){const[n,r]=this.quill.getLine(e.index),i=(new Ji).retain(e.index).insert("\n",t.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,Ws.sources.USER),this.quill.setSelection(e.index+1,Ws.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(e){const t=this.quill.getModule("table");if(t){const[n,r,i,s]=t.getTable(e),o=function(e,t,n,r){if(null==t.prev&&null==t.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==t.prev)return-1;if(null==t.next)return 1;return null}(0,r,i,s);if(null==o)return;let l=n.offset();if(o<0){const t=(new Ji).retain(l).insert("\n");this.quill.updateContents(t,Ws.sources.USER),this.quill.setSelection(e.index+1,e.length,Ws.sources.SILENT)}else if(o>0){l+=n.length();const e=(new Ji).retain(l).insert("\n");this.quill.updateContents(e,Ws.sources.USER),this.quill.setSelection(l,Ws.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(e,t){const{event:n,line:r}=t,i=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(i-1,Ws.sources.USER):this.quill.setSelection(i+r.length(),Ws.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(e,t){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=t.prefix,[r,i]=this.quill.getLine(e.index);if(i>n)return!0;let s;switch(t.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(e.index," ",Ws.sources.USER),this.quill.history.cutoff();const o=(new Ji).retain(e.index-i).delete(n+1).retain(r.length()-2-i).retain(1,{list:s});return this.quill.updateContents(o,Ws.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,Ws.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(e){const[t,n]=this.quill.getLine(e.index);let r=2,i=t;for(;null!=i&&i.length()<=1&&i.formats()["code-block"];)if(i=i.prev,r-=1,r<=0){const r=(new Ji).retain(e.index+t.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,Ws.sources.USER),this.quill.setSelection(e.index-1,Ws.sources.SILENT),!1}return!0}},"embed left":To("ArrowLeft",!1),"embed left shift":To("ArrowLeft",!0),"embed right":To("ArrowRight",!1),"embed right shift":To("ArrowRight",!0),"table down":Io(!1),"table up":Io(!0)}};function _o(e){return{key:"Tab",shiftKey:!e,format:{"code-block":!0},handler(t,n){let{event:r}=n;const i=this.quill.scroll.query("code-block"),{TAB:s}=i;if(0===t.length&&!r.shiftKey)return this.quill.insertText(t.index,s,Ws.sources.USER),void this.quill.setSelection(t.index+s.length,Ws.sources.SILENT);const o=0===t.length?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:l,length:a}=t;o.forEach((t,n)=>{e?(t.insertAt(0,s),0===n?l+=s.length:a+=s.length):t.domNode.textContent.startsWith(s)&&(t.deleteAt(0,s.length),0===n?l-=s.length:a-=s.length)}),this.quill.update(Ws.sources.USER),this.quill.setSelection(l,a,Ws.sources.SILENT)}}}function To(e,t){const n="ArrowLeft"===e?"prefix":"suffix";return{key:e,shiftKey:t,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===e&&(r+=n.length+1);const[i]=this.quill.getLeaf(r);return!(i instanceof Ai)||("ArrowLeft"===e?t?this.quill.setSelection(n.index-1,n.length+1,Ws.sources.USER):this.quill.setSelection(n.index-1,Ws.sources.USER):t?this.quill.setSelection(n.index,n.length+1,Ws.sources.USER):this.quill.setSelection(n.index+n.length+1,Ws.sources.USER),!1)}}}function Lo(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],Ws.sources.USER)}}}function Io(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,n){const r=e?"prev":"next",i=n.line,s=i.parent[r];if(null!=s){if("table-row"===s.statics.blotName){let e=s.children.head,t=i;for(;null!=t.prev;)t=t.prev,e=e.next;const r=e.offset(this.quill.scroll)+Math.min(n.offset,e.length()-1);this.quill.setSelection(r,0,Ws.sources.USER)}}else{const t=i.table()[r];null!=t&&(e?this.quill.setSelection(t.offset(this.quill.scroll)+t.length()-1,0,Ws.sources.USER):this.quill.setSelection(t.offset(this.quill.scroll),0,Ws.sources.USER))}return!1}}}function Ro(e){let{quill:t,range:n}=e;const r=t.getLines(n);let i={};if(r.length>1){const e=r[0].formats(),t=r[r.length-1].formats();i=Yi.AttributeMap.diff(t,e)||{}}t.deleteText(n,Ws.sources.USER),Object.keys(i).length>0&&t.formatLine(n.index,1,i,Ws.sources.USER),t.setSelection(n.index,Ws.sources.SILENT)}Oo.DEFAULTS=qo;const Mo=/font-weight:\s*normal/,Bo=["P","OL","UL"],Do=e=>e&&Bo.includes(e.tagName);const Po=/\bmso-list:[^;]*ignore/i,Fo=/\bmso-list:[^;]*\bl(\d+)/i,Uo=/\bmso-list:[^;]*\blevel(\d+)/i,$o=e=>{var t,n;const r=Array.from(e.querySelectorAll("[style*=mso-list]")),i=[],s=[];r.forEach(e=>{(e.getAttribute("style")||"").match(Po)?i.push(e):s.push(e)}),i.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)});const o=e.documentElement.innerHTML,l=s.map(e=>((e,t)=>{const n=e.getAttribute("style"),r=null==n?void 0:n.match(Fo);if(!r)return null;const i=Number(r[1]),s=null==n?void 0:n.match(Uo),o=s?Number(s[1]):1,l=new RegExp(`@list l${i}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=t.match(l);return{id:i,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:e}})(e,o)).filter(e=>e);for(;l.length;){const e=[];let r=l.shift();for(;r;)e.push(r),r=l.length&&(null==(t=l[0])?void 0:t.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const i=document.createElement("ul");e.forEach(e=>{const t=document.createElement("li");t.setAttribute("data-list",e.type),e.indent>1&&t.setAttribute("class","ql-indent-"+(e.indent-1)),t.innerHTML=e.element.innerHTML,i.appendChild(t)});const s=null==(n=e[0])?void 0:n.element,{parentNode:o}=s??{};s&&(null==o||o.replaceChild(i,s)),e.slice(1).forEach(e=>{let{element:t}=e;null==o||o.removeChild(t)})}};const zo=[function(e){"urn:schemas-microsoft-com:office:word"===e.documentElement.getAttribute("xmlns:w")&&$o(e)},function(e){e.querySelector('[id^="docs-internal-guid-"]')&&((e=>{Array.from(e.querySelectorAll('b[style*="font-weight"]')).filter(e=>{var t;return null==(t=e.getAttribute("style"))?void 0:t.match(Mo)}).forEach(t=>{var n;const r=e.createDocumentFragment();r.append(...t.childNodes),null==(n=t.parentNode)||n.replaceChild(r,t)})})(e),(e=>{Array.from(e.querySelectorAll("br")).filter(e=>Do(e.previousElementSibling)&&Do(e.nextElementSibling)).forEach(e=>{var t;null==(t=e.parentNode)||t.removeChild(e)})})(e))}],Vo=bs("quill:clipboard"),Ho=[[Node.TEXT_NODE,function(e,t,n){var r;let i=e.data;if("O:P"===(null==(r=e.parentElement)?void 0:r.tagName))return t.insert(i.trim());if(!Qo(e)){if(0===i.trim().length&&i.includes("\n")&&!function(e,t){return e.previousElementSibling&&e.nextElementSibling&&!Jo(e.previousElementSibling,t)&&!Jo(e.nextElementSibling,t)}(e,n))return t;i=i.replace(/[^\S\u00a0]/g," "),i=i.replace(/ {2,}/g," "),(null==e.previousSibling&&null!=e.parentElement&&Jo(e.parentElement,n)||e.previousSibling instanceof Element&&Jo(e.previousSibling,n))&&(i=i.replace(/^ /,"")),(null==e.nextSibling&&null!=e.parentElement&&Jo(e.parentElement,n)||e.nextSibling instanceof Element&&Jo(e.nextSibling,n))&&(i=i.replace(/ $/,"")),i=i.replaceAll(" "," ")}return t.insert(i)}],[Node.TEXT_NODE,nl],["br",function(e,t){Yo(t,"\n")||t.insert("\n");return t}],[Node.ELEMENT_NODE,nl],[Node.ELEMENT_NODE,function(e,t,n){const r=n.query(e);if(null==r)return t;if(r.prototype instanceof Ai){const t={},i=r.value(e);if(null!=i)return t[r.blotName]=i,(new Ji).insert(t,r.formats(e,n))}else if(r.prototype instanceof Ni&&!Yo(t,"\n")&&t.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return Go(t,r.blotName,r.formats(e,n),n);return t}],[Node.ELEMENT_NODE,function(e,t,n){const r=ni.keys(e),i=li.keys(e),s=ci.keys(e),o={};return r.concat(i).concat(s).forEach(t=>{let r=n.query(t,ti.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(e),o[r.attrName])||(r=Ko[t],null==r||r.attrName!==t&&r.keyName!==t||(o[r.attrName]=r.value(e)||void 0),r=Wo[t],null==r||r.attrName!==t&&r.keyName!==t||(r=Wo[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,i]=t;return Go(e,r,i,n)},t)}],[Node.ELEMENT_NODE,function(e,t,n){var r;const i={},s=e.style||{};"italic"===s.fontStyle&&(i.italic=!0);"underline"===s.textDecoration&&(i.underline=!0);"line-through"===s.textDecoration&&(i.strike=!0);((null==(r=s.fontWeight)?void 0:r.startsWith("bold"))||parseInt(s.fontWeight,10)>=700)&&(i.bold=!0);if(t=Object.entries(i).reduce((e,t)=>{let[r,i]=t;return Go(e,r,i,n)},t),parseFloat(s.textIndent||0)>0)return(new Ji).insert("\t").concat(t);return t}],["li",function(e,t,n){const r=n.query(e);if(null==r||"list"!==r.blotName||!Yo(t,"\n"))return t;let i=-1,s=e.parentNode;for(;null!=s;)["OL","UL"].includes(s.tagName)&&(i+=1),s=s.parentNode;return i<=0?t:t.reduce((e,t)=>t.insert?t.attributes&&"number"==typeof t.attributes.indent?e.push(t):e.insert(t.insert,{indent:i,...t.attributes||{}}):e,new Ji)}],["ol, ul",function(e,t,n){const r=e;let i="OL"===r.tagName?"ordered":"bullet";const s=r.getAttribute("data-checked");s&&(i="true"===s?"checked":"unchecked");return Go(t,"list",i,n)}],["pre",function(e,t,n){const r=n.query("code-block"),i=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(e,n);return Go(t,"code-block",i,n)}],["tr",function(e,t,n){var r,i;const s="TABLE"===(null==(r=e.parentElement)?void 0:r.tagName)?e.parentElement:null==(i=e.parentElement)?void 0:i.parentElement;if(null!=s){return Go(t,"table",Array.from(s.querySelectorAll("tr")).indexOf(e)+1,n)}return t}],["b",tl("bold")],["i",tl("italic")],["strike",tl("strike")],["style",function(){return new Ji}]],Ko=[oo,yo].reduce((e,t)=>(e[t.keyName]=t,e),{}),Wo=[ao,po,ho,wo,ko,So].reduce((e,t)=>(e[t.keyName]=t,e),{});class Zo extends Ls{constructor(e,t){super(e,t),this.quill.root.addEventListener("copy",e=>this.onCaptureCopy(e,!1)),this.quill.root.addEventListener("cut",e=>this.onCaptureCopy(e,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Ho.concat(this.options.matchers??[]).forEach(e=>{let[t,n]=e;this.addMatcher(t,n)})}addMatcher(e,t){this.matchers.push([e,t])}convert(e){let{html:t,text:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[go.blotName])return(new Ji).insert(n||"",{[go.blotName]:r[go.blotName]});if(!t)return(new Ji).insert(n||"",r);const i=this.convertHTML(t);return Yo(i,"\n")&&(null==i.ops[i.ops.length-1].attributes||r.table)?i.compose((new Ji).retain(i.length()-1).delete(1)):i}normalizeHTML(e){(e=>{e.documentElement&&zo.forEach(t=>{t(e)})})(e)}convertHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");this.normalizeHTML(t);const n=t.body,r=new WeakMap,[i,s]=this.prepareMatching(n,r);return el(this.quill.scroll,n,i,s,r)}dangerouslyPasteHTML(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ws.sources.API;if("string"==typeof e){const n=this.convert({html:e,text:""});this.quill.setContents(n,t),this.quill.setSelection(0,Ws.sources.SILENT)}else{const r=this.convert({html:t,text:""});this.quill.updateContents((new Ji).retain(e).concat(r),n),this.quill.setSelection(e+r.length(),Ws.sources.SILENT)}}onCaptureCopy(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.defaultPrevented)return;e.preventDefault();const[i]=this.quill.selection.getRange();if(null==i)return;const{html:s,text:o}=this.onCopy(i,r);null==(t=e.clipboardData)||t.setData("text/plain",o),null==(n=e.clipboardData)||n.setData("text/html",s),r&&Ro({range:i,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>"#"!==e[0]).join("\n")}onCapturePaste(e){var t,n,r,i,s;if(e.defaultPrevented||!this.quill.isEnabled())return;e.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(t=e.clipboardData)?void 0:t.getData("text/html");let a=null==(n=e.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const t=null==(r=e.clipboardData)?void 0:r.getData("text/uri-list");t&&(a=this.normalizeURIList(t))}const c=Array.from((null==(i=e.clipboardData)?void 0:i.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const e=(new DOMParser).parseFromString(l,"text/html");if(1===e.body.childElementCount&&"IMG"===(null==(s=e.body.firstElementChild)?void 0:s.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(e){const t=this.quill.getText(e);return{html:this.quill.getSemanticHTML(e),text:t}}onPaste(e,t){let{text:n,html:r}=t;const i=this.quill.getFormat(e.index),s=this.convert({text:n,html:r},i);Vo.log("onPaste",s,{text:n,html:r});const o=(new Ji).retain(e.index).delete(e.length).concat(s);this.quill.updateContents(o,Ws.sources.USER),this.quill.setSelection(o.length()-e.length,Ws.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(e,t){const n=[],r=[];return this.matchers.forEach(i=>{const[s,o]=i;switch(s){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(e.querySelectorAll(s)).forEach(e=>{if(t.has(e)){const n=t.get(e);null==n||n.push(o)}else t.set(e,[o])})}}),[n,r]}}function Go(e,t,n,r){return r.query(t)?e.reduce((e,r)=>{if(!r.insert)return e;if(r.attributes&&r.attributes[t])return e.push(r);const i=n?{[t]:n}:{};return e.insert(r.insert,{...i,...r.attributes})},new Ji):e}function Yo(e,t){let n="";for(let r=e.ops.length-1;r>=0&&n.length<t.length;--r){const t=e.ops[r];if("string"!=typeof t.insert)break;n=t.insert+n}return n.slice(-1*t.length)===t}function Jo(e,t){if(!(e instanceof Element))return!1;const n=t.query(e);return!(n&&n.prototype instanceof Ai)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(e.tagName.toLowerCase())}t(Zo,"DEFAULTS",{matchers:[]});const Xo=new WeakMap;function Qo(e){return null!=e&&(Xo.has(e)||("PRE"===e.tagName?Xo.set(e,!0):Xo.set(e,Qo(e.parentNode))),Xo.get(e))}function el(e,t,n,r,i){return t.nodeType===t.TEXT_NODE?r.reduce((n,r)=>r(t,n,e),new Ji):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((s,o)=>{let l=el(e,o,n,r,i);return o.nodeType===t.ELEMENT_NODE&&(l=n.reduce((t,n)=>n(o,t,e),l),l=(i.get(o)||[]).reduce((t,n)=>n(o,t,e),l)),s.concat(l)},new Ji):new Ji}function tl(e){return(t,n,r)=>Go(n,e,!0,r)}function nl(e,t,n){if(!Yo(t,"\n")){if(Jo(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert("\n");if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;null!=r;){if(Jo(r,n))return t.insert("\n");const e=n.query(r);if(e&&e.prototype instanceof ss)return t.insert("\n");r=r.firstChild}}}return t}class rl extends Ls{constructor(e,n){super(e,n),t(this,"lastRecorded",0),t(this,"ignoreChange",!1),t(this,"stack",{undo:[],redo:[]}),t(this,"currentRange",null),this.quill.on(Ws.events.EDITOR_CHANGE,(e,t,n,r)=>{e===Ws.events.SELECTION_CHANGE?t&&r!==Ws.sources.SILENT&&(this.currentRange=t):e===Ws.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==Ws.sources.USER?this.transform(t):this.record(t,n)),this.currentRange=sl(this.currentRange,t))}),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",e=>{"historyUndo"===e.inputType?(this.undo(),e.preventDefault()):"historyRedo"===e.inputType&&(this.redo(),e.preventDefault())})}change(e,t){if(0===this.stack[e].length)return;const n=this.stack[e].pop();if(!n)return;const r=this.quill.getContents(),i=n.delta.invert(r);this.stack[t].push({delta:i,range:sl(n.range,i)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,Ws.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,t){if(0===e.ops.length)return;this.stack.redo=[];let n=e.invert(t),r=this.currentRange;const i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){const e=this.stack.undo.pop();e&&(n=n.compose(e.delta),r=e.range)}else this.lastRecorded=i;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){il(this.stack.undo,e),il(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,Ws.sources.USER);else{const t=function(e,t){const n=t.reduce((e,t)=>e+(t.delete||0),0);let r=t.length()-n;(function(e,t){const n=t.ops[t.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(t=>null!=e.query(t,ti.BLOCK));return!1})(e,t)&&(r-=1);return r}(this.quill.scroll,e.delta);this.quill.setSelection(t,Ws.sources.USER)}}}function il(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){const t=e[r];e[r]={delta:n.transform(t.delta,!0),range:t.range&&sl(t.range,n)},n=t.delta.transform(n),0===e[r].delta.length()&&e.splice(r,1)}}function sl(e,t){if(!e)return e;const n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}t(rl,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class ol extends Ls{constructor(e,t){super(e,t),e.root.addEventListener("drop",t=>{var n;t.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(t.clientX,t.clientY);else if(document.caretPositionFromPoint){const e=document.caretPositionFromPoint(t.clientX,t.clientY);r=document.createRange(),r.setStart(e.offsetNode,e.offset),r.setEnd(e.offsetNode,e.offset)}const i=r&&e.selection.normalizeNative(r);if(i){const r=e.selection.normalizedToRange(i);(null==(n=t.dataTransfer)?void 0:n.files)&&this.upload(r,t.dataTransfer.files)}})}upload(e,t){const n=[];Array.from(t).forEach(e=>{var t;e&&(null==(t=this.options.mimetypes)?void 0:t.includes(e.type))&&n.push(e)}),n.length>0&&this.options.handler.call(this,e,n)}}ol.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(e,t){if(!this.quill.scroll.query("image"))return;const n=t.map(e=>new Promise(t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));Promise.all(n).then(t=>{const n=t.reduce((e,t)=>e.insert({image:t}),(new Ji).retain(e.index).delete(e.length));this.quill.updateContents(n,xs.sources.USER),this.quill.setSelection(e.index+t.length,xs.sources.SILENT)})}};const ll=["insertText","insertReplacementText"];const al=/Mac/i.test(navigator.platform);Ws.register({"blots/block":is,"blots/block/embed":ss,"blots/break":Xi,"blots/container":eo,"blots/cursor":cs,"blots/embed":Rs,"blots/inline":rs,"blots/scroll":ro,"blots/text":Qi,"modules/clipboard":Zo,"modules/history":rl,"modules/keyboard":Oo,"modules/uploader":ol,"modules/input":class extends Ls{constructor(e,t){super(e,t),e.root.addEventListener("beforeinput",e=>{this.handleBeforeInput(e)}),/Android/i.test(navigator.userAgent)||e.on(Ws.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(e){Ro({range:e,quill:this.quill})}replaceText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===e.length)return!1;if(t){const n=this.quill.getFormat(e.index,1);this.deleteRange(e),this.quill.updateContents((new Ji).retain(e.index).insert(t,n),Ws.sources.USER)}else this.deleteRange(e);return this.quill.setSelection(e.index+t.length,0,Ws.sources.SILENT),!0}handleBeforeInput(e){if(this.quill.composition.isComposing||e.defaultPrevented||!ll.includes(e.inputType))return;const t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||!0===t.collapsed)return;const n=function(e){var t;if("string"==typeof e.data)return e.data;if(null==(t=e.dataTransfer)?void 0:t.types.includes("text/plain"))return e.dataTransfer.getData("text/plain");return null}(e);if(null==n)return;const r=this.quill.selection.normalizeNative(t),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&e.preventDefault()}handleCompositionStart(){const e=this.quill.getSelection();e&&this.replaceText(e)}},"modules/uiNode":class extends Ls{constructor(e,n){super(e,n),t(this,"isListening",!1),t(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,t){let{line:n,event:r}=t;if(!(n instanceof bi&&n.uiNode))return!0;const i="rtl"===getComputedStyle(n.domNode).direction;return!!(i&&"ArrowRight"!==r.key||!i&&"ArrowLeft"!==r.key)||(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),Ws.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&(e=>"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key||"Home"===e.key||!(!al||"a"!==e.key||!0!==e.ctrlKey))(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const t=e.getRangeAt(0);if(!0!==t.collapsed||0!==t.startOffset)return;const n=this.quill.scroll.find(t.startContainer);if(!(n instanceof bi&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}}});const cl=new class extends li{add(e,t){let n=0;if("+1"===t||"-1"===t){const r=this.value(e)||0;n="+1"===t?r+1:r-1}else"number"==typeof t&&(n=t);return 0===n?(this.remove(e),!0):super.add(e,n.toString())}canAdd(e,t){return super.canAdd(e,t)||super.canAdd(e,parseInt(t,10))}value(e){return parseInt(super.value(e),10)||void 0}}("indent","ql-indent",{scope:ti.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class ul extends is{}t(ul,"blotName","blockquote"),t(ul,"tagName","blockquote");class dl extends is{static formats(e){return this.tagName.indexOf(e.tagName)+1}}t(dl,"blotName","header"),t(dl,"tagName",["H1","H2","H3","H4","H5","H6"]);class hl extends eo{}hl.blotName="list-container",hl.tagName="OL";class fl extends is{static create(e){const t=super.create();return t.setAttribute("data-list",e),t}static formats(e){return e.getAttribute("data-list")||void 0}static register(){Ws.register(hl)}constructor(e,t){super(e,t);const n=t.ownerDocument.createElement("span"),r=n=>{if(!e.isEnabled())return;const r=this.statics.formats(t,e);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-list",t):super.format(e,t)}}fl.blotName="list",fl.tagName="LI",hl.allowedChildren=[fl],fl.requiredContainer=hl;class pl extends rs{static create(){return super.create()}static formats(){return!0}optimize(e){super.optimize(e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}t(pl,"blotName","bold"),t(pl,"tagName",["STRONG","B"]);class ml extends pl{}t(ml,"blotName","italic"),t(ml,"tagName",["EM","I"]);class gl extends rs{static create(e){const t=super.create(e);return t.setAttribute("href",this.sanitize(e)),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t}static formats(e){return e.getAttribute("href")}static sanitize(e){return vl(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("href",this.constructor.sanitize(t)):super.format(e,t)}}function vl(e,t){const n=document.createElement("a");n.href=e;const r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}t(gl,"blotName","link"),t(gl,"tagName","A"),t(gl,"SANITIZED_URL","about:blank"),t(gl,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class bl extends rs{static create(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):super.create(e)}static formats(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}t(bl,"blotName","script"),t(bl,"tagName",["SUB","SUP"]);class yl extends pl{}t(yl,"blotName","strike"),t(yl,"tagName",["S","STRIKE"]);class xl extends rs{}t(xl,"blotName","underline"),t(xl,"tagName","U");class wl extends Rs{static create(e){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const t=super.create(e);return"string"==typeof e&&(window.katex.render(e,t,{throwOnError:!1,errorColor:"#f00"}),t.setAttribute("data-value",e)),t}static value(e){return e.getAttribute("data-value")}html(){const{formula:e}=this.value();return`<span>${e}</span>`}}t(wl,"blotName","formula"),t(wl,"className","ql-formula"),t(wl,"tagName","SPAN");const Nl=["alt","height","width"];class El extends Ai{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("src",this.sanitize(e)),t}static formats(e){return Nl.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static match(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}static sanitize(e){return vl(e,["http","https","data"])?e:"//:0"}static value(e){return e.getAttribute("src")}format(e,t){Nl.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}t(El,"blotName","image"),t(El,"tagName","IMG");const kl=["height","width"];class Al extends ss{static create(e){const t=super.create(e);return t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen","true"),t.setAttribute("src",this.sanitize(e)),t}static formats(e){return kl.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return gl.sanitize(e)}static value(e){return e.getAttribute("src")}format(e,t){kl.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}html(){const{video:e}=this.value();return`<a href="${e}">${e}</a>`}}t(Al,"blotName","video"),t(Al,"className","ql-video"),t(Al,"tagName","IFRAME");const Sl=new li("code-token","hljs",{scope:ti.INLINE});class Cl extends rs{static formats(e,t){for(;null!=e&&e!==t.domNode;){if(e.classList&&e.classList.contains(go.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),Sl.add(this.domNode,n)}format(e,t){e!==Cl.blotName?super.format(e,t):t?Sl.add(this.domNode,t):(Sl.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),Sl.value(this.domNode)||this.unwrap()}}Cl.blotName="code-token",Cl.className="ql-token";class jl extends go{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("data-language",e),t}static formats(e){return e.getAttribute("data-language")||"plain"}static register(){}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-language",t):super.format(e,t)}replaceWith(e,t){return this.formatAt(0,this.length(),Cl.blotName,!1),super.replaceWith(e,t)}}class Ol extends mo{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===jl.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===jl.blotName&&(this.forceNext=!0),super.formatAt(e,t,n,r)}highlight(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).map(e=>e.textContent).join("\n")}\n`,r=jl.formats(this.children.head.domNode);if(t||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const t=this.children.reduce((e,t)=>e.concat(os(t,!1)),new Ji),i=e(n,r);t.diff(i).reduce((e,t)=>{let{retain:n,attributes:r}=t;return n?(r&&Object.keys(r).forEach(t=>{[jl.blotName,Cl.blotName].includes(t)&&this.formatAt(e,n,t,r[t])}),e+n):e},0)}this.cachedText=n,this.forceNext=!1}}html(e,t){const[n]=this.children.find(e);return`<pre data-language="${n?jl.formats(n.domNode):"plain"}">\n${ts(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const e=jl.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}Ol.allowedChildren=[jl],jl.requiredContainer=Ol,jl.allowedChildren=[Cl,cs,Qi,Xi];class ql extends Ls{static register(){Ws.register(Cl,!0),Ws.register(jl,!0),Ws.register(Ol,!0)}constructor(e,t){if(super(e,t),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((e,t)=>{let{key:n}=t;return e[n]=!0,e},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(Ws.events.SCROLL_BLOT_MOUNT,e=>{if(!(e instanceof Ol))return;const t=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(e=>{let{key:n,label:r}=e;const i=t.ownerDocument.createElement("option");i.textContent=r,i.setAttribute("value",n),t.appendChild(i)}),t.addEventListener("change",()=>{e.format(jl.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),null==e.uiNode&&(e.attachUI(t),e.children.head&&(t.value=jl.formats(e.children.head.domNode)))})}initTimer(){let e=null;this.quill.on(Ws.events.SCROLL_OPTIMIZE,()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.highlight(),e=null},this.options.interval)})}highlight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(Ws.sources.USER);const n=this.quill.getSelection();(null==e?this.quill.scroll.descendants(Ol):[e]).forEach(e=>{e.highlight(this.highlightBlot,t)}),this.quill.update(Ws.sources.SILENT),null!=n&&this.quill.setSelection(n,Ws.sources.SILENT)}highlightBlot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(t=this.languages[t]?t:"plain","plain"===t)return ts(e).split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[go.blotName]:t}),e.insert(n)),new Ji);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(go.className),n.innerHTML=((e,t,n)=>{if("string"==typeof e.versionString){const r=e.versionString.split(".")[0];if(parseInt(r,10)>=11)return e.highlight(n,{language:t}).value}return e.highlight(t,n).value})(this.options.hljs,t,e),el(this.quill.scroll,n,[(e,t)=>{const n=Sl.value(e);return n?t.compose((new Ji).retain(t.length(),{[Cl.blotName]:n})):t}],[(e,n)=>e.data.split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[go.blotName]:t}),e.insert(n)),n)],new WeakMap)}}ql.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 _l=class e extends is{static create(e){const t=super.create();return e?t.setAttribute("data-row",e):t.setAttribute("data-row",Ml()),t}static formats(e){if(e.hasAttribute("data-row"))return e.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,n){t===e.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(t,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};t(_l,"blotName","table"),t(_l,"tagName","TD");let Tl=_l;class Ll extends eo{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return e.table===t.table&&e.table===n.table&&e.table===r.table}return!1}optimize(e){super.optimize(e),this.children.forEach(e=>{if(null==e.next)return;const t=e.formats(),n=e.next.formats();if(t.table!==n.table){const t=this.splitAfter(e);t&&t.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}t(Ll,"blotName","table-row"),t(Ll,"tagName","TR");class Il extends eo{}t(Il,"blotName","table-body"),t(Il,"tagName","TBODY");class Rl extends eo{balanceCells(){const e=this.descendants(Ll),t=e.reduce((e,t)=>Math.max(t.children.length,e),0);e.forEach(e=>{new Array(t-e.children.length).fill(0).forEach(()=>{let t;null!=e.children.head&&(t=Tl.formats(e.children.head.domNode));const n=this.scroll.create(Tl.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){const[t]=this.descendant(Il);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e);null!=n&&n.remove()})}insertColumn(e){const[t]=this.descendant(Il);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e),r=Tl.formats(t.children.head.domNode),i=this.scroll.create(Tl.blotName,r);t.insertBefore(i,n)})}insertRow(e){const[t]=this.descendant(Il);if(null==t||null==t.children.head)return;const n=Ml(),r=this.scroll.create(Ll.blotName);t.children.head.children.forEach(()=>{const e=this.scroll.create(Tl.blotName,n);r.appendChild(e)});const i=t.children.at(e);t.insertBefore(r,i)}rows(){const e=this.children.head;return null==e?[]:e.children.map(e=>e)}}function Ml(){return`row-${Math.random().toString(36).slice(2,6)}`}t(Rl,"blotName","table-container"),t(Rl,"tagName","TABLE"),Rl.allowedChildren=[Il],Il.requiredContainer=Rl,Il.allowedChildren=[Ll],Ll.requiredContainer=Il,Ll.allowedChildren=[Tl],Tl.requiredContainer=Ll;const Bl=bs("quill:toolbar");class Dl extends Ls{constructor(e,t){var n,r;if(super(e,t),Array.isArray(this.options.container)){const t=document.createElement("div");t.setAttribute("role","toolbar"),function(e,t){Array.isArray(t[0])||(t=[t]);t.forEach(t=>{const n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(e=>{if("string"==typeof e)Pl(n,e);else{const t=Object.keys(e)[0],r=e[t];Array.isArray(r)?function(e,t,n){const r=document.createElement("select");r.classList.add(`ql-${t}`),n.forEach(e=>{const t=document.createElement("option");!1!==e?t.setAttribute("value",String(e)):t.setAttribute("selected","selected"),r.appendChild(t)}),e.appendChild(r)}(n,t,r):Pl(n,t,r)}}),e.appendChild(n)})}(t,this.options.container),null==(r=null==(n=e.container)?void 0:n.parentNode)||r.insertBefore(t,e.container),this.container=t}else"string"==typeof this.options.container?this.container=document.querySelector(this.options.container):this.container=this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(e=>{var t;const n=null==(t=this.options.handlers)?void 0:t[e];n&&this.addHandler(e,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(e=>{this.attach(e)}),this.quill.on(Ws.events.EDITOR_CHANGE,()=>{const[e]=this.quill.selection.getRange();this.update(e)})):Bl.error("Container required for toolbar",this.options)}addHandler(e,t){this.handlers[e]=t}attach(e){let t=Array.from(e.classList).find(e=>0===e.indexOf("ql-"));if(!t)return;if(t=t.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[t]&&null==this.quill.scroll.query(t))return void Bl.warn("ignoring attaching to nonexistent format",t,e);const n="SELECT"===e.tagName?"change":"click";e.addEventListener(n,n=>{let r;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;const t=e.options[e.selectedIndex];r=!t.hasAttribute("selected")&&(t.value||!1)}else r=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),n.preventDefault();this.quill.focus();const[i]=this.quill.selection.getRange();if(null!=this.handlers[t])this.handlers[t].call(this,r);else if(this.quill.scroll.query(t).prototype instanceof Ai){if(r=prompt(`Enter ${t}`),!r)return;this.quill.updateContents((new Ji).retain(i.index).delete(i.length).insert({[t]:r}),Ws.sources.USER)}else this.quill.format(t,r,Ws.sources.USER);this.update(i)}),this.controls.push([t,e])}update(e){const t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(n=>{const[r,i]=n;if("SELECT"===i.tagName){let n=null;if(null==e)n=null;else if(null==t[r])n=i.querySelector("option[selected]");else if(!Array.isArray(t[r])){let e=t[r];"string"==typeof e&&(e=e.replace(/"/g,'\\"')),n=i.querySelector(`option[value="${e}"]`)}null==n?(i.value="",i.selectedIndex=-1):n.selected=!0}else if(null==e)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const e=t[r],n=e===i.getAttribute("value")||null!=e&&e.toString()===i.getAttribute("value")||null==e&&!i.getAttribute("value");i.classList.toggle("ql-active",n),i.setAttribute("aria-pressed",n.toString())}else{const e=null!=t[r];i.classList.toggle("ql-active",e),i.setAttribute("aria-pressed",e.toString())}})}}function Pl(e,t,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${t}: ${n}`)):r.setAttribute("aria-label",t),e.appendChild(r)}Dl.DEFAULTS={},Dl.DEFAULTS={container:null,handlers:{clean(){const e=this.quill.getSelection();if(null!=e)if(0===e.length){const e=this.quill.getFormat();Object.keys(e).forEach(e=>{null!=this.quill.scroll.query(e,ti.INLINE)&&this.quill.format(e,!1,Ws.sources.USER)})}else this.quill.removeFormat(e.index,e.length,Ws.sources.USER)},direction(e){const{align:t}=this.quill.getFormat();"rtl"===e&&null==t?this.quill.format("align","right",Ws.sources.USER):e||"right"!==t||this.quill.format("align",!1,Ws.sources.USER),this.quill.format("direction",e,Ws.sources.USER)},indent(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0,10);if("+1"===e||"-1"===e){let t="+1"===e?1:-1;"rtl"===n.direction&&(t*=-1),this.quill.format("indent",r+t,Ws.sources.USER)}},link(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,Ws.sources.USER)},list(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,Ws.sources.USER):this.quill.format("list","unchecked",Ws.sources.USER):this.quill.format("list",e,Ws.sources.USER)}}};const Fl='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',Ul={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:Fl,"code-block":Fl,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let $l=0;function zl(e,t){e.setAttribute(t,`${!("true"===e.getAttribute(t))}`)}class Vl{constructor(e){this.select=e,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()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),zl(this.label,"aria-expanded"),zl(this.options,"aria-hidden")}buildItem(e){const t=document.createElement("span");t.tabIndex="0",t.setAttribute("role","button"),t.classList.add("ql-picker-item");const n=e.getAttribute("value");return n&&t.setAttribute("data-value",n),e.textContent&&t.setAttribute("data-label",e.textContent),t.addEventListener("click",()=>{this.selectItem(t,!0)}),t.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.selectItem(t,!0),e.preventDefault();break;case"Escape":this.escape(),e.preventDefault()}}),t}buildLabel(){const e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}buildOptions(){const e=document.createElement("span");e.classList.add("ql-picker-options"),e.setAttribute("aria-hidden","true"),e.tabIndex="-1",e.id=`ql-picker-options-${$l}`,$l+=1,this.label.setAttribute("aria-controls",e.id),this.options=e,Array.from(this.select.options).forEach(t=>{const n=this.buildItem(t);e.appendChild(n),!0===t.selected&&this.selectItem(n)}),this.container.appendChild(e)}buildPicker(){Array.from(this.select.attributes).forEach(e=>{this.container.setAttribute(e.name,e.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(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=Array.from(e.parentNode.children).indexOf(e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let e;if(this.select.selectedIndex>-1){const t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);const t=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",t)}}class Hl extends Vl{constructor(e,t){super(e),this.label.innerHTML=t,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(e=>{e.classList.add("ql-primary")})}buildItem(e){const t=super.buildItem(e);return t.style.backgroundColor=e.getAttribute("value")||"",t}selectItem(e,t){super.selectItem(e,t);const n=this.label.querySelector(".ql-color-label"),r=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Kl extends Vl{constructor(e,t){super(e),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(e=>{e.innerHTML=t[e.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(e,t){super.selectItem(e,t);const n=e||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class Wl{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(e=>{const{overflowY:t}=getComputedStyle(e,null);return"visible"!==t&&"clip"!==t})(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(e){const t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=`${t}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect();let s=0;if(i.right>r.right&&(s=r.right-i.right,this.root.style.left=`${t+s}px`),i.left<r.left&&(s=r.left-i.left,this.root.style.left=`${t+s}px`),i.bottom>r.bottom){const t=i.bottom-i.top,r=e.bottom-e.top+t;this.root.style.top=n-r+"px",this.root.classList.add("ql-flip")}return s}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const Zl=[!1,"center","right","justify"],Gl=["#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"],Yl=[!1,"serif","monospace"],Jl=["1","2","3",!1],Xl=["small",!1,"large","huge"];class Ql extends Ds{constructor(e,t){super(e,t);const n=t=>{document.body.contains(e.root)?(null==this.tooltip||this.tooltip.root.contains(t.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(e=>{e.container.contains(t.target)||e.close()})):document.body.removeEventListener("click",n)};e.emitter.listenDOM("click",document.body,n)}addModule(e){const t=super.addModule(e);return"toolbar"===e&&this.extendToolbar(t),t}buildButtons(e,t){Array.from(e).forEach(e=>{(e.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=t[n]))if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{const r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}buildPickers(e,t){this.pickers=Array.from(e).map(e=>{if(e.classList.contains("ql-align")&&(null==e.querySelector("option")&&ta(e,Zl),"object"==typeof t.align))return new Kl(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){const n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&ta(e,Gl,"background"===n?"#ffffff":"#000000"),new Hl(e,t[n])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?ta(e,Yl):e.classList.contains("ql-header")?ta(e,Jl):e.classList.contains("ql-size")&&ta(e,Xl)),new Vl(e)});this.quill.on(xs.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}}Ql.DEFAULTS=ei({},Ds.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let e=this.container.querySelector("input.ql-image[type=file]");null==e&&(e=document.createElement("input"),e.setAttribute("type","file"),e.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),e.classList.add("ql-image"),e.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,e.files),e.value=""}),this.container.appendChild(e)),e.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class ea extends Wl{constructor(e,t){super(e,t),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",e=>{"Enter"===e.key?(this.save(),e.preventDefault()):"Escape"===e.key&&(this.cancel(),e.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${e}`)||""),this.root.setAttribute("data-mode",e)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:e}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:t}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,xs.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,xs.sources.USER)),this.quill.root.scrollTop=t;break}case"video":e=function(e){let t=e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(t)return`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`;if(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`;return e}(e);case"formula":{if(!e)break;const t=this.quill.getSelection(!0);if(null!=t){const n=t.index+t.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,xs.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",xs.sources.USER),this.quill.setSelection(n+2,xs.sources.USER)}break}}this.textbox.value="",this.hide()}}function ta(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(t=>{const r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(t)),e.appendChild(r)})}const na=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class ra extends ea{constructor(e,t){super(e,t),this.quill.on(xs.events.EDITOR_CHANGE,(e,t,n,r)=>{if(e===xs.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&r===xs.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const e=this.quill.getLines(t.index,t.length);if(1===e.length){const e=this.quill.getBounds(t);null!=e&&this.position(e)}else{const n=e[e.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,t.index+t.length-r),s=this.quill.getBounds(new Ns(r,i));null!=s&&this.position(s)}}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(xs.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const e=this.quill.getSelection();if(null!=e){const t=this.quill.getBounds(e);null!=t&&this.position(t)}},1)})}cancel(){this.show()}position(e){const t=super.position(e),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==t&&(n.style.marginLeft=-1*t-n.offsetWidth/2+"px"),t}}t(ra,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class ia extends Ql{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=na),super(e,t),this.quill.container.classList.add("ql-bubble")}extendToolbar(e){this.tooltip=new ra(this.quill,this.options.bounds),null!=e.container&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll("button"),Ul),this.buildPickers(e.container.querySelectorAll("select"),Ul))}}ia.DEFAULTS=ei({},Ql.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1,Ws.sources.USER)}}}}});const sa=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class oa extends ea{constructor(){super(...arguments),t(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(null!=this.linkRange){const e=this.linkRange;this.restoreFocus(),this.quill.formatText(e,"link",!1,xs.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(xs.events.SELECTION_CHANGE,(e,t,n)=>{if(null!=e){if(0===e.length&&n===xs.sources.USER){const[t,n]=this.quill.scroll.descendant(gl,e.index);if(null!=t){this.linkRange=new Ns(e.index-n,t.length());const r=gl.formats(t.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const i=this.quill.getBounds(this.linkRange);return void(null!=i&&this.position(i))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}t(oa,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class la extends Ql{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=sa),super(e,t),this.quill.container.classList.add("ql-snow")}extendToolbar(e){null!=e.container&&(e.container.classList.add("ql-snow"),this.buildButtons(e.container.querySelectorAll("button"),Ul),this.buildPickers(e.container.querySelectorAll("select"),Ul),this.tooltip=new oa(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(t,n)=>{e.handlers.link.call(e,!n.format.link)}))}}la.DEFAULTS=ei({},Ql.DEFAULTS,{modules:{toolbar:{handlers:{link(e){if(e){const e=this.quill.getSelection();if(null==e||0===e.length)return;let t=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(t)&&0!==t.indexOf("mailto:")&&(t=`mailto:${t}`);const{tooltip:n}=this.quill.theme;n.edit("link",t)}else this.quill.format("link",!1,Ws.sources.USER)}}}}}),Ws.register({"attributors/attribute/direction":yo,"attributors/class/align":lo,"attributors/class/background":fo,"attributors/class/color":uo,"attributors/class/direction":xo,"attributors/class/font":Eo,"attributors/class/size":Ao,"attributors/style/align":ao,"attributors/style/background":po,"attributors/style/color":ho,"attributors/style/direction":wo,"attributors/style/font":ko,"attributors/style/size":So},!0),Ws.register({"formats/align":lo,"formats/direction":xo,"formats/indent":cl,"formats/background":po,"formats/color":ho,"formats/font":Eo,"formats/size":Ao,"formats/blockquote":ul,"formats/code-block":go,"formats/header":dl,"formats/list":fl,"formats/bold":pl,"formats/code":vo,"formats/italic":ml,"formats/link":gl,"formats/script":bl,"formats/strike":yl,"formats/underline":xl,"formats/formula":wl,"formats/image":El,"formats/video":Al,"modules/syntax":ql,"modules/table":class extends Ls{static register(){Ws.register(Tl),Ws.register(Ll),Ws.register(Il),Ws.register(Rl)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Rl).forEach(e=>{e.balanceCells()})}deleteColumn(){const[e,,t]=this.getTable();null!=t&&(e.deleteColumn(t.cellOffset()),this.quill.update(Ws.sources.USER))}deleteRow(){const[,e]=this.getTable();null!=e&&(e.remove(),this.quill.update(Ws.sources.USER))}deleteTable(){const[e]=this.getTable();if(null==e)return;const t=e.offset();e.remove(),this.quill.update(Ws.sources.USER),this.quill.setSelection(t,Ws.sources.SILENT)}getTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==e)return[null,null,null,-1];const[t,n]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==Tl.blotName)return[null,null,null,-1];const r=t.parent;return[r.parent.parent,r,t,n]}insertColumn(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=i.cellOffset();n.insertColumn(s+e),this.quill.update(Ws.sources.USER);let o=r.rowOffset();0===e&&(o+=1),this.quill.setSelection(t.index+o,t.length,Ws.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=r.rowOffset();n.insertRow(s+e),this.quill.update(Ws.sources.USER),e>0?this.quill.setSelection(t,Ws.sources.SILENT):this.quill.setSelection(t.index+r.children.length,t.length,Ws.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(e,t){const n=this.quill.getSelection();if(null==n)return;const r=new Array(e).fill(0).reduce(e=>{const n=new Array(t).fill("\n").join("");return e.insert(n,{table:Ml()})},(new Ji).retain(n.index));this.quill.updateContents(r,Ws.sources.USER),this.quill.setSelection(n.index,Ws.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(Ws.events.SCROLL_OPTIMIZE,e=>{e.some(e=>!!["TD","TR","TBODY","TABLE"].includes(e.target.tagName)&&(this.quill.once(Ws.events.TEXT_CHANGE,(e,t,n)=>{n===Ws.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":Dl,"themes/bubble":ia,"themes/snow":la,"ui/icons":Ul,"ui/picker":Vl,"ui/icon-picker":Kl,"ui/color-picker":Hl,"ui/tooltip":Wl},!0);const aa=({value:e,onChange:t,placeholder:i,style:s})=>{const o=r.useRef(null),l=r.useRef(null);return r.useEffect(()=>{if(o.current&&!l.current){l.current=new Ws(o.current,{theme:"snow",modules:{toolbar:[[{header:[1,2,!1]}],["bold","italic","underline"],["link","image"]]},placeholder:i});const e=l.current;e.on("text-change",(n,r,i)=>{if("user"===i){const n=e.root.innerHTML;null==t||t("<p><br></p>"===n?"":n)}})}},[i]),r.useEffect(()=>{const t=l.current;if(t&&e!==t.root.innerHTML){const n=0===t.getText().trim().length;!e&&n||t.clipboard.dangerouslyPasteHTML(e||"")}},[e]),n.jsx("div",{ref:o,style:{minHeight:"200px",...s}})},ca="_fileUploadWrapper_byo9w_1",ua=({value:e,onChange:t,accept:o=".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar",listType:l="text",maxCount:a=1,key:c,disabled:u=!1,maxSize:d=1e3,buttonText:h="上传文件"})=>{const[p,m]=r.useState(!1),[g,v]=r.useState(""),[b,y]=r.useState(""),[x,w]=r.useState("none"),[N,E]=r.useState([]),[k,A]=r.useState(!1),S=e=>{try{const n=e.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(t){}return r||"未知文件"}catch(n){return"未知文件"}},C=e=>e?Array.isArray(e)?e.filter(Boolean):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const t=C(e);return JSON.stringify(t)},[e]),O=r.useRef(N);r.useEffect(()=>{O.current=N},[N]),r.useEffect(()=>{if(k)return void A(!1);const t=C(e),n=O.current.filter(e=>"done"===e.status).map(e=>e.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(t))if(t.length>0){const e=t.map((e,t)=>({uid:`-${t+1}`,name:S(e),status:"done",url:e}));E(e)}else E([])},[j,k]);const q=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:ca,children:[n.jsx(i.Upload,{accept:o,listType:l,fileList:N,onPreview:async e=>{const t=e.url||e.preview,n=e.name||"",r=(e=>{const t=e.substring(e.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(t)?"image":[".txt",".json",".xml",".log"].includes(t)?"text":"none"})(n);y(n),w(r),"image"===r?(e.url||e.preview||!e.originFileObj||(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),v(e.url||e.preview),m(!0)):t?window.open(t,"_blank"):i.message.info("文件预览不可用")},onChange:({file:e,fileList:t})=>{var n,r;if(A(!0),"done"===e.status){if(null==(n=e.response)?void 0:n.data){i.message.success(`${e.name} 文件上传成功`);const n=t.map(t=>{var n;return t.uid===e.uid&&(null==(n=t.response)?void 0:n.data)?{...t,url:t.response.data,name:t.name}:t});E(n);const r=n.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(r[0]||void 0):null==q||q(r.length>0?r:void 0)}else i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),E(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 文件已移除`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(void 0):null==q||q(n.length>0?n:void 0)}else if("error"===e.status){i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(n[0]||void 0):null==q||q(n.length>0?n:void 0)}else E(t)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:o,onProgress:l}=e,a=1024*d*1024;if(o instanceof File&&o.size>a)return i.message.error(`文件大小不能超过 ${d}MB`),void r(new Error(`文件大小不能超过 ${d}MB`));const c=new FormData;c.append("file",o);const u=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;u&&c.append("orgId",u.toString());try{const e=await(async(e,t)=>{const n=f.getToken();try{return(await s.post("/api/sterilization-service/common/uploadFile",e,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==t?void 0:t.headers},onUploadProgress:null==t?void 0:t.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&l({percent:e.loaded/e.total*100})}});e&&e.data?n(e,o):r(new Error("上传成功但响应中缺少文件URL"),e)}catch(h){r(h)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:e=>!0,children:N.length>=(a||1)?null:n.jsx(i.Button,{icon:n.jsx(Je,{}),disabled:u,type:"primary",children:h})},c),n.jsxs(i.Modal,{visible:p,title:b,footer:null,onCancel:()=>{m(!1),v(""),w("none")},width:"image"===x?800:600,children:["image"===x&&n.jsx("img",{alt:"预览",style:{width:"100%"},src:g}),"text"===x&&n.jsx("pre",{style:{maxHeight:"500px",overflow:"auto",whiteSpace:"pre-wrap"},children:g})]})]})},da="_treeselectEllipsis_1cbt4_1",ha="_addonAfterSelect_1cbt4_19",fa="_customDisabled_1cbt4_23",pa=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}),ma=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,maxSize:a=5,disabled:c=!1,...u})=>{const[d,h]=r.useState(!1),[f,p]=r.useState(""),[m,g]=r.useState(""),[v,b]=r.useState([]),y=e=>e?e.startsWith("data:")?e:`data:image/png;base64,${e}`:"",x=e=>e?e.includes(",")?e.split(",")[1]:e:"";r.useEffect(()=>{if(e&&Array.isArray(e)&&e.length>0){const t=e.map((e,t)=>{let n="",r="";if("string"==typeof e)r=x(e),n=y(e);else if(Array.isArray(e)&&e.length>0&&"number"==typeof e[0]){const t=(e=>{try{const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return`data:image/png;base64,${btoa(n)}`}catch(t){return""}})(e);r=x(t),n=t}return{uid:`-${t}`,name:`image-${t}.png`,status:"done",url:n,thumbUrl:n,response:{data:r,url:n}}});b(t)}else b([])},[e]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{children:[n.jsx($e,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:v,onPreview:async e=>{let t=e.url;if(t||e.preview||!e.originFileObj?!t&&e.preview&&(t=e.preview):(e.preview=await pa(e.originFileObj),t=e.preview),!t)return void i.message.error("无法预览图片:未找到图片数据");p(t),h(!0);const n=e.name||"预览图片";g(n)},onChange:async({file:e,fileList:t})=>{var n,r,s;const o=e=>{var t,n;return(null==(t=e.response)?void 0:t.data)&&"string"==typeof e.response.data?x(e.response.data):(null==(n=e.response)?void 0:n.url)&&"string"==typeof e.response.url?x(e.response.url):e.url&&"string"==typeof e.url?x(e.url):e.preview&&"string"==typeof e.preview?x(e.preview):null};if("done"===e.status){const s=(null==(n=e.response)?void 0:n.data)||(null==(r=e.response)?void 0:r.url)||e.url||e.preview;if(s&&"string"==typeof s){i.message.success(`${e.name} 处理成功`);const n=y(s),r=t.map(t=>t.uid===e.uid?{...t,url:n,thumbUrl:n,response:{...e.response,data:x(s),url:n}}:t);b(r);const l=r.filter(e=>"done"===e.status).map(o).filter(Boolean);w(l.length>0?l:void 0)}else i.message.error(`${e.name} 处理失败:无法获取图片数据`),b(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 已移除`),b(t);const n=t.filter(e=>"done"===e.status).map(o).filter(Boolean);w(n.length>0?n:void 0)}else"error"===e.status?(i.message.error(`${e.name} 处理失败: ${(null==(s=e.error)?void 0:s.message)||"未知错误"}`),b(t)):b(t)},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e,o=1024*a*1024;if(r instanceof File&&r.size>o)return i.message.error(`图片大小不能超过 ${a}MB`),void(null==n||n(new Error(`图片大小不能超过 ${a}MB`)));try{s({percent:0});const e=await pa(r),n=x(e);s({percent:100});t({data:n,url:e,preview:e},r)}catch(l){i.message.error((null==l?void 0:l.message)||"图片处理失败"),n(l)}},beforeUpload:e=>{const t=1024*a*1024;if(e.size>t)return i.message.error(`图片大小不能超过 ${a}MB`),i.Upload.LIST_IGNORE;return!!e.type.startsWith("image/")||(i.message.error("只能上传图片文件"),i.Upload.LIST_IGNORE)},maxCount:l,disabled:c,...u,children:l&&v.length>=l?null:N}),n.jsx(i.Modal,{open:d,title:m,footer:null,onCancel:()=>h(!1),width:800,children:n.jsx("img",{alt:"preview",style:{width:"100%"},src:f})})]})},{RangePicker:ga}=i.DatePicker,{TextArea:va}=i.Input,ba=r.forwardRef((e,t)=>{var s;const{visible:c,mode:u,config:d,initialValues:h,onOk:p,onCancel:m,title:g,loading:v=!1,oneditFormChange:b,modalProps:y={},CustomModalFooter:x,tab:w=!1,validateConfig:N}=e,[E]=i.Form.useForm(),k="view"==u;r.useImperativeHandle(t,()=>({setFieldsValue:e=>{E.setFieldsValue(e)},getFieldsValue:()=>E.getFieldsValue()})),r.useEffect(()=>{if(c)if(E.resetFields(),"edit"!==u&&"view"!==u||!h){const e=[];w?d.forEach(t=>{t.children.forEach(t=>{var n,r;e.push({...t,defaultValue:t.defaultValue||(null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value)||t.defaultValue})})}):d.forEach(t=>{e.push({...t,defaultValue:t.defaultValue||t.defaultValue})}),(null==e?void 0:e.length)>0&&(null==e||e.forEach(e=>{E.setFieldsValue({[null==e?void 0:e.name]:null==e?void 0:e.defaultValue})})),L(E.getFieldValue("useOrgId")||O)}else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else{const e={...h};d.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else E.resetFields()},[c,u,h,E]),r.useEffect(()=>{if(c)if("edit"!==u&&"view"!==u||!h)L(E.getFieldValue("useOrgId")||O);else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else{const e={...h};d.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),i=e[n],s=e[r];i&&s&&(e[t.name]=[o(i),o(s)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else E.resetFields()},[d]);const A=r.useCallback(e=>{if(w){for(const t of d)if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n.label}}else{const t=d.find(t=>t.name===e);if(t)return t.label}return e},[d,w]),S=r.useCallback((e,t)=>{const n=[];let r="";const i=new Set;return t&&Array.isArray(t)&&t.length>0&&(t.forEach(t=>{const s=e.filter(e=>t.includes(e.field)&&!i.has(e.field));if(s.length>1){const e=s.map(e=>A(e.field)).join("、")+"同时重复";s.forEach(t=>{n.push({name:t.field,errors:[e]}),i.add(t.field)}),r||(r=e)}else if(1===s.length){const e=s[0],t=A(e.field)+"重复";n.push({name:e.field,errors:[t]}),i.add(e.field),r||(r=t)}}),e.forEach(e=>{if(!i.has(e.field)){const t=A(e.field)+"重复";n.push({name:e.field,errors:[t]}),r||(r=t)}})),{errorFields:n,errorMessage:r||"验证失败"}},[A]),C=r.useMemo(()=>{if(!(null==N?void 0:N.realtime))return()=>{};const e=N.realtimeDelay||500;return l.debounce((e,t)=>{(async(e,t)=>{if(!N||!N.realtime)return;const{validateApi:n,validateFields:r,validateMethod:i="POST",validateParams:s,validateMessage:o="验证失败",union:l=!0,group:a}=N,c=t&&r.includes(t)?[t]:r,u=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;let d;if(s)d=s(e);else{const t={};c.forEach(n=>{void 0!==e[n]&&null!==e[n]&&""!==e[n]&&(t[n]=e[n])}),d={field:c,value:t,id:u,union:l?1:0,group:a}}const f="GET"===i?await _(d,n):await q(d,n);if(200===f.code&&Array.isArray(f.data)){const e=f.data.filter(e=>!0===e.value);if(f.data.forEach(e=>{!1===e.value&&E.setFields([{name:e.field,errors:[]}])}),e.length>0){let t=[];if(a&&Array.isArray(a)&&a.length>0){const n=S(e,a);t=n.errorFields}else if(l&&e.length>1){const n=e.map(e=>A(e.field)).join("、")+"同时重复";e.forEach(e=>{t.push({name:e.field,errors:[n]})})}else e.forEach(e=>{const n=A(e.field);t.push({name:e.field,errors:[n+"重复"]})});t.length>0&&E.setFields(t)}}})(e,t).catch(()=>{})},e)},[N]),j=(e,t)=>{if("name"==t.name&&!(null==E?void 0:E.getFieldValue("pyCode"))){const t=(n=e.target.value,a.pinyin(n,{pattern:"first",toneType:"none",type:"array",nonZh:"consecutive"}).join("").toUpperCase());E.setFieldsValue({pyCode:t})}var n},O=null==(s=f.getOrgInfo())?void 0:s.orgId,[T,L]=r.useState(O),I=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"deptSelect"===e.type):"deptSelect"===e.type),[d,w]),M=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"orgSelect"===e.type):"orgSelect"===e.type),[d,w]);r.useEffect(()=>{I&&U()},[T,I]),r.useEffect(()=>{M&&$()},[M]);const[B,D]=r.useState([]),[P,F]=r.useState([]),U=async()=>{const e=await q({orgId:T,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===e.code){const t=[{name:"通用",id:-1},...e.data||[]];D(t||[])}},$=async()=>{const e=await q({loginOrgId:O,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&F((null==e?void 0:e.data)||[])},z=e=>{if("view"!==u)return;const t=E.getFieldValue(e);if(null==t||""===t)return void i.message.warning("没有内容可复制");let n="";if("object"==typeof t)if(o.isDayjs(t))n=t.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(t))n=t.map(e=>o.isDayjs(e)?e.format("YYYY-MM-DD HH:mm:ss"):String(e)).join(", ");else if(t.addProvince){const e=[t.addProvince,t.addCity,t.addCounty,t.addStreet,t.address].filter(Boolean);n=e.join("-")}else n=JSON.stringify(t);else n=String(t);navigator.clipboard.writeText(n).then(()=>{i.message.success("已复制到剪贴板")}).catch(()=>{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),i.message.success("已复制到剪贴板")}catch(t){}document.body.removeChild(e)})},V=e=>{var t,r,s,o;const{type:l,name:a,placeholder:c,options:u,rules:d,...h}=e,f=k?"":c||`请输入${e.label}`,p=k?"":c||`请选择${e.label}`;switch(l){case"input":return n.jsx(i.Input,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a),onBlur:t=>j(t,e)});case"inputoption":return n.jsx(i.Input,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a),addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(r=null==(t=e.options)?void 0:t[0])?void 0:r.value,children:n.jsx(R,{disabled:k,options:e.options,allowClear:!k})})});case"inputnumberoption":return n.jsx(i.InputNumber,{className:ha,placeholder:f,addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(o=null==(s=e.options)?void 0:s[0])?void 0:o.value,children:n.jsx(R,{disabled:k,options:e.options,allowClear:!k})}),...h});case"password":return n.jsx(i.Input.Password,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)});case"rangePicker":return n.jsx(ga,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:[p||"开始日期",p||"结束日期"],...h,disabled:k||h.disabled,allowClear:!k});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:p,...h,disabled:k||h.disabled,allowClear:!k});case"InputNumber":return n.jsx(i.InputNumber,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)});case"Radio":return n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(i.Radio.Group,{style:{pointerEvents:k?"none":"auto",...h.style},disabled:k||h.disabled,options:u,...h})});case"Checkbox":return n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(i.Checkbox.Group,{style:{width:"100%",pointerEvents:k?"none":"auto",...h.style||{}},options:u,disabled:k||h.disabled,...h})});case"treeSelect":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(R,{className:da,allowClear:!k,style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:k||h.disabled})})})}case"select":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(R,{className:da,allowClear:!k,style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:k||h.disabled})})})}case"upload":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(nt,{value:e.value,...h},`upload_${e.name}`)})});case"file":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ua,{...h})})});case"textarea":return n.jsx(va,{rows:4,placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)});case"area":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(tt,{...h,disabled:k})})});case"richText":const{style:l,...c}=h;return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(aa,{style:l})})});case"doubleValue":return n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx(i.Form.Item,{name:e.firstLabel||"first",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:e.firstPlaceholder||`请输入${e.firstLabel||"最小值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.separator||"至"}),n.jsx(i.Form.Item,{name:e.secondLabel||"second",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%",cursor:k?"not-allowed":"auto",...h.style},placeholder:e.secondPlaceholder||`请输入${e.secondLabel||"最大值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.lastUnit})]});case"deptSelect":return n.jsx(R,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:B,disabled:k||h.disabled,...h});case"orgSelect":return n.jsx(R,{onChange:e=>{L(e)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:P,disabled:k||h.disabled,...h});case"uploadByte":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ma,{disabled:k||h.disabled,...h})})});default:return n.jsx(i.Input,{placeholder:f,...h,readOnly:k||h.readOnly,onDoubleClick:()=>z(a)})}},H=g||("add"===u?"新增":"edit"===u?"编辑":"查看"),K=e=>{const t=e.findIndex(e=>"upload"===e.type||"uploadByte"===e.type);if(-1===t||1===(e[t].uploadRowSpan||1))return n.jsx(i.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))});const r=e[t],s=r.colSpan||6,o=r.uploadRowSpan||1,l=e.slice(0,t),a=e.slice(t+1);let c=0,u=[];const d=[];for(const n of a){const e=n.colSpan||6;c+e>24?(u.length&&d.push(u),u=[n],c=e):(u.push(n),c+=e)}u.length&&d.push(u);const h=d.slice(0,o),f=d.slice(o);return n.jsxs(n.Fragment,{children:[l.length>0&&n.jsx(i.Row,{gutter:24,justify:"start",children:l.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))}),n.jsxs("div",{style:{display:"flex",alignItems:"flex-start"},children:[n.jsx("div",{style:{width:s/24*100+"%",flexShrink:0,paddingRight:12},children:n.jsx(i.Form.Item,{label:r.label,name:r.name,rules:r.rules,initialValue:r.defaultValue,className:k||r.disabled?fa:"",children:V(r)},r.name)}),n.jsx("div",{style:{flex:1,overflow:"hidden"},children:h.map((e,t)=>n.jsx(i.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))},t))})]}),f.map((e,t)=>n.jsx(i.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?fa:"",children:V(e)},e.name)},e.name))},`below-${t}`))]})},W=()=>w?n.jsx(i.Tabs,{children:d.map(e=>n.jsx(i.Tabs.TabPane,{tab:e.label,children:K((null==e?void 0:e.children)||[])},e.label))}):K(d);return n.jsx(i.Modal,{title:H,open:c,onOk:async()=>{try{const e=await E.validateFields();N&&await(async e=>{var t,n,r,i,s,o;if(!N)return;const{validateApi:l,validateFields:a,validateMethod:c="POST",validateParams:u,validateMessage:d="验证失败",union:f=!1,group:p=[]}=N,m=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;if(u){const r=u(e),i="GET"===c?await _(r,l):await q(r,l);if(200!==i.code){const e=i.msg||d;throw new Error(e)}if(Array.isArray(i.data)){const e=i.data.filter(e=>!0===e.value);if(e.length>0){const t=e.map(e=>({name:e.field,errors:[d]}));throw E.setFields(t),new Error(d)}}else if(!1===i.data||!1===(null==(t=i.data)?void 0:t.valid)){const e=(null==(n=i.data)?void 0:n.message)||i.msg||d;throw new Error(e)}return}if(p&&p.length>0){const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0,group:p},s="GET"===c?await _(n,l):await q(n,l);if(200!==s.code){const e=s.msg||d;throw new Error(e)}if(Array.isArray(s.data)){const e=s.data.filter(e=>!0===e.value);if(e.length>0){const{errorFields:t,errorMessage:n}=S(e,p);throw E.setFields(t),new Error(n)}}else if(!1===s.data||!1===(null==(r=s.data)?void 0:r.valid)){const e=(null==(i=s.data)?void 0:i.message)||s.msg||d;throw new Error(e)}}else{const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0},r="GET"===c?await _(n,l):await q(n,l);if(200!==r.code){const e=r.msg||d;throw new Error(e)}if(Array.isArray(r.data)){const e=r.data.filter(e=>!0===e.value);if(e.length>0){let t=[],n=d;if(p&&Array.isArray(p)&&p.length>0){const r=S(e,p);t=r.errorFields,n=r.errorMessage}else if(f&&e.length>1){const r=e.map(e=>A(e.field));n=r.join("、")+"同时重复",t=e.map(e=>({name:e.field,errors:[n]}))}else t=e.map(e=>{const t=A(e.field);return{name:e.field,errors:[t+"重复"]}}),1===e.length&&(n=A(e[0].field)+"重复");throw E.setFields(t),new Error(n)}}else if(!1===r.data||!1===(null==(s=r.data)?void 0:s.valid)){const e=(null==(o=r.data)?void 0:o.message)||r.msg||d;throw new Error(e)}}})(e);const t={...e},n=[];w?d.forEach(e=>{e.children&&n.push(...e.children)}):n.push(...d),n.forEach(e=>{var n,r,i,s;if(void 0===e.defaultValue||void 0!==t[e.name]&&null!==t[e.name]||(t[e.name]=e.defaultValue),"datePicker"===e.type&&t[e.name])o.isDayjs(t[e.name])&&(t[e.name]=e.dateFormat?t[e.name].format(e.dateFormat):t[e.name].toISOString());else if("rangePicker"===e.type&&t[e.name])if("string"==typeof e.name&&e.name.includes("/")){const[n,r]=e.name.split("/");if(Array.isArray(t[e.name])&&2===t[e.name].length){const[i,s]=t[e.name],l=t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t;t[n]=l(i),t[r]=l(s),delete t[e.name]}}else Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t));if("select"===e.type&&e.labelName){const i=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t[e.name]}),s=i?i[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0;t[e.labelName]=s}if("treeSelect"===e.type&&e.multiple&&(t[e.name]=null==(i=t[e.name])?void 0:i.join(","),e.labelName)){const n=((null==(s=t[e.name])?void 0:s.split(","))||[]).map(t=>{var n,r;const i=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t});return i?i[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0}).filter(Boolean);t[e.labelName]=n.join(",")}if("Radio"===e.type&&e.options&&void 0!==t[e.name]&&null!==t[e.name]){const n=e.options.find(n=>n.value==t[e.name]);n&&"number"==typeof n.value&&(t[e.name]=Number(t[e.name]))}}),await p(t)}catch(e){(null==e?void 0:e.message)&&(i.message.error(e.message),(null==e?void 0:e.errorFields)&&E.setFields(e.errorFields))}},onCancel:m,width:y.width||800,confirmLoading:v,destroyOnClose:!0,maskClosable:!1,footer:(e,{OkBtn:t,CancelBtn:r})=>n.jsxs(n.Fragment,{children:[x&&x(E.getFieldsValue()),n.jsx(r,{}),n.jsx(t,{})]}),...y,children:n.jsx(i.Form,{form:E,name:`modal_form_${u}`,layout:"vertical",onValuesChange:(e,t)=>{if(b&&b(e,t),null==N?void 0:N.realtime){const n=Object.keys(e)[0];C(t,n)}},children:n.jsx(W,{})})})}),ya="_container_18q8s_1",xa="_searchForm_18q8s_9",wa="_tableContainer_18q8s_15",Na="_pagination_18q8s_44",Ea="_selectedRow_18q8s_63",ka=r.forwardRef(({searchFormConfig:e,addFormConfig:t,tableColumns:s,URL:o,editText:a,viewText:c,delText:u,CustomOperations:d,classjson:h,postParams:f,proplist:p,topHeight:m,isnopage:g,PropOtherButton:v,CustomModalFooter:b,editdclickback:y,oneditFormChange:x,onSearchFormChange:w,addisdisabled:N={isdisabled:!1,message:""},tableHeight:E=150,limit:k={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:A,onRowClick:S,onDelete:C,tableId:j,isaddtab:O=!1,validateConfig:_,tableConfig:L,isReset:I=!1,isResetdefault:R=!1,actionDisabled:M,actionToolTips:D,notoken:P=!1,...F},U)=>{r.useImperativeHandle(U,()=>({getList:async()=>fe(),setFieldsValue:e=>{var t;null==(t=oe.current)||t.setFieldsValue(e)},getFieldsValue:()=>{var e;return null==(e=oe.current)?void 0:e.getFieldsValue()},reload:()=>{fe()},setCurrentRecord:e=>{Q(e)},getSearchFieldsValue:()=>{var e;return null==(e=he.current)?void 0:e.getFieldsValue()},setSearchFieldsValue:e=>{var t;null==(t=he.current)||t.setFieldsValue(e)}}));const[$,z]=r.useState(!1),[V,H]=r.useState([]),[K,W]=r.useState({current:1,pageSize:50,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}),[Z,G]=r.useState(!1),[Y,J]=r.useState("add"),[X,Q]=r.useState(null),[ee,te]=r.useState([]),[ne,re]=r.useState([]),[ie,se]=r.useState([]),oe=r.useRef(null),le=r.useRef(f),ae=r.useRef(K),ce=r.useRef(null),[ue,de]=r.useState(0),he=r.useRef(null);r.useEffect(()=>{le.current=f},[f]),r.useEffect(()=>{ae.current=K},[K]),r.useEffect(()=>{Z||Q(null)},[Z]);const fe=l.debounce(async e=>{var t,n;if(!(null==o?void 0:o.search))return;const r=he.current.getFieldsValue(),i={...null==(t=le.current)?void 0:t.searchParams,...e,pageNum:ae.current.current,pageSize:ae.current.pageSize,...r};g&&delete i.pageNum,g&&delete i.pageSize,z(!0);try{const e=P?T:q,t=await e(i,o.search);if(200===t.code){const e=(null==(n=null==t?void 0:t.data)?void 0:n.list)||(null==t?void 0:t.data),r=e.map(e=>(e.hasOwnProperty("addCountyCode")&&(e.alladdress={...e}),e)).map(e=>(e.alladdress={...e},e));H(r||[]),W(e=>{var n,r;return{...e,current:null==(n=null==t?void 0:t.data)?void 0:n.pageNum,total:null==(r=null==t?void 0:t.data)?void 0:r.total}})}else H([]),W(e=>({...e,total:0,current:1}))}catch(s){H([]),W(e=>({...e,total:0,current:1}))}finally{z(!1)}},100);r.useEffect(()=>{(null==o?void 0:o.search)&&fe()},[K.current,K.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(ce.current&&ie.length>0){const e=ce.current.offsetHeight;de(e)}},[ie]);const pe=r.useRef(null);r.useEffect(()=>{const e={title:"操作",key:"action",align:"center",width:A||150,fixed:"right",render:(e,t)=>{const r=M?M(t):{},s=D?D(t):{},l=r.edit||!1,h=r.view||!1,f=r.delete||!1,p=(e,t,r,s,o)=>{const l=e?n.jsx("span",{style:{color:"rgba(0,0,0,0.25)",cursor:"not-allowed",...o},children:r}):n.jsx("a",{onClick:s,style:o,children:r});return t?n.jsx(i.Tooltip,{title:t,children:l}):l};return n.jsx(n.Fragment,{children:n.jsxs(i.Space,{size:"small",ref:pe,children:["function"==typeof d?d(t):d,o.edit&&k.editLimit&&p(l,s.editTooltip,a||"编辑",()=>ge(t)),(o.view||o.edit)&&k.addLimit&&p(h,s.viewTooltip,c||"查看",()=>ve(t)),o.delete&&k.delLimit&&p(f,s.deleteTooltip,u||"删除",()=>be(t),{color:f?"rgba(0,0,0,0.25)":"#f5222d"})]})})}},t=o.edit||o.delete||o.view||d,r=[...s],l=t?[...r,e]:r;re(l)},[]),r.useEffect(()=>{e&&se(e)},[e]),r.useEffect(()=>{t&&te(t)},[t]);const me=()=>{Q(null),J("add"),G(!0),y&&y()},ge=e=>{Q(e),J("edit"),G(!0),y&&y(e)},ve=e=>{Q(e),J("view"),G(!0)},be=async e=>{o.delete&&i.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{z(!0);const t=P?T:q;if(200===(await t({id:e.id,...null==f?void 0:f.delParams},o.delete)).code){C&&C(e),i.message.success(`${u||"删除"}成功`);const t=K.current,n=K.pageSize,r=K.total-1;r>0&&(t-1)*n>=r&&t>1?(W(e=>({...e,current:e.current-1})),setTimeout(()=>{fe()},0)):fe()}}catch(t){}finally{z(!1)}}})},ye=window.parent!==window.self,xe={"--table-height":ye?`calc(100vh - ${ue}px - ${E}px + 39px)`:`calc(100vh - ${ue}px - ${E}px - 16px)`,height:ye?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:ya,style:xe,children:[ie.length>0||!m?n.jsx("div",{className:xa,ref:ce,children:n.jsx(B,{config:ie,onSearch:()=>{W(e=>({...e,current:1})),fe()},onReset:()=>{W(e=>({...e,current:1})),fe()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:v||(()=>o.add&&k.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(i.Tooltip,{title:N.isdisabled?N.message:"",children:n.jsx(i.Button,{type:"primary",onClick:me,disabled:N.isdisabled,children:"新建"})})})),ref:he,onSearchFormChange:(e,t)=>{w&&w(e,t)},isReset:I,isResetdefault:R})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:wa,style:{height:`calc(100% - ${ue}px-35px)`},children:[n.jsx(et,{page:K,virtual:g,tableId:j,scroll:{x:"1200px",y:"calc(100vh - 500px)"},onRowClick:(e,t)=>((e,t)=>{S&&S(e,t),Q(e)})(e,t),rowClassName:e=>e.id===(null==X?void 0:X.id)?Ea:"",columns:ne,dataSource:p||V,loading:$,pagination:!1,onChange:e=>{W(t=>({...t,current:e.current,pageSize:e.pageSize}))},rowKey:"id",...L,...F}),!g&&n.jsx("div",{className:Na,children:n.jsx(i.Pagination,{size:"small",onChange:(e,t)=>{W(n=>({...n,current:e,pageSize:t}))},...K,showQuickJumper:!1})})]}),n.jsx(ba,{validateConfig:_,CustomModalFooter:b,ref:oe,oneditFormChange:x,visible:Z,mode:Y,config:"view"===Y?ee.map(e=>({...e,disabled:!0})):ee,initialValues:X,onOk:async e=>{if(e.alladdress&&(e={...e,...e.alladdress}),"view"!==Y){z(!0);try{let t;const n=P?T:q;t="add"==Y?await n({...e,...null==f?void 0:f.addParams},o.add):await n({id:null==X?void 0:X.id,...e,...null==f?void 0:f.editParams},o.edit),200==t.code&&(i.message.success(("add"===Y?"添加":"更新")+"成功"),G(!1),fe())}catch(t){}finally{z(!1)}}else G(!1)},onCancel:()=>G(!1),title:(()=>{switch(Y){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:$,tab:O,modalProps:"view"===Y?{footer:[n.jsx(i.Button,{onClick:()=>G(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),Aa=r.memo(ka);exports.CommonPage=Aa,exports.CustomAdd=ba,exports.CustomForm=B,exports.CustomTable=et,exports.NomalSelect=R;
|
|
7
7
|
//# sourceMappingURL=index.cjs.map
|