quill-table-up 2.4.0 → 2.4.1

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.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`quill`)):typeof define==`function`&&define.amd?define([`exports`,`quill`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TableUp={},e.Quill))})(this,function(exports,t){Object.defineProperty(exports,`__esModule`,{value:!0});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},l=(e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e));t=l(t);function u(e,t){this.v=e,this.k=t}function d(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e){if(Array.isArray(e))return e}function p(e){if(Array.isArray(e))return d(e)}function m(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function h(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){h(a,r,i,o,s,`next`,e)}function s(e){h(a,r,i,o,s,`throw`,e)}o(void 0)})}}function _(e,t,n){return t=w(t),te(e,E()?Reflect.construct(t,n||[],w(e).constructor):t.apply(e,n))}function v(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,R(r.key),r)}}function b(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function x(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=oe(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function S(e,t,n){return(t=R(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(){return C=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=re(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},C.apply(null,arguments)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function T(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&ne(e,t)}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}function D(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function O(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function k(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(){throw TypeError(`Invalid attempt to spread non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j(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 M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t){if(e==null)return{};var n,r,i=ee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function te(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return m(e)}function P(){"use strict";P=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=typeof Symbol==`function`?Symbol:{},a=i.iterator||`@@iterator`,o=i.asyncIterator||`@@asyncIterator`,s=i.toStringTag||`@@toStringTag`;function c(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r})}try{c({},``)}catch(e){c=function(e,t,n){return e[t]=n}}function l(t,n,r,i){var a=n&&n.prototype instanceof f?n:f,o=Object.create(a.prototype);return c(o,`_invoke`,function(t,n,r){var i=1;return function(a,o){if(i===3)throw Error(`Generator is already running`);if(i===4){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=x(s,r);if(c){if(c===d)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===1)throw i=4,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=3;var l=u(t,n,r);if(l.type===`normal`){if(i=r.done?4:2,l.arg===d)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=4,r.method=`throw`,r.arg=l.arg)}}}(t,r,new w(i||[])),!0),o}function u(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=l;var d={};function f(){}function p(){}function m(){}var h={};c(h,a,function(){return this});var g=Object.getPrototypeOf,_=g&&g(g(T([])));_&&_!==n&&r.call(_,a)&&(h=_);var v=m.prototype=f.prototype=Object.create(h);function y(e){[`next`,`throw`,`return`].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function b(e,t){function n(i,a,o,s){var c=u(e[i],e,a);if(c.type!==`throw`){var l=c.arg,d=l.value;return d&&typeof d==`object`&&r.call(d,`__await`)?t.resolve(d.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(d).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var i;c(this,`_invoke`,function(e,r){function a(){return new t(function(t,i){n(e,r,t,i)})}return i=i?i.then(a,a):a()},!0)}function x(t,n){var r=n.method,i=t.i[r];if(i===e)return n.delegate=null,r===`throw`&&t.i.return&&(n.method=`return`,n.arg=e,x(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),d;var a=u(i,t.i,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,d;var o=a.arg;return o?o.done?(n[t.r]=o.value,n.next=t.n,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,d):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,d)}function S(e){this.tryEntries.push(e)}function C(t){var n=t[4]||{};n.type=`normal`,n.arg=e,t[4]=n}function w(e){this.tryEntries=[[-1]],e.forEach(S,this),this.reset(!0)}function T(t){if(t!=null){var n=t[a];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw TypeError(typeof t+` is not iterable`)}return p.prototype=m,c(v,`constructor`,m),c(m,`constructor`,p),p.displayName=c(m,s,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===p||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,s,`GeneratorFunction`)),e.prototype=Object.create(v),e},t.awrap=function(e){return{__await:e}},y(b.prototype),c(b.prototype,o,function(){return this}),t.AsyncIterator=b,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new b(l(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},y(v),c(v,s,`Generator`),c(v,a,function(){return this}),c(v,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},t.values=T,w.prototype={constructor:w,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e){o.type=`throw`,o.arg=t,n.next=e}for(var i=n.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a[4],s=this.prev,c=a[1],l=a[2];if(a[0]===-1)return r(`end`),!1;if(!c&&!l)throw Error(`try statement without catch or finally`);if(a[0]!=null&&a[0]<=s){if(s<c)return this.method=`next`,this.arg=e,r(c),!0;if(s<l)return r(l),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r[0]>-1&&r[0]<=this.prev&&this.prev<r[2]){var i=r;break}}i&&(e===`break`||e===`continue`)&&i[0]<=t&&t<=i[2]&&(i=null);var a=i?i[4]:{};return a.type=e,a.arg=t,i?(this.method=`next`,this.next=i[2],d):this.complete(a)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var r=n[4];if(r.type===`throw`){var i=r.arg;C(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={i:T(t),r:n,n:r},this.method===`next`&&(this.arg=e),d}},t}function ne(e,t){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ne(e,t)}function F(e,t){return f(e)||O(e,t)||oe(e,t)||k()}function re(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=w(e))!==null;);return e}function I(e,t,n,r){var i=C(w(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function L(e){return p(e)||D(e)||oe(e)||A()}function ie(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function R(e){var t=ie(e,`string`);return typeof t==`symbol`?t:t+``}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ae(e)}function oe(e,t){if(e){if(typeof e==`string`)return d(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function se(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof u;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}se.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},se.prototype.next=function(e){return this._invoke(`next`,e)},se.prototype.throw=function(e){return this._invoke(`throw`,e)},se.prototype.return=function(e){return this._invoke(`return`,e)};var z={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableBody:`table-up-body`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},B={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},ce={AFTER_TABLE_RESIZE:`after-table-resize`},le={moduleName:`table-up`},ue=[[`rgb(255, 255, 255)`,`rgb(0, 0, 0)`,`rgb(72, 83, 104)`,`rgb(41, 114, 244)`,`rgb(0, 163, 245)`,`rgb(49, 155, 98)`,`rgb(222, 60, 54)`,`rgb(248, 136, 37)`,`rgb(245, 196, 0)`,`rgb(153, 56, 215)`],[`rgb(242, 242, 242)`,`rgb(127, 127, 127)`,`rgb(243, 245, 247)`,`rgb(229, 239, 255)`,`rgb(229, 246, 255)`,`rgb(234, 250, 241)`,`rgb(254, 233, 232)`,`rgb(254, 243, 235)`,`rgb(254, 249, 227)`,`rgb(253, 235, 255)`],[`rgb(216, 216, 216)`,`rgb(89, 89, 89)`,`rgb(197, 202, 211)`,`rgb(199, 220, 255)`,`rgb(199, 236, 255)`,`rgb(195, 234, 213)`,`rgb(255, 201, 199)`,`rgb(255, 220, 196)`,`rgb(255, 238, 173)`,`rgb(242, 199, 255)`],[`rgb(191, 191, 191)`,`rgb(63, 63, 63)`,`rgb(128, 139, 158)`,`rgb(153, 190, 255)`,`rgb(153, 221, 255)`,`rgb(152, 215, 182)`,`rgb(255, 156, 153)`,`rgb(255, 186, 132)`,`rgb(255, 226, 112)`,`rgb(213, 142, 255)`],[`rgb(165, 165, 165)`,`rgb(38, 38, 38)`,`rgb(53, 59, 69)`,`rgb(20, 80, 184)`,`rgb(18, 116, 165)`,`rgb(39, 124, 79)`,`rgb(158, 30, 26)`,`rgb(184, 96, 20)`,`rgb(163, 130, 0)`,`rgb(94, 34, 129)`],[`rgb(147, 147, 147)`,`rgb(13, 13, 13)`,`rgb(36, 39, 46)`,`rgb(12, 48, 110)`,`rgb(10, 65, 92)`,`rgb(24, 78, 50)`,`rgb(88, 17, 14)`,`rgb(92, 48, 10)`,`rgb(102, 82, 0)`,`rgb(59, 21, 81)`]],de=`table-up`,fe=new Set([z.tableCellInner]),pe=function(e){return fe.has(e.statics.blotName)};function me(e){return e&&e.parent?pe(e.parent)?!0:me(e.parent):!1}function V(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:de,n=t?`${t}-`:``;return{b:function(){return`${n}${e}`},be:function(t){return t?`${n}${e}__${t}`:``},bm:function(t){return t?`${n}${e}--${t}`:``},bem:function(t,r){return t&&r?`${n}${e}__${t}--${r}`:``},ns:function(e){return e?`${n}${e}`:``},bs:function(t){return t?`${n}${e}-${t}`:``},cv:function(e){return e?`--${n}${e}`:``},is:function(e){return`is-${e}`}}}function H(e,t){for(var n=e.parent;n&&n.statics.blotName!==t&&n!==e.scroll;)n=n.parent;if(n===e.scroll)throw Error(`${e.statics.blotName} must be a child of ${t}`);return n}function he(e,t){for(var n=Array(t.length),r=new Map(t.map(function(e,t){return[e,t]})),i=e.parent;i&&i!==e.scroll&&r.size!==0;){if(r.has(i.statics.blotName)){var a=r.get(i.statics.blotName);n[a]=i,r.delete(i.statics.blotName)}i=i.parent}if(r.size>0)throw Error(`${e.statics.blotName} must be a child of ${Array.from(r.keys()).join(`, `)}`);return n}function ge(e){for(var t=new Map,n=e;n&&n.statics.blotName!==`scroll`;)t.set(n.statics.blotName,n),n=n.parent;return t}function _e(e,t){for(var n=[],r=e.children.iterator(),i=null;i=r();)i instanceof t&&n.push(i);return n}function ve(e,t,n){var r=x(Object.getOwnPropertyNames(t)),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;n&&n.test(a)||Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}}catch(e){r.e(e)}finally{r.f()}return e}function ye(e,t){var n=function(e){function t(){v(this,t);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return _(this,t,[].concat(n))}return T(t,e),b(t)}(e),r=x(t),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;ve(n.prototype,a.prototype,/^constructor$/)}}catch(e){r.e(e)}finally{r.f()}return n}function be(e,t){return e.prototype instanceof t}function xe(e,t){return e=Math.min(t,Math.max(0,Number.parseFloat(`${e}`))),Math.abs(e-t)<1e-6?1:e%t/Number.parseFloat(t)}function Se(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b)),a:Math.min(1,Math.max(0,e.a))}}function Ce(e){e=e.startsWith(`#`)?e.slice(1):e;var t=Number.parseInt(e.slice(0,2),16),n=Number.parseInt(e.slice(2,4),16),r=Number.parseInt(e.slice(4,6),16),i=Number((Number.parseInt(e.slice(6,8)||`ff`,16)/255).toFixed(2));return{r:t,g:n,b:r,a:i}}function we(e){var t=e.r,n=e.g,r=e.b,i=e.a;t=xe(t,255),n=xe(n,255),r=xe(r,255);var a=Math.max(t,n,r),o=Math.min(t,n,r),s,c=a,l=a-o,u=a===0?0:l/a;if(a===o)s=0;else{switch(a){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;case r:s=(t-n)/l+4;break}s/=6}return{h:s*360,s:u*100,b:c*100,a:i}}function Te(e){var t=e.h,n=e.s,r=e.b,i=e.a;t=xe(t,360)*6,n=xe(n,100),r=xe(r,100);var a=Math.floor(t),o=t-a,s=r*(1-n),c=r*(1-o*n),l=r*(1-(1-o)*n),u=a%6,d=[r,c,s,s,l,r][u],f=[l,r,r,c,s,s][u],p=[s,s,l,r,r,c][u];return{r:Math.round(d*255),g:Math.round(f*255),b:Math.round(p*255),a:i}}function Ee(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16),Math.round(e.a*255).toString(16)];for(var n in t)t[n].length===1&&(t[n]=`0${t[n]}`);return t.join(``)}var De=function(e){return Ee(Te(e))},Oe=function(e){return typeof e==`function`},ke=Array.isArray,Ae=function(e){return typeof e==`string`},je=function(e){return typeof e==`number`},Me=function(e){return e!==null&&ae(e)===`object`},Ne=function(e){return!Number.isNaN(e)&&Number(e)>0};function Pe(e){var t=e||{},n=t.type,r=n===void 0?`default`:n,i=t.content,a=V(`button`),o=document.createElement(`button`);return o.classList.add(a.b(),r),i&&(Ae(i)?o.textContent=i:o.appendChild(i)),o}function Fe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=230,n=150,r=10,i=we(Ce(e.color||`#ff0000`)),a=V(`color-picker`),o=document.createElement(`div`);o.classList.add(a.b());var s=document.createElement(`div`);s.classList.add(a.be(`content`));var c=document.createElement(`div`);c.classList.add(a.be(`selector`));var l=document.createElement(`div`);l.classList.add(a.be(`background`)),c.appendChild(l);var u=document.createElement(`div`);u.classList.add(a.be(`background-handle`)),l.appendChild(u);var d=document.createElement(`div`);d.classList.add(a.be(`alpha`));var f=document.createElement(`div`);f.classList.add(a.be(`alpha-bg`));var p=document.createElement(`div`);p.classList.add(a.be(`alpha-handle`)),d.appendChild(f),d.appendChild(p);var m=document.createElement(`div`);m.classList.add(a.be(`hue`));var h=document.createElement(`div`);h.classList.add(a.be(`hue-handle`)),m.appendChild(h);var g=document.createElement(`div`);g.classList.add(a.be(`action`));var _=[`r`,`g`,`b`,`a`].map(function(e){var t=document.createElement(`div`);t.classList.add(a.be(`action-item`),e);var n=document.createElement(`label`);n.textContent=e.toUpperCase();var r=document.createElement(`input`);return r.classList.add(a.be(`input`)),r.addEventListener(`input`,function(){r.value=r.value.replaceAll(/[^0-9]/g,``)}),r.addEventListener(`change`,function(){var t=Math.round(Number(r.value));e===`a`&&(t/=100);var n=Se(we(Object.assign({},Te(i),S({},e,t))));te(n),ee()}),t.appendChild(n),t.appendChild(r),g.appendChild(t),r}),v=F(_,4),y=v[0],b=v[1],C=v[2],w=v[3];s.appendChild(m),s.appendChild(c),s.appendChild(d),o.appendChild(s),o.appendChild(g);var T=!1,E=!1,D=!1;function O(){var e=De(i),t=x([y,b,C].entries()),n;try{for(t.s();!(n=t.n()).done;){var r=F(n.value,2),a=r[0],o=r[1];o.value=String(Number.parseInt(e[a*2]+e[a*2+1],16))}}catch(e){t.e(e)}finally{t.f()}w.value=String((i.a*100).toFixed(0))}function k(){Object.assign(u.style,{left:`${Math.floor(t*i.s/100)}px`,top:`${Math.floor(n*(100-i.b)/100)}px`})}function A(){c.style.backgroundColor=`#${Ee(Te({h:i.h,s:100,b:100,a:1}))}`}function j(){h.style.top=`${Math.floor(n-n*i.h/360)}px`}function M(){p.style.left=`${i.a*100}%`}function N(){var e=Te(i),t=e.r,n=e.g,r=e.b;f.style.background=`linear-gradient(to right, rgba(${t}, ${n}, ${r}, 0) 0%, rgba(${t}, ${n}, ${r}, 1) 100%)`}function ee(){k(),A(),j(),M(),N(),O()}function te(t){i=Se(Object.assign({},i,t)),O(),e.onChange&&e.onChange(`#${De(i)}`)}function P(e){var r=c.getBoundingClientRect(),i=r.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),a=r.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(t,e.pageX-a))/t),s=Math.floor(100*(n-Math.max(0,Math.min(n,e.pageY-i)))/n);te({s:o,b:s}),ee()}function ne(e){var t=m.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);te({h:Math.floor(360*(n-Math.max(0,Math.min(n,e.pageY-t)))/n)}),ee()}function re(e){var t=e.pageX,n=d.getBoundingClientRect(),i=t-n.left;i=Math.max(r/2,i),i=Math.min(i,n.width-r/2),te({a:Math.round((i-10/2)/(n.width-10)*100)/100}),ee()}function I(e){T&&(e.preventDefault(),P(e)),E&&(e.preventDefault(),ne(e)),D&&(e.preventDefault(),re(e))}function L(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,L),T=!1}function ie(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,L),T=!0,P(e)}c.addEventListener(`mousedown`,ie);function R(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,R),E=!1}function ae(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,R),E=!0,ne(e)}m.addEventListener(`mousedown`,ae);function oe(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,oe),D=!1}function se(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,oe),D=!0,re(e)}return d.addEventListener(`mousedown`,se),ee(),o}var Ie=8e3;function Le(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.child,n=e.target,r=n===void 0?document.body:n,i=e.beforeClose,a=i===void 0?function(){}:i,o=V(`dialog`),s=r,c=document.createElement(`div`);c.classList.add(o.b()),c.style.zIndex=String(Ie);var l=document.createElement(`div`);if(l.classList.add(o.be(`overlay`)),c.appendChild(l),t){var u=document.createElement(`div`);u.classList.add(o.be(`content`)),u.appendChild(t),l.appendChild(u),u.addEventListener(`click`,function(e){e.stopPropagation()})}var d=getComputedStyle(s).overflow;s.style.overflow=`hidden`,s.appendChild(c);var f=function(){a(),c.remove(),s.style.overflow=d};return c.addEventListener(`click`,f),Ie+=1,{dialog:c,close:f}}function Re(e,t){var n=V(`input`);t.type||(t.type=`text`),t.value||(t.value=``);var r=document.createElement(`div`);if(r.classList.add(n.be(`item`)),e){var i=document.createElement(`span`);i.classList.add(n.be(`label`)),i.textContent=e,r.appendChild(i)}var a=document.createElement(`div`);a.classList.add(n.be(`input`));var o=document.createElement(`input`);for(var s in t)o.setAttribute(s,t[s]);(t.max||t.min)&&o.addEventListener(`blur`,function(){t.max&&t.max<=Number(o.value)&&(o.value=String(t.max)),t.min&&t.min>=Number(o.value)&&(o.value=String(t.min))}),a.appendChild(o),r.appendChild(a),o.addEventListener(`focus`,function(){a.classList.add(`focus`)}),o.addEventListener(`blur`,function(){a.classList.remove(`focus`)});var c=function(e){var t;a.classList.contains(`error`)?t=a.querySelector(`.${n.be(`error-tip`)}`):(t=document.createElement(`span`),t.classList.add(n.be(`error-tip`)),a.appendChild(t)),t.textContent=e,a.classList.add(`error`);var r=function(){a.classList.remove(`error`),t.remove()};return{removeError:r}};return{item:r,input:o,errorTip:c}}function ze(){return Be.apply(this,arguments)}function Be(){return Be=g(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,_,v,y=arguments;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=y.length>0&&y[0]!==void 0?y[0]:{},n=V(`creator`),r=document.createElement(`div`),r.classList.add(n.b()),i=document.createElement(`div`),i.classList.add(n.be(`input`)),a=Re(t.rowText||`Row`,{type:`number`,value:String(t.row||``),max:99}),o=a.item,s=a.input,c=a.errorTip,l=Re(t.colText||`Column`,{type:`number`,value:String(t.col||``),max:99}),u=l.item,d=l.input,f=l.errorTip,i.appendChild(o),i.appendChild(u),r.appendChild(i),p=document.createElement(`div`),p.classList.add(n.be(`control`)),m=Pe({type:`confirm`,content:t.confirmText||`Confirm`}),h=Pe({type:`default`,content:t.cancelText||`Cancel`}),p.appendChild(m),p.appendChild(h),r.appendChild(p),_=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number(s.value),n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number(d.value);if(Number.isNaN(e)||e<=0){c(t.notPositiveNumberError||`Please enter a positive integer`);return}if(Number.isNaN(n)||n<=0){f(t.notPositiveNumberError||`Please enter a positive integer`);return}return{row:e,col:n}},v=function(e){e.key===`Escape`&&(close(),document.removeEventListener(`keydown`,v))},e.abrupt(`return`,new Promise(function(e,t){var n=Le({child:r,beforeClose:t}),i=n.close;s.focus();for(var a=0,o=[s,d];a<o.length;a++){var c=o[a];c.addEventListener(`keydown`,function(t){if(t.key===`Enter`){var n=_();n&&(e(n),i())}})}m.addEventListener(`click`,g(P().mark(function t(){var n;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=_(),n&&(e(n),i());case 2:case`end`:return t.stop()}},t)}))),document.addEventListener(`keydown`,v),h.addEventListener(`click`,i)}));case 21:case`end`:return e.stop()}},e)})),Be.apply(this,arguments)}function Ve(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=V(`select-box`),n=document.createElement(`div`);n.classList.add(t.b());var r=document.createElement(`div`);r.classList.add(t.be(`block`));for(var i=0;i<(e.row||8);i++)for(var a=0;a<(e.col||8);a++){var o=document.createElement(`div`);o.classList.add(t.be(`item`)),o.dataset.row=String(i+1),o.dataset.col=String(a+1),r.appendChild(o)}var s=function(){for(var e=n.dataset,t=e.row,i=e.col,a=0,o=Array.from(r.querySelectorAll(`.active`));a<o.length;a++){var s=o[a];s.classList.remove(`active`)}if(!(!t||!i))for(var c=Array.from(r.children),l=0;l<c.length;l++){var u=c[l].dataset,d=u.row,f=u.col;if(d>t&&f>i)return;d<=t&&f<=i?c[l].classList.add(`active`):c[l].classList.remove(`active`)}};if(r.addEventListener(`mousemove`,function(e){if(e.target){var t=e.target.dataset,r=t.row,i=t.col;!r||!i||(n.dataset.row=r,n.dataset.col=i,s())}}),r.addEventListener(`mouseleave`,function(){n.removeAttribute(`data-row`),n.removeAttribute(`data-col`),s()}),r.addEventListener(`click`,function(){var t=n.dataset,r=t.row,i=t.col;!r||!i||e.onSelect&&e.onSelect(Number(r),Number(i))}),n.appendChild(r),e.customBtn){var c=e.texts||{},l=document.createElement(`div`);l.classList.add(t.be(`custom`)),l.textContent=c.customBtnText||`Custom`,l.addEventListener(`click`,g(P().mark(function t(){var n;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ze(c);case 2:n=t.sent,n&&e.onSelect&&e.onSelect(n.row,n.col);case 4:case`end`:return t.stop()}},t)}))),n.appendChild(l)}return n}function He(e){"@babel/helpers - typeof";return He=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},He(e)}function Ue(e,t){if(He(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(He(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function We(e){var t=Ue(e,`string`);return He(t)==`symbol`?t:t+``}function Ge(e,t,n){return(t=We(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(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 U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ke(Object(n),!0).forEach(function(t){Ge(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let qe=Math.min,Je=Math.max,Ye=Math.round,Xe=Math.floor,Ze=e=>({x:e,y:e}),Qe={left:`right`,right:`left`,bottom:`top`,top:`bottom`},$e={start:`end`,end:`start`};function et(e,t,n){return Je(e,qe(t,n))}function tt(e,t){return typeof e==`function`?e(t):e}function nt(e){return e.split(`-`)[0]}function rt(e){return e.split(`-`)[1]}function it(e){return e===`x`?`y`:`x`}function at(e){return e===`y`?`height`:`width`}function ot(e){return[`top`,`bottom`].includes(nt(e))?`y`:`x`}function st(e){return it(ot(e))}function ct(e,t,n){n===void 0&&(n=!1);let r=rt(e),i=st(e),a=at(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pt(o)),[o,pt(o)]}function lt(e){let t=pt(e);return[ut(e),t,ut(t)]}function ut(e){return e.replace(/start|end/g,e=>$e[e])}function dt(e,t,n){let r=[`left`,`right`],i=[`right`,`left`],a=[`top`,`bottom`],o=[`bottom`,`top`];switch(e){case`top`:case`bottom`:return n?t?i:r:t?r:i;case`left`:case`right`:return t?a:o;default:return[]}}function ft(e,t,n,r){let i=rt(e),a=dt(nt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ut)))),a}function pt(e){return e.replace(/left|right|bottom|top/g,e=>Qe[e])}function mt(e){return U({top:0,right:0,bottom:0,left:0},e)}function ht(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:mt(e)}function gt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _t(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function vt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){_t(a,r,i,o,s,`next`,e)}function s(e){_t(a,r,i,o,s,`throw`,e)}o(void 0)})}}function yt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function bt(e,t){if(e==null)return{};var n,r,i=yt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let xt=[`crossAxis`,`alignment`,`allowedPlacements`,`autoAlignment`],St=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],Ct=[`strategy`],wt=[`mainAxis`,`crossAxis`,`limiter`],Tt=[`apply`];function Et(e,t,n){let{reference:r,floating:i}=e,a=ot(t),o=st(t),s=at(o),c=nt(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(rt(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let Dt=function(){var e=vt(function*(e,t,n){let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=yield o.isRTL==null?void 0:o.isRTL(t),l=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Et(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=yield h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g==null?u:g,d=_==null?d:_,p=U(U({},p),{},{[a]:U(U({},p[a]),v)}),y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?yield o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Et(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}});return function(t,n,r){return e.apply(this,arguments)}}();function Ot(e,t){return kt.apply(this,arguments)}function kt(){return kt=vt(function*(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=tt(t,e),m=ht(p),h=d===`floating`?`reference`:`floating`,g=s[f?h:d],_=gt(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(g))==null||n?g:g.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),v=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),b=(yield a.isElement==null?void 0:a.isElement(y))&&(yield a.getScale==null?void 0:a.getScale(y))||{x:1,y:1},x=gt(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(_.top-x.top+m.top)/b.y,bottom:(x.bottom-_.bottom+m.bottom)/b.y,left:(_.left-x.left+m.left)/b.x,right:(x.right-_.right+m.right)/b.x}}),kt.apply(this,arguments)}let At=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return vt(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=tt(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=bt(u,St);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=nt(i),y=ot(s),b=nt(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[pt(s)]:lt(s)),C=h!==`none`;!p&&C&&S.push(...ft(s,g,h,x));let w=[s,...S],T=yield Ot(t,_),E=[],D=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&E.push(T[v]),f){let e=ct(i,o,x);E.push(T[e[0]],T[e[1]])}if(D=[...D,{placement:i,overflows:E}],!E.every(e=>e<=0)){var O,k;let e=(((O=a.flip)==null?void 0:O.index)||0)+1,t=w[e];if(t){let n=f===`alignment`?y!==ot(t):!1;if(!n||D.every(e=>e.overflows[0]>0&&ot(e.placement)===y))return{data:{index:e,overflows:D},reset:{placement:t}}}let n=(k=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])==null?void 0:k.placement;if(!n)switch(m){case`bestFit`:{var A;let e=(A=D.filter(e=>{if(C){let t=ot(e.placement);return t===y||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])==null?void 0:A[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(i!==n)return{reset:{placement:n}}}return{}})()}}};function jt(e,t){return Mt.apply(this,arguments)}function Mt(){return Mt=vt(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=nt(n),s=rt(n),c=ot(n)===`y`,l=[`left`,`top`].includes(o)?-1:1,u=a&&c?-1:1,d=tt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}),Mt.apply(this,arguments)}let Nt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return vt(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield jt(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:U(U({},c),{},{placement:o})}})()}}},Pt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return vt(function*(){let{x:n,y:r,placement:i}=t,a=tt(e,t),{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=a,l=bt(a,wt),u={x:n,y:r},d=yield Ot(t,l),f=ot(nt(i)),p=it(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=et(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=et(n,h,r)}let g=c.fn(U(U({},t),{},{[p]:m,[f]:h}));return U(U({},g),{},{data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}})})()}}},Ft=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=tt(e,t),u={x:n,y:r},d=ot(i),f=it(d),p=u[f],m=u[d],h=tt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:U({mainAxis:0,crossAxis:0},h);if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var _,v;let e=f===`y`?`width`:`height`,t=[`top`,`left`].includes(nt(i)),n=a.reference[d]-a.floating[e]+(t&&((_=o.offset)==null?void 0:_[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:((v=o.offset)==null?void 0:v[d])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}};function It(){return typeof window<`u`}function Lt(e){return zt(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(zt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zt(e){return It()?e instanceof Node||e instanceof W(e).Node:!1}function Bt(e){return It()?e instanceof Element||e instanceof W(e).Element:!1}function Vt(e){return It()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Ht(e){return!It()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Ut(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Xt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&![`inline`,`contents`].includes(i)}function Wt(e){return[`table`,`td`,`th`].includes(Lt(e))}function Gt(e){return[`:popover-open`,`:modal`].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function Kt(e){let t=Jt(),n=Bt(e)?Xt(e):e;return[`transform`,`translate`,`scale`,`rotate`,`perspective`].some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`].some(e=>(n.willChange||``).includes(e))||[`paint`,`layout`,`strict`,`content`].some(e=>(n.contain||``).includes(e))}function qt(e){let t=Qt(e);for(;Vt(t)&&!Yt(t);){if(Kt(t))return t;if(Gt(t))return null;t=Qt(t)}return null}function Jt(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}function Yt(e){return[`html`,`body`,`#document`].includes(Lt(e))}function Xt(e){return W(e).getComputedStyle(e)}function Zt(e){return Bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qt(e){if(Lt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ht(e)&&e.host||Rt(e);return Ht(t)?t.host:t}function $t(e){let t=Qt(e);return Yt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&Ut(t)?t:$t(t)}function en(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=$t(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=W(i);if(a){let e=tn(o);return t.concat(o,o.visualViewport||[],Ut(i)?i:[],e&&n?en(e):[])}return t.concat(i,en(i,[],n))}function tn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nn(e){let t=Xt(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ye(n)!==a||Ye(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function rn(e){return Bt(e)?e:e.contextElement}function an(e){let t=rn(e);if(!Vt(t))return Ze(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=nn(t),o=(a?Ye(n.width):n.width)/r,s=(a?Ye(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let on=Ze(0);function sn(e){let t=W(e);return!Jt()||!t.visualViewport?on:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=rn(e),o=Ze(1);t&&(r?Bt(r)&&(o=an(r)):o=an(e));let s=cn(a,n,r)?sn(a):Ze(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=W(a),t=r&&Bt(r)?W(r):r,n=e,i=tn(n);for(;i&&r&&t!==n;){let e=an(i),t=i.getBoundingClientRect(),r=Xt(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=tn(n)}}return gt({width:u,height:d,x:c,y:l})}function un(e,t){let n=Zt(e).scrollLeft;return t?t.left+n:ln(Rt(e)).left+n}function dn(e,t,n){n===void 0&&(n=!1);let r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:un(e,r)),a=r.top+t.scrollTop;return{x:i,y:a}}function fn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Rt(r),s=t?Gt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ze(1),u=Ze(0),d=Vt(r);if((d||!d&&!a)&&((Lt(r)!==`body`||Ut(o))&&(c=Zt(r)),Vt(r))){let e=ln(r);l=an(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?dn(o,c,!0):Ze(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function pn(e){return Array.from(e.getClientRects())}function mn(e){let t=Rt(e),n=Zt(e),r=e.ownerDocument.body,i=Je(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Je(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+un(e),s=-n.scrollTop;return Xt(r).direction===`rtl`&&(o+=Je(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function hn(e,t){let n=W(e),r=Rt(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Jt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}function gn(e,t){let n=ln(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Vt(e)?an(e):Ze(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,c=i*a.x,l=r*a.y;return{width:o,height:s,x:c,y:l}}function _n(e,t,n){let r;if(t===`viewport`)r=hn(e,n);else if(t===`document`)r=mn(Rt(e));else if(Bt(t))r=gn(t,n);else{let n=sn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return gt(r)}function vn(e,t){let n=Qt(e);return n===t||!Bt(n)||Yt(n)?!1:Xt(n).position===`fixed`||vn(n,t)}function yn(e,t){let n=t.get(e);if(n)return n;let r=en(e,[],!1).filter(e=>Bt(e)&&Lt(e)!==`body`),i=null,a=Xt(e).position===`fixed`,o=a?Qt(e):e;for(;Bt(o)&&!Yt(o);){let t=Xt(o),n=Kt(o);!n&&t.position===`fixed`&&(i=null);let s=a?!n&&!i:!n&&t.position===`static`&&!!i&&[`absolute`,`fixed`].includes(i.position)||Ut(o)&&!n&&vn(e,o);s?r=r.filter(e=>e!==o):i=t,o=Qt(o)}return t.set(e,r),r}function bn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=n===`clippingAncestors`?Gt(t)?[]:yn(t,this._c):[].concat(n),o=[...a,r],s=o[0],c=o.reduce((e,n)=>{let r=_n(t,n,i);return e.top=Je(r.top,e.top),e.right=qe(r.right,e.right),e.bottom=qe(r.bottom,e.bottom),e.left=Je(r.left,e.left),e},_n(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function xn(e){let{width:t,height:n}=nn(e);return{width:t,height:n}}function Sn(e,t,n){let r=Vt(t),i=Rt(t),a=n===`fixed`,o=ln(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ze(0);function l(){c.x=un(i)}if(r||!r&&!a)if((Lt(t)!==`body`||Ut(i))&&(s=Zt(t)),r){let e=ln(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?dn(i,s):Ze(0),d=o.left+s.scrollLeft-c.x-u.x,f=o.top+s.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Cn(e){return Xt(e).position===`static`}function wn(e,t){if(!Vt(e)||Xt(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function Tn(e,t){let n=W(e);if(Gt(e))return n;if(!Vt(e)){let t=Qt(e);for(;t&&!Yt(t);){if(Bt(t)&&!Cn(t))return t;t=Qt(t)}return n}let r=wn(e,t);for(;r&&Wt(r)&&Cn(r);)r=wn(r,t);return r&&Yt(r)&&Cn(r)&&!Kt(r)?n:r||qt(e)||n}let En=function(){var e=vt(function*(e){let t=this.getOffsetParent||Tn,n=this.getDimensions,r=yield n(e.floating);return{reference:Sn(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}});return function(t){return e.apply(this,arguments)}}();function Dn(e){return Xt(e).direction===`rtl`}let On={convertOffsetParentRelativeRectToViewportRelativeRect:fn,getDocumentElement:Rt,getClippingRect:bn,getOffsetParent:Tn,getElementRects:En,getClientRects:pn,getDimensions:xn,getScale:an,isElement:Bt,isRTL:Dn};function kn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function An(e,t){let n=null,r,i=Rt(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Xe(d),h=Xe(i.clientWidth-(u+f)),g=Xe(i.clientHeight-(d+p)),_=Xe(u),v=-m+`px `+-h+`px `+-g+`px `+-_+`px`,y={rootMargin:v,threshold:Je(0,qe(1,c))||1},b=!0;function x(t){let n=t[0].intersectionRatio;if(n!==c){if(!b)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!kn(l,e.getBoundingClientRect())&&o(),b=!1}try{n=new IntersectionObserver(x,U(U({},y),{},{root:i.ownerDocument}))}catch(e){n=new IntersectionObserver(x,y)}n.observe(e)}return o(!0),a}function jn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=rn(e),u=i||a?[...l?en(l):[],...en(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?An(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?ln(e):null;c&&g();function g(){let t=ln(e);h&&!kn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Mn=Nt,Nn=Pt,Pn=At,Fn=Ft,In=(e,t,n)=>{let r=new Map,i=U({platform:On},n),a=U(U({},i.platform),{},{_c:r});return Dt(e,t,U(U({},i),{},{platform:a}))};function Ln(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(function(){n()},t)}var Rn=4,zn;function Bn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.msg,r=n===void 0?``:n,i=t.delay,a=i===void 0?150:i,o=t.content,s=t.direction,c=s===void 0?`bottom`:s,l=t.type,u=l===void 0?`hover`:l,d=t.container,f=t.onOpen,p=t.onClose,m=t.closed,h=t.onDestroy,g=V(`tooltip`);if(r||o){zn||(zn=document.createElement(`div`),document.body.appendChild(zn));var _=d||zn,v=document.createElement(`div`);v.classList.add(g.b(),`hidden`,`transparent`),o?v.appendChild(o):r&&(v.textContent=r);var y,b,x,S=function(){x&&x(),In(e,v,{placement:c,middleware:[Pn(),Nn({limiter:Fn()}),Mn(Rn)]}).then(function(e){var t=e.x,n=e.y;Object.assign(v.style,{left:`${t}px`,top:`${n}px`})})},C=function(){v.classList.add(`hidden`),_.contains(v)&&_.removeChild(v),x&&x(),m&&m()},w=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;b&&clearTimeout(b),y=setTimeout(function(){if(f){var n=f(t);if(!t&&n)return}_.appendChild(v),v.removeEventListener(`transitionend`,C),v.classList.remove(`hidden`),x=jn(e,v,S),v.classList.remove(`transparent`)},a)},T=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;y&&clearTimeout(y),b=setTimeout(function(){if(p){var t=p(e);if(!e&&t)return}Ln(v,150,C,{once:!0}),v.classList.add(`transparent`)},a)},E=function(){var t=[e,v],n=T.bind(void 0,!1),r=w.bind(void 0,!1),i=function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.addEventListener(`mouseenter`,r),a.addEventListener(`mouseleave`,n)}};return{prepare:i,show:w,hide:T,destroy:function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.removeEventListener(`mouseenter`,r),a.removeEventListener(`mouseleave`,n)}}}},D=function(){var t=function(e){e.stopPropagation(),T(!1)},n=function(e){e.stopPropagation(),w(),document.removeEventListener(`click`,t),document.addEventListener(`click`,t,{once:!0})};return{prepare:function(){v.addEventListener(`click`,function(e){return e.stopPropagation()}),e.addEventListener(`click`,n)},show:w,hide:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;T(e),document.removeEventListener(`click`,t)},destroy:function(){e.removeEventListener(`click`,n),document.removeEventListener(`click`,t)}}},O={hover:E,click:D},k=O[u](),A=k.prepare,j=k.show,M=k.hide,N=k.destroy;A();var ee=function(){M(!0),h&&h(),N(),x&&x(),v.remove()};return{show:j,hide:M,destroy:ee}}return null}function Vn(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=e.x,a=e.y,o=e.x1,s=e.y1,c=t.x,l=t.y,u=t.x1,d=t.y1,f,p;return r?(f=o<c+n||i-n>u,p=s<l+n||a-n>d):(f=o<=c+n||i-n>=u,p=s<=l+n||a-n>=d),!(f||p)}function Hn(e,t){var n=t.getBoundingClientRect();return{x:e.x-n.x-t.scrollLeft,y:e.y-n.y-t.scrollTop,x1:e.x-n.x-t.scrollLeft+e.width,y1:e.y-n.y-t.scrollTop+e.height,width:e.width,height:e.height}}var Un=8;function Wn(e){var t=e.left,n=e.top,r=e.width,i=e.height,a=document.documentElement,o=a.clientWidth,s=a.clientHeight,c=!1,l=!1;return t+r>o?(t=o-r-Un,c=!0):t<0&&(t=Un,c=!0),n+i>s?(n=s-i-Un,l=!0):n<0&&(n=Un,l=!0),{left:t,top:n,leftLimited:c,topLimited:l}}function Gn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Symbol(`ignoreFirstBind`),r=new Set,i=new ResizeObserver(function(r){t.ignoreFirstBind&&r.some(function(e){var t=e.target,r=t[n];return t[n]=!0,!r})||e(r)}),a=i.observe;i.observe=function(e,t){r.add(e),a.call(i,e,t)};var o=i.unobserve;i.unobserve=function(e){r.has(e)&&(r.delete(e),e[n]=void 0),o.call(i,e)};var s=i.disconnect;return i.disconnect=function(){var e=x(r.values()),t;try{for(e.s();!(t=e.n()).done;){var a=t.value;a[n]=void 0}}catch(t){e.e(t)}finally{e.f()}s.call(i)},i}function Kn(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function qn(){for(var e=0;e<this.scrollHandler.length;e++){var t=F(this.scrollHandler[e],2),n=t[0],r=t[1];n.removeEventListener(`scroll`,r)}this.scrollHandler=[]}function Jn(e){return{y:e.scrollTop,x:e.scrollLeft}}function Yn(e){for(var t={},n=e.trim().split(`;`),r=0;r<n.length;r++){var i=n[r].trim();if(i){var a=i.indexOf(`:`);if(a!==-1){var o=i.slice(0,Math.max(0,a)).trim(),s=i.slice(Math.max(0,a+1)).trim();t[Qn(o)]=s}}}return t}function Xn(e){return Object.entries(e).map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${Zn(n)}: ${r};`}).join(` `)}function Zn(e){var t=e.replaceAll(RegExp(`([A-Z])`,`g`),` $1`).trim();return t.split(` `).join(`-`).toLowerCase()}function Qn(e){return e.replaceAll(RegExp(`-(\\w)`,`g`),function(e,t){return t.toUpperCase()})}var G=function(){return Math.random().toString(36).slice(2)};function $n(e,t){var n;return function(){for(var r=this,i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];n&&clearTimeout(n),n=setTimeout(function(){e.apply(r,a)},t)}}var er=t.default.import(`parchment`),tr=t.default.import(`blots/container`),nr=t.default.import(`blots/block`),rr=t.default.import(`blots/block/embed`),K=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`optimize`,value:function(e){if(this.children.length===0)if(this.statics.defaultChild!=null){var t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove();this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}},{key:`enforceAllowedChildren`,value:function(){var e=this;this.children.forEach(function(n){var r=e.statics.allowedChildren.some(function(e){return n instanceof e});r||(n.statics.scope===er.Scope.BLOCK_BLOT?(n.parent instanceof t?(n.next!=null&&n.parent.splitAfter(n),n.prev!=null&&n.parent.splitAfter(n.prev)):(n.next!=null&&e.splitAfter(n),n.prev!=null&&e.splitAfter(n.prev)),n.parent.unwrap()):n instanceof er.ParentBlot?n.unwrap():n.remove())})}}],[{key:`create`,value:function(e){var t=document.createElement(this.tagName);return this.className&&t.classList.add(this.className),t}}])}(tr);S(K,`tagName`,void 0),S(K,`blotName`,z.container),S(K,`scope`,er.Scope.BLOCK_BLOT),S(K,`allowedChildren`,[nr,rr,tr]),S(K,`requiredContainer`,void 0),S(K,`defaultChild`,void 0);var ir=function(e){return Ne(e)?e:1},ar=t.default.import(`blots/block`),or=t.default.import(`blots/block/embed`),q=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n]),n.setAttribute(`contenteditable`,String(e.isEnabled())),i}return T(t,e),b(t,[{key:`setFormatValue`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n){if(!this.statics.isAllowStyle(e))return;this.parent&&this.parent.statics.blotName===z.tableCell&&this.parent.setFormatValue(e,t)}else{if(!this.statics.allowDataAttrs.has(e))return;var r=`data-${e}`;t?this.domNode.setAttribute(r,t):this.domNode.removeAttribute(r),this.parent&&this.parent.statics.blotName===z.tableCell&&this.parent.setFormatValue(e,t)}var i=this.descendants(ar,0),a=x(i),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;s.cache={}}}catch(e){a.e(e)}finally{a.f()}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId},set:function(e){this.setFormatValue(`row-id`,e)}},{key:`colId`,get:function(){return this.domNode.dataset.colId},set:function(e){this.setFormatValue(`col-id`,e)}},{key:`rowspan`,get:function(){return Number(this.domNode.dataset.rowspan)},set:function(e){this.setFormatValue(`rowspan`,e)}},{key:`colspan`,get:function(){return Number(this.domNode.dataset.colspan)},set:function(e){this.setFormatValue(`colspan`,e)}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}},set:function(e){if(this.emptyRow.toString()!==e.toString())try{e.length>0?this.setFormatValue(`empty-row`,JSON.stringify(e),!1):this.setFormatValue(`empty-row`,null,!1)}catch(e){this.setFormatValue(`empty-row`,null,!1)}}},{key:`getColumnIndex`,value:function(){var e=H(this,z.tableMain);return e.getColIds().indexOf(this.colId)}},{key:`setStyleByString`,value:function(e){for(var t=Yn(e),n=0,r=Object.entries(t);n<r.length;n++){var i=F(r[n],2),a=i[0],o=i[1];this.setFormatValue(a,o,!0)}}},{key:`formatAt`,value:function(e,n,r,i){this.children.length===0&&(this.appendChild(this.scroll.create(this.statics.defaultChild.blotName)),n+=1),I(t,`formatAt`,this,3)([e,n,r,i]),i&&i.style&&this.setStyleByString(i.style)}},{key:`insertAt`,value:function(e,n,r){var i=this.children.find(e),a=F(i,1),o=a[0];if(!o&&this.statics.defaultChild){var s=this.scroll.create(this.statics.defaultChild.blotName||`block`);this.appendChild(s)}I(t,`insertAt`,this,3)([e,n,r])}},{key:`formats`,value:function(){var e=this.statics.formats(this.domNode);return S({},this.statics.blotName,e)}},{key:`checkMerge`,value:function(){var e=this.colId,t=this.rowId,n=this.colspan,r=this.rowspan,i=this.next;return i!==null&&i.statics.blotName===this.statics.blotName&&i.rowId===t&&i.colId===e&&i.colspan===n&&i.rowspan===r}},{key:`optimize`,value:function(){var e=this.parent,t=this.statics.formats(this.domNode);if(this.prev&&this.prev instanceof or){var n=this.prev;if(this.insertBefore(n,this.children.head),this.length()<=1){var r=this.scroll.create(`block`);this.insertBefore(r,n.next)}}var i=e!==null&&e.statics.blotName!==z.tableCell;if(i&&(this.wrap(z.tableCell,t),this.children.length===0)){var a=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(a)}this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0?this.remove():this.domNode.dataset.style&&i&&e.domNode.style.cssText!==this.domNode.dataset.style&&this.setStyleByString(this.domNode.dataset.style)}},{key:`insertBefore`,value:function(e,n){if(e.statics.blotName===this.statics.blotName){var r=e,i=this.statics.formats(r.domNode),a=this.statics.formats(this.domNode),o=Object.entries(a).every(function(e){var t=F(e,2),n=t[0],r=t[1];return String(r)===String(i[n])});if(o){var s=this.split(n?n.offset():0);return this.parent.insertBefore(r,s)}else{var c=he(this,[z.tableRow,z.tableCell]),l=F(c,2),u=l[0],d=l[1];if(n){var f=n.offset(),p=this.length();if(f+1<p){var m=this.scroll.create(z.tableCellInner,a);this.children.forEachAt(f+1,this.length(),function(e){m.appendChild(e)}),u.insertBefore(m.wrap(z.tableCell,a),d.next)}}if(this.rowId!==r.rowId){if(n){var h=n.offset(u);u.split(h)}else if(d.next){var g=d.next.offset(u);u.split(g)}var _=this.scroll.create(z.tableRow,i),v=this.scroll.create(z.tableCell,i);return v.appendChild(r),_.appendChild(v),u.parent.insertBefore(_,u.next)}return u.insertBefore(r.wrap(z.tableCell,i),n?d:d.next)}}else if(e.statics.blotName===z.tableCol){try{var y=H(this,z.tableBody),b=this.offset(y),x=y.split(b);y.parent.insertBefore(e,x),e.optimize({})}catch(e){console.warn(`TableCellInner not in TableBody`)}return}I(t,`insertBefore`,this,3)([e,n])}}],[{key:`isAllowStyle`,value:function(e){var t=Qn(e),n=x(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(Qn(i)))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:`create`,value:function(e){var n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=I(t,`create`,this,2)([]);l.dataset.tableId=n,l.dataset.rowId=r,l.dataset.colId=i,l.dataset.rowspan=String(ir(a)),l.dataset.colspan=String(ir(o)),s&&(l.dataset.style=s);try{c&&(l.dataset.emptyRow=JSON.stringify(c))}catch(e){}return l}},{key:`formats`,value:function(e){var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.rowspan,o=t.colspan,s=t.style,c=t.emptyRow,l={tableId:String(n),rowId:String(r),colId:String(i),rowspan:Number(ir(a)),colspan:Number(ir(o))};s&&(l.style=s);try{c&&(l.emptyRow=JSON.parse(c))}catch(e){}return l}}])}(K);S(q,`blotName`,z.tableCellInner),S(q,`tagName`,`div`),S(q,`className`,`ql-table-cell-inner`),S(q,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`rowspan`,`colspan`,`empty-row`])),S(q,`defaultChild`,ar),S(q,`allowStyle`,new Set([`background-color`,`border`,`height`]));var J=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`setHeight`,value:function(e){this.foreachCellInner(function(t){t.setFormatValue(`height`,e,!0)})}},{key:`getCellByColId`,value:function(e,t){for(var n=H(this,z.tableMain),r=n.getColIds(),i=r.indexOf(e),a=this.children.iterator(),o=null;o=a();){if(o.colId===e)return o;var s=r.indexOf(o.colId);if(s<i&&s+o.colspan>i)return o}return this[t]&&this[t].statics.blotName===z.tableRow?this[t].getCellByColId(e,t):null}},{key:`insertCell`,value:function(e,t){for(var n=[],r=this.children.iterator(),i=0,a;(a=r())&&(i+=a.colspan,!(i>e));)if(a.rowspan!==1)for(var o=0;o<a.rowspan-1;o++)n[o]=(n[o]||0)+a.colspan;if(a&&i-a.colspan<e){var s=a.getCellInner();s.colspan+=1,a.rowspan!==1&&(n.skipRowNum=a.rowspan-1)}else{var c=this.scroll.create(z.tableCell,t),l=this.scroll.create(z.tableCellInner,t),u=this.scroll.create(`block`);u.appendChild(this.scroll.create(`break`)),l.appendChild(u),c.appendChild(l),this.insertBefore(c,a)}return n}},{key:`getCellByColumIndex`,value:function(e){var t=[],n=null,r=0;if(e<0)return[n,r,t];for(var i=this.children.iterator();n=i();){if(r+=n.colspan,n.rowspan!==1)for(var a=0;a<n.rowspan-1;a++)t[a]=(t[a]||0)+n.colspan;if(r>e)break}return[n,r,t]}},{key:`removeCell`,value:function(e){if(e<0)return[];var t=this.getCellByColumIndex(e),n=F(t,2),r=n[0],i=n[1],a=t[2];if(!r)return a;if(i-r.colspan<e||r.colspan>1){var o=r.descendants(q),s=F(o,1),c=s[0];if(r.colspan!==1&&e===i-r.colspan){var l=H(this,z.tableMain),u=l.getColIds();c.colId=u[u.indexOf(c.colId)+1]}r.rowspan!==1&&(a.skipRowNum=r.rowspan-1),--c.colspan}else r.remove();return a}},{key:`foreachCellInner`,value:function(e){for(var t=this.children.iterator(),n=0,r;r=t();){var i=r.descendants(q),a=F(i,1),o=a[0];if(e(o,n++))break}}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.rowId===this.rowId}},{key:`optimize`,value:function(e){var t=this.parent,n=this.tableId;t!==null&&t.statics.blotName!==z.tableBody&&this.wrap(z.tableBody,n),this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName),this.enforceAllowedChildren(),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,n.dataset.rowId=e.rowId,n}}])}(K);S(J,`blotName`,z.tableRow),S(J,`tagName`,`tr`),S(J,`className`,`ql-table-row`);var Y=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`insertRow`,value:function(e){var t=H(this,z.tableMain);if(t){var n=t.getColIds(),r=this.descendants(J),i=new Set(n),a=0,o=x(r),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;if(a===e)break;c.foreachCellInner(function(t){if(a+t.rowspan>e&&(t.rowspan+=1,i.delete(t.colId),t.colspan!==1))for(var r=n.indexOf(t.colId),o=0;o<t.colspan-1;o++)i.delete(n[r+o+1])}),a+=1}}catch(e){o.e(e)}finally{o.f()}var l=t.tableId,u=G(),d=this.scroll.create(z.tableRow,{tableId:l,rowId:u}),f=x(i),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=this.scroll.create(`break`),g=h.wrap(`block`),_=g.wrap(z.tableCellInner,{tableId:l,rowId:u,colId:m,rowspan:1,colspan:1}),v=_.wrap(z.tableCell,{tableId:l,rowId:u,colId:m,rowspan:1,colspan:1});d.appendChild(v)}}catch(e){f.e(e)}finally{f.f()}this.insertBefore(d,r[e]||null)}}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;if(n!==null&&n.statics.blotName!==z.tableMain){var r=this.tableId;this.wrap(z.tableMain,{tableId:r})}I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e,n}}])}(K);S(Y,`blotName`,z.tableBody),S(Y,`tagName`,`tbody`);var sr=t.default.import(`parchment`),cr=t.default.import(`blots/block`),lr=t.default.import(`blots/container`),ur=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`replaceWith`,value:function(e,t){var n=Ae(e)?this.scroll.create(e,t):e;if(n instanceof sr.ParentBlot)if(n.statics.blotName===z.tableCellInner){var r=this.parent;if(r.statics.blotName===z.tableCellInner){if(r!=null&&r.insertBefore(n,this.prev?null:this.next),r.statics.blotName===z.tableCellInner)for(var i=this;i;){var a=i.next;n.appendChild(i),i=a}else n.appendChild(this);if(r&&r.length()===0){r.remove(),r.parent.statics.blotName===z.tableCell&&r.parent.length()===0&&r.parent.remove();var o=r.parent.parent;o.statics.blotName===z.tableRow&&o.children.length===0&&o.remove()}}else r instanceof lr?r.parent.insertBefore(n,r):r!=null&&r.insertBefore(n,this.next),n.appendChild(this);return n}else this.moveChildren(n);return this.parent!=null&&(this.parent.insertBefore(n,this.next),this.remove()),this.attributes.copy(n),n}},{key:`format`,value:function(e,n){if(e===z.tableCellInner&&this.parent.statics.blotName===e&&!n)try{var r=H(this,z.tableCellInner);r.unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}else I(t,`format`,this,3)([e,n])}}])}(cr),dr=t.default.import(`blots/block/embed`),fr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`delta`,value:function(){var e=I(t,`delta`,this,3)([]),n=pr(this);return n[z.tableCellInner]&&e.insert(`
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j(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 M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t){if(e==null)return{};var n,r,i=ee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function te(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return m(e)}function P(){"use strict";P=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=typeof Symbol==`function`?Symbol:{},a=i.iterator||`@@iterator`,o=i.asyncIterator||`@@asyncIterator`,s=i.toStringTag||`@@toStringTag`;function c(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r})}try{c({},``)}catch(e){c=function(e,t,n){return e[t]=n}}function l(t,n,r,i){var a=n&&n.prototype instanceof f?n:f,o=Object.create(a.prototype);return c(o,`_invoke`,function(t,n,r){var i=1;return function(a,o){if(i===3)throw Error(`Generator is already running`);if(i===4){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=x(s,r);if(c){if(c===d)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===1)throw i=4,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=3;var l=u(t,n,r);if(l.type===`normal`){if(i=r.done?4:2,l.arg===d)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=4,r.method=`throw`,r.arg=l.arg)}}}(t,r,new w(i||[])),!0),o}function u(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=l;var d={};function f(){}function p(){}function m(){}var h={};c(h,a,function(){return this});var g=Object.getPrototypeOf,_=g&&g(g(T([])));_&&_!==n&&r.call(_,a)&&(h=_);var v=m.prototype=f.prototype=Object.create(h);function y(e){[`next`,`throw`,`return`].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function b(e,t){function n(i,a,o,s){var c=u(e[i],e,a);if(c.type!==`throw`){var l=c.arg,d=l.value;return d&&typeof d==`object`&&r.call(d,`__await`)?t.resolve(d.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(d).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var i;c(this,`_invoke`,function(e,r){function a(){return new t(function(t,i){n(e,r,t,i)})}return i=i?i.then(a,a):a()},!0)}function x(t,n){var r=n.method,i=t.i[r];if(i===e)return n.delegate=null,r===`throw`&&t.i.return&&(n.method=`return`,n.arg=e,x(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),d;var a=u(i,t.i,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,d;var o=a.arg;return o?o.done?(n[t.r]=o.value,n.next=t.n,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,d):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,d)}function S(e){this.tryEntries.push(e)}function C(t){var n=t[4]||{};n.type=`normal`,n.arg=e,t[4]=n}function w(e){this.tryEntries=[[-1]],e.forEach(S,this),this.reset(!0)}function T(t){if(t!=null){var n=t[a];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw TypeError(typeof t+` is not iterable`)}return p.prototype=m,c(v,`constructor`,m),c(m,`constructor`,p),p.displayName=c(m,s,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===p||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,s,`GeneratorFunction`)),e.prototype=Object.create(v),e},t.awrap=function(e){return{__await:e}},y(b.prototype),c(b.prototype,o,function(){return this}),t.AsyncIterator=b,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new b(l(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},y(v),c(v,s,`Generator`),c(v,a,function(){return this}),c(v,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},t.values=T,w.prototype={constructor:w,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e){o.type=`throw`,o.arg=t,n.next=e}for(var i=n.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a[4],s=this.prev,c=a[1],l=a[2];if(a[0]===-1)return r(`end`),!1;if(!c&&!l)throw Error(`try statement without catch or finally`);if(a[0]!=null&&a[0]<=s){if(s<c)return this.method=`next`,this.arg=e,r(c),!0;if(s<l)return r(l),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r[0]>-1&&r[0]<=this.prev&&this.prev<r[2]){var i=r;break}}i&&(e===`break`||e===`continue`)&&i[0]<=t&&t<=i[2]&&(i=null);var a=i?i[4]:{};return a.type=e,a.arg=t,i?(this.method=`next`,this.next=i[2],d):this.complete(a)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var r=n[4];if(r.type===`throw`){var i=r.arg;C(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={i:T(t),r:n,n:r},this.method===`next`&&(this.arg=e),d}},t}function ne(e,t){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ne(e,t)}function F(e,t){return f(e)||O(e,t)||oe(e,t)||k()}function re(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=w(e))!==null;);return e}function I(e,t,n,r){var i=C(w(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function L(e){return p(e)||D(e)||oe(e)||A()}function ie(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function R(e){var t=ie(e,`string`);return typeof t==`symbol`?t:t+``}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ae(e)}function oe(e,t){if(e){if(typeof e==`string`)return d(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function se(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof u;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}se.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},se.prototype.next=function(e){return this._invoke(`next`,e)},se.prototype.throw=function(e){return this._invoke(`throw`,e)},se.prototype.return=function(e){return this._invoke(`return`,e)};var z={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableBody:`table-up-body`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},B={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},ce={AFTER_TABLE_RESIZE:`after-table-resize`},le={moduleName:`table-up`},ue=[[`rgb(255, 255, 255)`,`rgb(0, 0, 0)`,`rgb(72, 83, 104)`,`rgb(41, 114, 244)`,`rgb(0, 163, 245)`,`rgb(49, 155, 98)`,`rgb(222, 60, 54)`,`rgb(248, 136, 37)`,`rgb(245, 196, 0)`,`rgb(153, 56, 215)`],[`rgb(242, 242, 242)`,`rgb(127, 127, 127)`,`rgb(243, 245, 247)`,`rgb(229, 239, 255)`,`rgb(229, 246, 255)`,`rgb(234, 250, 241)`,`rgb(254, 233, 232)`,`rgb(254, 243, 235)`,`rgb(254, 249, 227)`,`rgb(253, 235, 255)`],[`rgb(216, 216, 216)`,`rgb(89, 89, 89)`,`rgb(197, 202, 211)`,`rgb(199, 220, 255)`,`rgb(199, 236, 255)`,`rgb(195, 234, 213)`,`rgb(255, 201, 199)`,`rgb(255, 220, 196)`,`rgb(255, 238, 173)`,`rgb(242, 199, 255)`],[`rgb(191, 191, 191)`,`rgb(63, 63, 63)`,`rgb(128, 139, 158)`,`rgb(153, 190, 255)`,`rgb(153, 221, 255)`,`rgb(152, 215, 182)`,`rgb(255, 156, 153)`,`rgb(255, 186, 132)`,`rgb(255, 226, 112)`,`rgb(213, 142, 255)`],[`rgb(165, 165, 165)`,`rgb(38, 38, 38)`,`rgb(53, 59, 69)`,`rgb(20, 80, 184)`,`rgb(18, 116, 165)`,`rgb(39, 124, 79)`,`rgb(158, 30, 26)`,`rgb(184, 96, 20)`,`rgb(163, 130, 0)`,`rgb(94, 34, 129)`],[`rgb(147, 147, 147)`,`rgb(13, 13, 13)`,`rgb(36, 39, 46)`,`rgb(12, 48, 110)`,`rgb(10, 65, 92)`,`rgb(24, 78, 50)`,`rgb(88, 17, 14)`,`rgb(92, 48, 10)`,`rgb(102, 82, 0)`,`rgb(59, 21, 81)`]],de=`table-up`,fe=new Set([z.tableCellInner]),pe=function(e){return fe.has(e.statics.blotName)};function me(e){return e&&e.parent?pe(e.parent)?!0:me(e.parent):!1}function V(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:de,n=t?`${t}-`:``;return{b:function(){return`${n}${e}`},be:function(t){return t?`${n}${e}__${t}`:``},bm:function(t){return t?`${n}${e}--${t}`:``},bem:function(t,r){return t&&r?`${n}${e}__${t}--${r}`:``},ns:function(e){return e?`${n}${e}`:``},bs:function(t){return t?`${n}${e}-${t}`:``},cv:function(e){return e?`--${n}${e}`:``},is:function(e){return`is-${e}`}}}function H(e,t){for(var n=e.parent;n&&n.statics.blotName!==t&&n!==e.scroll;)n=n.parent;if(n===e.scroll)throw Error(`${e.statics.blotName} must be a child of ${t}`);return n}function he(e,t){for(var n=Array(t.length),r=new Map(t.map(function(e,t){return[e,t]})),i=e.parent;i&&i!==e.scroll&&r.size!==0;){if(r.has(i.statics.blotName)){var a=r.get(i.statics.blotName);n[a]=i,r.delete(i.statics.blotName)}i=i.parent}if(r.size>0)throw Error(`${e.statics.blotName} must be a child of ${Array.from(r.keys()).join(`, `)}`);return n}function ge(e){for(var t=new Map,n=e;n&&n.statics.blotName!==`scroll`;)t.set(n.statics.blotName,n),n=n.parent;return t}function _e(e,t){for(var n=[],r=e.children.iterator(),i=null;i=r();)i instanceof t&&n.push(i);return n}function ve(e,t,n){var r=x(Object.getOwnPropertyNames(t)),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;n&&n.test(a)||Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}}catch(e){r.e(e)}finally{r.f()}return e}function ye(e,t){var n=function(e){function t(){v(this,t);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return _(this,t,[].concat(n))}return T(t,e),b(t)}(e),r=x(t),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;ve(n.prototype,a.prototype,/^constructor$/)}}catch(e){r.e(e)}finally{r.f()}return n}function be(e,t){return e.prototype instanceof t}function xe(e,t){return e=Math.min(t,Math.max(0,Number.parseFloat(`${e}`))),Math.abs(e-t)<1e-6?1:e%t/Number.parseFloat(t)}function Se(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b)),a:Math.min(1,Math.max(0,e.a))}}function Ce(e){e=e.startsWith(`#`)?e.slice(1):e;var t=Number.parseInt(e.slice(0,2),16),n=Number.parseInt(e.slice(2,4),16),r=Number.parseInt(e.slice(4,6),16),i=Number((Number.parseInt(e.slice(6,8)||`ff`,16)/255).toFixed(2));return{r:t,g:n,b:r,a:i}}function we(e){var t=e.r,n=e.g,r=e.b,i=e.a;t=xe(t,255),n=xe(n,255),r=xe(r,255);var a=Math.max(t,n,r),o=Math.min(t,n,r),s,c=a,l=a-o,u=a===0?0:l/a;if(a===o)s=0;else{switch(a){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;case r:s=(t-n)/l+4;break}s/=6}return{h:s*360,s:u*100,b:c*100,a:i}}function Te(e){var t=e.h,n=e.s,r=e.b,i=e.a;t=xe(t,360)*6,n=xe(n,100),r=xe(r,100);var a=Math.floor(t),o=t-a,s=r*(1-n),c=r*(1-o*n),l=r*(1-(1-o)*n),u=a%6,d=[r,c,s,s,l,r][u],f=[l,r,r,c,s,s][u],p=[s,s,l,r,r,c][u];return{r:Math.round(d*255),g:Math.round(f*255),b:Math.round(p*255),a:i}}function Ee(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16),Math.round(e.a*255).toString(16)];for(var n in t)t[n].length===1&&(t[n]=`0${t[n]}`);return t.join(``)}var De=function(e){return Ee(Te(e))},Oe=function(e){return typeof e==`function`},ke=Array.isArray,Ae=function(e){return typeof e==`string`},je=function(e){return typeof e==`number`},Me=function(e){return e!==null&&ae(e)===`object`},Ne=function(e){return!Number.isNaN(e)&&Number(e)>0};function Pe(e){var t=e||{},n=t.type,r=n===void 0?`default`:n,i=t.content,a=V(`button`),o=document.createElement(`button`);return o.classList.add(a.b(),r),i&&(Ae(i)?o.textContent=i:o.appendChild(i)),o}function Fe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=230,n=150,r=10,i=we(Ce(e.color||`#ff0000`)),a=V(`color-picker`),o=document.createElement(`div`);o.classList.add(a.b());var s=document.createElement(`div`);s.classList.add(a.be(`content`));var c=document.createElement(`div`);c.classList.add(a.be(`selector`));var l=document.createElement(`div`);l.classList.add(a.be(`background`)),c.appendChild(l);var u=document.createElement(`div`);u.classList.add(a.be(`background-handle`)),l.appendChild(u);var d=document.createElement(`div`);d.classList.add(a.be(`alpha`));var f=document.createElement(`div`);f.classList.add(a.be(`alpha-bg`));var p=document.createElement(`div`);p.classList.add(a.be(`alpha-handle`)),d.appendChild(f),d.appendChild(p);var m=document.createElement(`div`);m.classList.add(a.be(`hue`));var h=document.createElement(`div`);h.classList.add(a.be(`hue-handle`)),m.appendChild(h);var g=document.createElement(`div`);g.classList.add(a.be(`action`));var _=[`r`,`g`,`b`,`a`].map(function(e){var t=document.createElement(`div`);t.classList.add(a.be(`action-item`),e);var n=document.createElement(`label`);n.textContent=e.toUpperCase();var r=document.createElement(`input`);return r.classList.add(a.be(`input`)),r.addEventListener(`input`,function(){r.value=r.value.replaceAll(/[^0-9]/g,``)}),r.addEventListener(`change`,function(){var t=Math.round(Number(r.value));e===`a`&&(t/=100);var n=Se(we(Object.assign({},Te(i),S({},e,t))));te(n),ee()}),t.appendChild(n),t.appendChild(r),g.appendChild(t),r}),v=F(_,4),y=v[0],b=v[1],C=v[2],w=v[3];s.appendChild(m),s.appendChild(c),s.appendChild(d),o.appendChild(s),o.appendChild(g);var T=!1,E=!1,D=!1;function O(){var e=De(i),t=x([y,b,C].entries()),n;try{for(t.s();!(n=t.n()).done;){var r=F(n.value,2),a=r[0],o=r[1];o.value=String(Number.parseInt(e[a*2]+e[a*2+1],16))}}catch(e){t.e(e)}finally{t.f()}w.value=String((i.a*100).toFixed(0))}function k(){Object.assign(u.style,{left:`${Math.floor(t*i.s/100)}px`,top:`${Math.floor(n*(100-i.b)/100)}px`})}function A(){c.style.backgroundColor=`#${Ee(Te({h:i.h,s:100,b:100,a:1}))}`}function j(){h.style.top=`${Math.floor(n-n*i.h/360)}px`}function M(){p.style.left=`${i.a*100}%`}function N(){var e=Te(i),t=e.r,n=e.g,r=e.b;f.style.background=`linear-gradient(to right, rgba(${t}, ${n}, ${r}, 0) 0%, rgba(${t}, ${n}, ${r}, 1) 100%)`}function ee(){k(),A(),j(),M(),N(),O()}function te(t){i=Se(Object.assign({},i,t)),O(),e.onChange&&e.onChange(`#${De(i)}`)}function P(e){var r=c.getBoundingClientRect(),i=r.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),a=r.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(t,e.pageX-a))/t),s=Math.floor(100*(n-Math.max(0,Math.min(n,e.pageY-i)))/n);te({s:o,b:s}),ee()}function ne(e){var t=m.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);te({h:Math.floor(360*(n-Math.max(0,Math.min(n,e.pageY-t)))/n)}),ee()}function re(e){var t=e.pageX,n=d.getBoundingClientRect(),i=t-n.left;i=Math.max(r/2,i),i=Math.min(i,n.width-r/2),te({a:Math.round((i-10/2)/(n.width-10)*100)/100}),ee()}function I(e){T&&(e.preventDefault(),P(e)),E&&(e.preventDefault(),ne(e)),D&&(e.preventDefault(),re(e))}function L(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,L),T=!1}function ie(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,L),T=!0,P(e)}c.addEventListener(`mousedown`,ie);function R(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,R),E=!1}function ae(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,R),E=!0,ne(e)}m.addEventListener(`mousedown`,ae);function oe(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,oe),D=!1}function se(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,oe),D=!0,re(e)}return d.addEventListener(`mousedown`,se),ee(),o}var Ie=8e3;function Le(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.child,n=e.target,r=n===void 0?document.body:n,i=e.beforeClose,a=i===void 0?function(){}:i,o=V(`dialog`),s=r,c=document.createElement(`div`);c.classList.add(o.b()),c.style.zIndex=String(Ie);var l=document.createElement(`div`);if(l.classList.add(o.be(`overlay`)),c.appendChild(l),t){var u=document.createElement(`div`);u.classList.add(o.be(`content`)),u.appendChild(t),l.appendChild(u),u.addEventListener(`click`,function(e){e.stopPropagation()})}var d=getComputedStyle(s).overflow;s.style.overflow=`hidden`,s.appendChild(c);var f=function(){a(),c.remove(),s.style.overflow=d};return c.addEventListener(`click`,f),Ie+=1,{dialog:c,close:f}}function Re(e,t){var n=V(`input`);t.type||(t.type=`text`),t.value||(t.value=``);var r=document.createElement(`div`);if(r.classList.add(n.be(`item`)),e){var i=document.createElement(`span`);i.classList.add(n.be(`label`)),i.textContent=e,r.appendChild(i)}var a=document.createElement(`div`);a.classList.add(n.be(`input`));var o=document.createElement(`input`);for(var s in t)o.setAttribute(s,t[s]);(t.max||t.min)&&o.addEventListener(`blur`,function(){t.max&&t.max<=Number(o.value)&&(o.value=String(t.max)),t.min&&t.min>=Number(o.value)&&(o.value=String(t.min))}),a.appendChild(o),r.appendChild(a),o.addEventListener(`focus`,function(){a.classList.add(`focus`)}),o.addEventListener(`blur`,function(){a.classList.remove(`focus`)});var c=function(e){var t;a.classList.contains(`error`)?t=a.querySelector(`.${n.be(`error-tip`)}`):(t=document.createElement(`span`),t.classList.add(n.be(`error-tip`)),a.appendChild(t)),t.textContent=e,a.classList.add(`error`);var r=function(){a.classList.remove(`error`),t.remove()};return{removeError:r}};return{item:r,input:o,errorTip:c}}function ze(){return Be.apply(this,arguments)}function Be(){return Be=g(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,_,v,y=arguments;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=y.length>0&&y[0]!==void 0?y[0]:{},n=V(`creator`),r=document.createElement(`div`),r.classList.add(n.b()),i=document.createElement(`div`),i.classList.add(n.be(`input`)),a=Re(t.rowText||`Row`,{type:`number`,value:String(t.row||``),max:99}),o=a.item,s=a.input,c=a.errorTip,l=Re(t.colText||`Column`,{type:`number`,value:String(t.col||``),max:99}),u=l.item,d=l.input,f=l.errorTip,i.appendChild(o),i.appendChild(u),r.appendChild(i),p=document.createElement(`div`),p.classList.add(n.be(`control`)),m=Pe({type:`confirm`,content:t.confirmText||`Confirm`}),h=Pe({type:`default`,content:t.cancelText||`Cancel`}),p.appendChild(m),p.appendChild(h),r.appendChild(p),_=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number(s.value),n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number(d.value);if(Number.isNaN(e)||e<=0){c(t.notPositiveNumberError||`Please enter a positive integer`);return}if(Number.isNaN(n)||n<=0){f(t.notPositiveNumberError||`Please enter a positive integer`);return}return{row:e,col:n}},v=function(e){e.key===`Escape`&&(close(),document.removeEventListener(`keydown`,v))},e.abrupt(`return`,new Promise(function(e,t){var n=Le({child:r,beforeClose:t}),i=n.close;s.focus();for(var a=0,o=[s,d];a<o.length;a++){var c=o[a];c.addEventListener(`keydown`,function(t){if(t.key===`Enter`){var n=_();n&&(e(n),i())}})}m.addEventListener(`click`,g(P().mark(function t(){var n;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=_(),n&&(e(n),i());case 2:case`end`:return t.stop()}},t)}))),document.addEventListener(`keydown`,v),h.addEventListener(`click`,i)}));case 21:case`end`:return e.stop()}},e)})),Be.apply(this,arguments)}function Ve(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=V(`select-box`),n=document.createElement(`div`);n.classList.add(t.b());var r=document.createElement(`div`);r.classList.add(t.be(`block`));for(var i=0;i<(e.row||8);i++)for(var a=0;a<(e.col||8);a++){var o=document.createElement(`div`);o.classList.add(t.be(`item`)),o.dataset.row=String(i+1),o.dataset.col=String(a+1),r.appendChild(o)}var s=function(){for(var e=n.dataset,t=e.row,i=e.col,a=0,o=Array.from(r.querySelectorAll(`.active`));a<o.length;a++){var s=o[a];s.classList.remove(`active`)}if(!(!t||!i))for(var c=Array.from(r.children),l=0;l<c.length;l++){var u=c[l].dataset,d=u.row,f=u.col;if(d>t&&f>i)return;d<=t&&f<=i?c[l].classList.add(`active`):c[l].classList.remove(`active`)}};if(r.addEventListener(`mousemove`,function(e){if(e.target){var t=e.target.dataset,r=t.row,i=t.col;!r||!i||(n.dataset.row=r,n.dataset.col=i,s())}}),r.addEventListener(`mouseleave`,function(){n.removeAttribute(`data-row`),n.removeAttribute(`data-col`),s()}),r.addEventListener(`click`,function(){var t=n.dataset,r=t.row,i=t.col;!r||!i||e.onSelect&&e.onSelect(Number(r),Number(i))}),n.appendChild(r),e.customBtn){var c=e.texts||{},l=document.createElement(`div`);l.classList.add(t.be(`custom`)),l.textContent=c.customBtnText||`Custom`,l.addEventListener(`click`,g(P().mark(function t(){var n;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ze(c);case 2:n=t.sent,n&&e.onSelect&&e.onSelect(n.row,n.col);case 4:case`end`:return t.stop()}},t)}))),n.appendChild(l)}return n}function He(e){"@babel/helpers - typeof";return He=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},He(e)}function Ue(e,t){if(He(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(He(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function We(e){var t=Ue(e,`string`);return He(t)==`symbol`?t:t+``}function Ge(e,t,n){return(t=We(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(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 U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ke(Object(n),!0).forEach(function(t){Ge(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let qe=Math.min,Je=Math.max,Ye=Math.round,Xe=Math.floor,Ze=e=>({x:e,y:e}),Qe={left:`right`,right:`left`,bottom:`top`,top:`bottom`},$e={start:`end`,end:`start`};function et(e,t,n){return Je(e,qe(t,n))}function tt(e,t){return typeof e==`function`?e(t):e}function nt(e){return e.split(`-`)[0]}function rt(e){return e.split(`-`)[1]}function it(e){return e===`x`?`y`:`x`}function at(e){return e===`y`?`height`:`width`}function ot(e){return[`top`,`bottom`].includes(nt(e))?`y`:`x`}function st(e){return it(ot(e))}function ct(e,t,n){n===void 0&&(n=!1);let r=rt(e),i=st(e),a=at(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pt(o)),[o,pt(o)]}function lt(e){let t=pt(e);return[ut(e),t,ut(t)]}function ut(e){return e.replace(/start|end/g,e=>$e[e])}function dt(e,t,n){let r=[`left`,`right`],i=[`right`,`left`],a=[`top`,`bottom`],o=[`bottom`,`top`];switch(e){case`top`:case`bottom`:return n?t?i:r:t?r:i;case`left`:case`right`:return t?a:o;default:return[]}}function ft(e,t,n,r){let i=rt(e),a=dt(nt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ut)))),a}function pt(e){return e.replace(/left|right|bottom|top/g,e=>Qe[e])}function mt(e){return U({top:0,right:0,bottom:0,left:0},e)}function ht(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:mt(e)}function gt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _t(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function vt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){_t(a,r,i,o,s,`next`,e)}function s(e){_t(a,r,i,o,s,`throw`,e)}o(void 0)})}}function yt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function bt(e,t){if(e==null)return{};var n,r,i=yt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let xt=[`crossAxis`,`alignment`,`allowedPlacements`,`autoAlignment`],St=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],Ct=[`strategy`],wt=[`mainAxis`,`crossAxis`,`limiter`],Tt=[`apply`];function Et(e,t,n){let{reference:r,floating:i}=e,a=ot(t),o=st(t),s=at(o),c=nt(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(rt(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let Dt=function(){var e=vt(function*(e,t,n){let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=yield o.isRTL==null?void 0:o.isRTL(t),l=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Et(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=yield h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g==null?u:g,d=_==null?d:_,p=U(U({},p),{},{[a]:U(U({},p[a]),v)}),y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?yield o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Et(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}});return function(t,n,r){return e.apply(this,arguments)}}();function Ot(e,t){return kt.apply(this,arguments)}function kt(){return kt=vt(function*(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=tt(t,e),m=ht(p),h=d===`floating`?`reference`:`floating`,g=s[f?h:d],_=gt(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(g))==null||n?g:g.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),v=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),b=(yield a.isElement==null?void 0:a.isElement(y))&&(yield a.getScale==null?void 0:a.getScale(y))||{x:1,y:1},x=gt(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(_.top-x.top+m.top)/b.y,bottom:(x.bottom-_.bottom+m.bottom)/b.y,left:(_.left-x.left+m.left)/b.x,right:(x.right-_.right+m.right)/b.x}}),kt.apply(this,arguments)}let At=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return vt(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=tt(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=bt(u,St);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=nt(i),y=ot(s),b=nt(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[pt(s)]:lt(s)),C=h!==`none`;!p&&C&&S.push(...ft(s,g,h,x));let w=[s,...S],T=yield Ot(t,_),E=[],D=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&E.push(T[v]),f){let e=ct(i,o,x);E.push(T[e[0]],T[e[1]])}if(D=[...D,{placement:i,overflows:E}],!E.every(e=>e<=0)){var O,k;let e=(((O=a.flip)==null?void 0:O.index)||0)+1,t=w[e];if(t){let n=f===`alignment`?y!==ot(t):!1;if(!n||D.every(e=>e.overflows[0]>0&&ot(e.placement)===y))return{data:{index:e,overflows:D},reset:{placement:t}}}let n=(k=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])==null?void 0:k.placement;if(!n)switch(m){case`bestFit`:{var A;let e=(A=D.filter(e=>{if(C){let t=ot(e.placement);return t===y||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])==null?void 0:A[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(i!==n)return{reset:{placement:n}}}return{}})()}}};function jt(e,t){return Mt.apply(this,arguments)}function Mt(){return Mt=vt(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=nt(n),s=rt(n),c=ot(n)===`y`,l=[`left`,`top`].includes(o)?-1:1,u=a&&c?-1:1,d=tt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}),Mt.apply(this,arguments)}let Nt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return vt(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield jt(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:U(U({},c),{},{placement:o})}})()}}},Pt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return vt(function*(){let{x:n,y:r,placement:i}=t,a=tt(e,t),{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=a,l=bt(a,wt),u={x:n,y:r},d=yield Ot(t,l),f=ot(nt(i)),p=it(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=et(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=et(n,h,r)}let g=c.fn(U(U({},t),{},{[p]:m,[f]:h}));return U(U({},g),{},{data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}})})()}}},Ft=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=tt(e,t),u={x:n,y:r},d=ot(i),f=it(d),p=u[f],m=u[d],h=tt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:U({mainAxis:0,crossAxis:0},h);if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var _,v;let e=f===`y`?`width`:`height`,t=[`top`,`left`].includes(nt(i)),n=a.reference[d]-a.floating[e]+(t&&((_=o.offset)==null?void 0:_[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:((v=o.offset)==null?void 0:v[d])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}};function It(){return typeof window<`u`}function Lt(e){return zt(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(zt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zt(e){return It()?e instanceof Node||e instanceof W(e).Node:!1}function Bt(e){return It()?e instanceof Element||e instanceof W(e).Element:!1}function Vt(e){return It()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Ht(e){return!It()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Ut(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Xt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&![`inline`,`contents`].includes(i)}function Wt(e){return[`table`,`td`,`th`].includes(Lt(e))}function Gt(e){return[`:popover-open`,`:modal`].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function Kt(e){let t=Jt(),n=Bt(e)?Xt(e):e;return[`transform`,`translate`,`scale`,`rotate`,`perspective`].some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`].some(e=>(n.willChange||``).includes(e))||[`paint`,`layout`,`strict`,`content`].some(e=>(n.contain||``).includes(e))}function qt(e){let t=Qt(e);for(;Vt(t)&&!Yt(t);){if(Kt(t))return t;if(Gt(t))return null;t=Qt(t)}return null}function Jt(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}function Yt(e){return[`html`,`body`,`#document`].includes(Lt(e))}function Xt(e){return W(e).getComputedStyle(e)}function Zt(e){return Bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qt(e){if(Lt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ht(e)&&e.host||Rt(e);return Ht(t)?t.host:t}function $t(e){let t=Qt(e);return Yt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&Ut(t)?t:$t(t)}function en(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=$t(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=W(i);if(a){let e=tn(o);return t.concat(o,o.visualViewport||[],Ut(i)?i:[],e&&n?en(e):[])}return t.concat(i,en(i,[],n))}function tn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nn(e){let t=Xt(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ye(n)!==a||Ye(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function rn(e){return Bt(e)?e:e.contextElement}function an(e){let t=rn(e);if(!Vt(t))return Ze(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=nn(t),o=(a?Ye(n.width):n.width)/r,s=(a?Ye(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let on=Ze(0);function sn(e){let t=W(e);return!Jt()||!t.visualViewport?on:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=rn(e),o=Ze(1);t&&(r?Bt(r)&&(o=an(r)):o=an(e));let s=cn(a,n,r)?sn(a):Ze(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=W(a),t=r&&Bt(r)?W(r):r,n=e,i=tn(n);for(;i&&r&&t!==n;){let e=an(i),t=i.getBoundingClientRect(),r=Xt(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=tn(n)}}return gt({width:u,height:d,x:c,y:l})}function un(e,t){let n=Zt(e).scrollLeft;return t?t.left+n:ln(Rt(e)).left+n}function dn(e,t,n){n===void 0&&(n=!1);let r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:un(e,r)),a=r.top+t.scrollTop;return{x:i,y:a}}function fn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Rt(r),s=t?Gt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ze(1),u=Ze(0),d=Vt(r);if((d||!d&&!a)&&((Lt(r)!==`body`||Ut(o))&&(c=Zt(r)),Vt(r))){let e=ln(r);l=an(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?dn(o,c,!0):Ze(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function pn(e){return Array.from(e.getClientRects())}function mn(e){let t=Rt(e),n=Zt(e),r=e.ownerDocument.body,i=Je(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Je(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+un(e),s=-n.scrollTop;return Xt(r).direction===`rtl`&&(o+=Je(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function hn(e,t){let n=W(e),r=Rt(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Jt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}function gn(e,t){let n=ln(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Vt(e)?an(e):Ze(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,c=i*a.x,l=r*a.y;return{width:o,height:s,x:c,y:l}}function _n(e,t,n){let r;if(t===`viewport`)r=hn(e,n);else if(t===`document`)r=mn(Rt(e));else if(Bt(t))r=gn(t,n);else{let n=sn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return gt(r)}function vn(e,t){let n=Qt(e);return n===t||!Bt(n)||Yt(n)?!1:Xt(n).position===`fixed`||vn(n,t)}function yn(e,t){let n=t.get(e);if(n)return n;let r=en(e,[],!1).filter(e=>Bt(e)&&Lt(e)!==`body`),i=null,a=Xt(e).position===`fixed`,o=a?Qt(e):e;for(;Bt(o)&&!Yt(o);){let t=Xt(o),n=Kt(o);!n&&t.position===`fixed`&&(i=null);let s=a?!n&&!i:!n&&t.position===`static`&&!!i&&[`absolute`,`fixed`].includes(i.position)||Ut(o)&&!n&&vn(e,o);s?r=r.filter(e=>e!==o):i=t,o=Qt(o)}return t.set(e,r),r}function bn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=n===`clippingAncestors`?Gt(t)?[]:yn(t,this._c):[].concat(n),o=[...a,r],s=o[0],c=o.reduce((e,n)=>{let r=_n(t,n,i);return e.top=Je(r.top,e.top),e.right=qe(r.right,e.right),e.bottom=qe(r.bottom,e.bottom),e.left=Je(r.left,e.left),e},_n(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function xn(e){let{width:t,height:n}=nn(e);return{width:t,height:n}}function Sn(e,t,n){let r=Vt(t),i=Rt(t),a=n===`fixed`,o=ln(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ze(0);function l(){c.x=un(i)}if(r||!r&&!a)if((Lt(t)!==`body`||Ut(i))&&(s=Zt(t)),r){let e=ln(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?dn(i,s):Ze(0),d=o.left+s.scrollLeft-c.x-u.x,f=o.top+s.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Cn(e){return Xt(e).position===`static`}function wn(e,t){if(!Vt(e)||Xt(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function Tn(e,t){let n=W(e);if(Gt(e))return n;if(!Vt(e)){let t=Qt(e);for(;t&&!Yt(t);){if(Bt(t)&&!Cn(t))return t;t=Qt(t)}return n}let r=wn(e,t);for(;r&&Wt(r)&&Cn(r);)r=wn(r,t);return r&&Yt(r)&&Cn(r)&&!Kt(r)?n:r||qt(e)||n}let En=function(){var e=vt(function*(e){let t=this.getOffsetParent||Tn,n=this.getDimensions,r=yield n(e.floating);return{reference:Sn(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}});return function(t){return e.apply(this,arguments)}}();function Dn(e){return Xt(e).direction===`rtl`}let On={convertOffsetParentRelativeRectToViewportRelativeRect:fn,getDocumentElement:Rt,getClippingRect:bn,getOffsetParent:Tn,getElementRects:En,getClientRects:pn,getDimensions:xn,getScale:an,isElement:Bt,isRTL:Dn};function kn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function An(e,t){let n=null,r,i=Rt(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Xe(d),h=Xe(i.clientWidth-(u+f)),g=Xe(i.clientHeight-(d+p)),_=Xe(u),v=-m+`px `+-h+`px `+-g+`px `+-_+`px`,y={rootMargin:v,threshold:Je(0,qe(1,c))||1},b=!0;function x(t){let n=t[0].intersectionRatio;if(n!==c){if(!b)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!kn(l,e.getBoundingClientRect())&&o(),b=!1}try{n=new IntersectionObserver(x,U(U({},y),{},{root:i.ownerDocument}))}catch(e){n=new IntersectionObserver(x,y)}n.observe(e)}return o(!0),a}function jn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=rn(e),u=i||a?[...l?en(l):[],...en(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?An(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?ln(e):null;c&&g();function g(){let t=ln(e);h&&!kn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Mn=Nt,Nn=Pt,Pn=At,Fn=Ft,In=(e,t,n)=>{let r=new Map,i=U({platform:On},n),a=U(U({},i.platform),{},{_c:r});return Dt(e,t,U(U({},i),{},{platform:a}))};function Ln(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(function(){n()},t)}var Rn=4,zn;function Bn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.msg,r=n===void 0?``:n,i=t.delay,a=i===void 0?150:i,o=t.content,s=t.direction,c=s===void 0?`bottom`:s,l=t.type,u=l===void 0?`hover`:l,d=t.container,f=t.onOpen,p=t.onClose,m=t.closed,h=t.onDestroy,g=V(`tooltip`);if(r||o){zn||(zn=document.createElement(`div`),document.body.appendChild(zn));var _=d||zn,v=document.createElement(`div`);v.classList.add(g.b(),`hidden`,`transparent`),o?v.appendChild(o):r&&(v.textContent=r);var y,b,x,S=function(){x&&x(),In(e,v,{placement:c,middleware:[Pn(),Nn({limiter:Fn()}),Mn(Rn)]}).then(function(e){var t=e.x,n=e.y;Object.assign(v.style,{left:`${t}px`,top:`${n}px`})})},C=function(){v.classList.add(`hidden`),_.contains(v)&&_.removeChild(v),x&&x(),m&&m()},w=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;b&&clearTimeout(b),y=setTimeout(function(){if(f){var n=f(t);if(!t&&n)return}_.appendChild(v),v.removeEventListener(`transitionend`,C),v.classList.remove(`hidden`),x=jn(e,v,S),v.classList.remove(`transparent`)},a)},T=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;y&&clearTimeout(y),b=setTimeout(function(){if(p){var t=p(e);if(!e&&t)return}Ln(v,150,C,{once:!0}),v.classList.add(`transparent`)},a)},E=function(){var t=[e,v],n=T.bind(void 0,!1),r=w.bind(void 0,!1),i=function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.addEventListener(`mouseenter`,r),a.addEventListener(`mouseleave`,n)}};return{prepare:i,show:w,hide:T,destroy:function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.removeEventListener(`mouseenter`,r),a.removeEventListener(`mouseleave`,n)}}}},D=function(){var t=function(e){e.stopPropagation(),T(!1)},n=function(e){e.stopPropagation(),w(),document.removeEventListener(`click`,t),document.addEventListener(`click`,t,{once:!0})};return{prepare:function(){v.addEventListener(`click`,function(e){return e.stopPropagation()}),e.addEventListener(`click`,n)},show:w,hide:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;T(e),document.removeEventListener(`click`,t)},destroy:function(){e.removeEventListener(`click`,n),document.removeEventListener(`click`,t)}}},O={hover:E,click:D},k=O[u](),A=k.prepare,j=k.show,M=k.hide,N=k.destroy;A();var ee=function(){M(!0),h&&h(),N(),x&&x(),v.remove()};return{show:j,hide:M,destroy:ee}}return null}function Vn(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=e.x,a=e.y,o=e.x1,s=e.y1,c=t.x,l=t.y,u=t.x1,d=t.y1,f,p;return r?(f=o<c+n||i-n>u,p=s<l+n||a-n>d):(f=o<=c+n||i-n>=u,p=s<=l+n||a-n>=d),!(f||p)}function Hn(e,t){var n=t.getBoundingClientRect();return{x:e.x-n.x-t.scrollLeft,y:e.y-n.y-t.scrollTop,x1:e.x-n.x-t.scrollLeft+e.width,y1:e.y-n.y-t.scrollTop+e.height,width:e.width,height:e.height}}var Un=8;function Wn(e){var t=e.left,n=e.top,r=e.width,i=e.height,a=document.documentElement,o=a.clientWidth,s=a.clientHeight,c=!1,l=!1;return t+r>o?(t=o-r-Un,c=!0):t<0&&(t=Un,c=!0),n+i>s?(n=s-i-Un,l=!0):n<0&&(n=Un,l=!0),{left:t,top:n,leftLimited:c,topLimited:l}}function Gn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Symbol(`ignoreFirstBind`),r=new Set,i=new ResizeObserver(function(r){t.ignoreFirstBind&&r.some(function(e){var t=e.target,r=t[n];return t[n]=!0,!r})||e(r)}),a=i.observe;i.observe=function(e,t){r.add(e),a.call(i,e,t)};var o=i.unobserve;i.unobserve=function(e){r.has(e)&&(r.delete(e),e[n]=void 0),o.call(i,e)};var s=i.disconnect;return i.disconnect=function(){var e=x(r.values()),t;try{for(e.s();!(t=e.n()).done;){var a=t.value;a[n]=void 0}}catch(t){e.e(t)}finally{e.f()}s.call(i)},i}function Kn(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function qn(){for(var e=0;e<this.scrollHandler.length;e++){var t=F(this.scrollHandler[e],2),n=t[0],r=t[1];n.removeEventListener(`scroll`,r)}this.scrollHandler=[]}function Jn(e){return{y:e.scrollTop,x:e.scrollLeft}}function Yn(e){for(var t={},n=e.trim().split(`;`),r=0;r<n.length;r++){var i=n[r].trim();if(i){var a=i.indexOf(`:`);if(a!==-1){var o=i.slice(0,Math.max(0,a)).trim(),s=i.slice(Math.max(0,a+1)).trim();t[Qn(o)]=s}}}return t}function Xn(e){return Object.entries(e).map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${Zn(n)}: ${r};`}).join(` `)}function Zn(e){var t=e.replaceAll(RegExp(`([A-Z])`,`g`),` $1`).trim();return t.split(` `).join(`-`).toLowerCase()}function Qn(e){return e.replaceAll(RegExp(`-(\\w)`,`g`),function(e,t){return t.toUpperCase()})}var G=function(){return Math.random().toString(36).slice(2)};function $n(e,t){var n;return function(){for(var r=this,i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];n&&clearTimeout(n),n=setTimeout(function(){e.apply(r,a)},t)}}var er=t.default.import(`parchment`),tr=t.default.import(`blots/container`),nr=t.default.import(`blots/block`),rr=t.default.import(`blots/block/embed`),K=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`optimize`,value:function(e){if(this.children.length===0)if(this.statics.defaultChild!=null){var t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove();this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}},{key:`enforceAllowedChildren`,value:function(){var e=this;this.children.forEach(function(n){var r=e.statics.allowedChildren.some(function(e){return n instanceof e});r||(n.statics.scope===er.Scope.BLOCK_BLOT?(n.parent instanceof t?(n.next!=null&&n.parent.splitAfter(n),n.prev!=null&&n.parent.splitAfter(n.prev)):(n.next!=null&&e.splitAfter(n),n.prev!=null&&e.splitAfter(n.prev)),n.parent.unwrap()):n instanceof er.ParentBlot?n.unwrap():n.remove())})}}],[{key:`create`,value:function(e){var t=document.createElement(this.tagName);return this.className&&t.classList.add(this.className),t}}])}(tr);S(K,`tagName`,void 0),S(K,`blotName`,z.container),S(K,`scope`,er.Scope.BLOCK_BLOT),S(K,`allowedChildren`,[nr,rr,tr]),S(K,`requiredContainer`,void 0),S(K,`defaultChild`,void 0);var ir=function(e){return Ne(e)?e:1},ar=t.default.import(`blots/block`),or=t.default.import(`blots/block/embed`),q=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n]),n.setAttribute(`contenteditable`,String(e.isEnabled())),i}return T(t,e),b(t,[{key:`setFormatValue`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n){if(!this.statics.isAllowStyle(e))return;this.parent&&this.parent.statics.blotName===z.tableCell&&this.parent.setFormatValue(e,t)}else{if(!this.statics.allowDataAttrs.has(e))return;var r=`data-${e}`;t?this.domNode.setAttribute(r,t):this.domNode.removeAttribute(r),this.parent&&this.parent.statics.blotName===z.tableCell&&this.parent.setFormatValue(e,t)}var i=this.descendants(ar,0),a=x(i),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;s.cache={}}}catch(e){a.e(e)}finally{a.f()}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId},set:function(e){this.setFormatValue(`row-id`,e)}},{key:`colId`,get:function(){return this.domNode.dataset.colId},set:function(e){this.setFormatValue(`col-id`,e)}},{key:`rowspan`,get:function(){return Number(this.domNode.dataset.rowspan)},set:function(e){this.setFormatValue(`rowspan`,e)}},{key:`colspan`,get:function(){return Number(this.domNode.dataset.colspan)},set:function(e){this.setFormatValue(`colspan`,e)}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}},set:function(e){if(this.emptyRow.toString()!==e.toString())try{e.length>0?this.setFormatValue(`empty-row`,JSON.stringify(e),!1):this.setFormatValue(`empty-row`,null,!1)}catch(e){this.setFormatValue(`empty-row`,null,!1)}}},{key:`getColumnIndex`,value:function(){var e=H(this,z.tableMain);return e.getColIds().indexOf(this.colId)}},{key:`setStyleByString`,value:function(e){for(var t=Yn(e),n=0,r=Object.entries(t);n<r.length;n++){var i=F(r[n],2),a=i[0],o=i[1];this.setFormatValue(a,o,!0)}}},{key:`formatAt`,value:function(e,n,r,i){this.children.length===0&&(this.appendChild(this.scroll.create(this.statics.defaultChild.blotName)),n+=1),I(t,`formatAt`,this,3)([e,n,r,i]),i&&i.style&&this.setStyleByString(i.style)}},{key:`insertAt`,value:function(e,n,r){var i=this.children.find(e),a=F(i,1),o=a[0];if(!o&&this.statics.defaultChild){var s=this.scroll.create(this.statics.defaultChild.blotName||`block`);this.appendChild(s)}I(t,`insertAt`,this,3)([e,n,r])}},{key:`formats`,value:function(){var e=this.statics.formats(this.domNode);return S({},this.statics.blotName,e)}},{key:`checkMerge`,value:function(){var e=this.colId,t=this.rowId,n=this.colspan,r=this.rowspan,i=this.next;return i!==null&&i.statics.blotName===this.statics.blotName&&i.rowId===t&&i.colId===e&&i.colspan===n&&i.rowspan===r}},{key:`optimize`,value:function(){var e=this.parent,t=this.statics.formats(this.domNode);if(this.prev&&this.prev instanceof or){var n=this.prev;if(this.insertBefore(n,this.children.head),this.length()<=1){var r=this.scroll.create(`block`);this.insertBefore(r,n.next)}}var i=e!==null&&e.statics.blotName!==z.tableCell;if(i&&(this.wrap(z.tableCell,t),this.children.length===0)){var a=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(a)}this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0?this.remove():this.domNode.dataset.style&&i&&e.domNode.style.cssText!==this.domNode.dataset.style&&this.setStyleByString(this.domNode.dataset.style)}},{key:`insertBefore`,value:function(e,n){if(e.statics.blotName===this.statics.blotName){var r=e,i=this.statics.formats(r.domNode),a=this.statics.formats(this.domNode),o=Object.entries(a).every(function(e){var t=F(e,2),n=t[0],r=t[1];return String(r)===String(i[n])});if(o){var s=this.split(n?n.offset():0);return this.parent.insertBefore(r,s)}else{var c=he(this,[z.tableRow,z.tableCell]),l=F(c,2),u=l[0],d=l[1];if(n){var f=n.offset(),p=this.length();if(f+1<p){var m=this.scroll.create(z.tableCellInner,a);this.children.forEachAt(f+1,this.length(),function(e){m.appendChild(e)}),u.insertBefore(m.wrap(z.tableCell,a),d.next)}}if(this.rowId!==r.rowId){if(n){var h=n.offset(u);u.split(h)}else if(d.next){var g=d.next.offset(u);u.split(g)}var _=this.scroll.create(z.tableRow,i),v=this.scroll.create(z.tableCell,i);return v.appendChild(r),_.appendChild(v),u.parent.insertBefore(_,u.next)}return u.insertBefore(r.wrap(z.tableCell,i),n?d:d.next)}}else if(e.statics.blotName===z.tableCol){try{var y=H(this,z.tableBody),b=this.offset(y),x=y.split(b);y.parent.insertBefore(e,x),e.optimize({})}catch(e){console.warn(`TableCellInner not in TableBody`)}return}I(t,`insertBefore`,this,3)([e,n])}}],[{key:`isAllowStyle`,value:function(e){var t=Qn(e),n=x(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(Qn(i)))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:`create`,value:function(e){var n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=I(t,`create`,this,2)([]);l.dataset.tableId=n,l.dataset.rowId=r,l.dataset.colId=i,l.dataset.rowspan=String(ir(a)),l.dataset.colspan=String(ir(o)),s&&(l.dataset.style=s);try{c&&(l.dataset.emptyRow=JSON.stringify(c))}catch(e){}return l}},{key:`formats`,value:function(e){var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.rowspan,o=t.colspan,s=t.style,c=t.emptyRow,l={tableId:String(n),rowId:String(r),colId:String(i),rowspan:Number(ir(a)),colspan:Number(ir(o))};s&&(l.style=s);try{c&&(l.emptyRow=JSON.parse(c))}catch(e){}return l}}])}(K);S(q,`blotName`,z.tableCellInner),S(q,`tagName`,`div`),S(q,`className`,`ql-table-cell-inner`),S(q,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`rowspan`,`colspan`,`empty-row`])),S(q,`defaultChild`,ar),S(q,`allowStyle`,new Set([`background-color`,`border`,`height`]));var J=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`setHeight`,value:function(e){this.foreachCellInner(function(t){t.setFormatValue(`height`,e,!0)})}},{key:`getCellByColId`,value:function(e,t){for(var n=H(this,z.tableMain),r=n.getColIds(),i=r.indexOf(e),a=this.children.iterator(),o=null;o=a();){if(o.colId===e)return o;var s=r.indexOf(o.colId);if(s<i&&s+o.colspan>i)return o}return this[t]&&this[t].statics.blotName===z.tableRow?this[t].getCellByColId(e,t):null}},{key:`insertCell`,value:function(e,t){for(var n=[],r=this.children.iterator(),i=0,a;(a=r())&&(i+=a.colspan,!(i>e));)if(a.rowspan!==1)for(var o=0;o<a.rowspan-1;o++)n[o]=(n[o]||0)+a.colspan;if(a&&i-a.colspan<e){var s=a.getCellInner();s.colspan+=1,a.rowspan!==1&&(n.skipRowNum=a.rowspan-1)}else{var c=this.scroll.create(z.tableCell,t),l=this.scroll.create(z.tableCellInner,t),u=this.scroll.create(`block`);u.appendChild(this.scroll.create(`break`)),l.appendChild(u),c.appendChild(l),this.insertBefore(c,a)}return n}},{key:`getCellByColumIndex`,value:function(e){var t=[],n=null,r=0;if(e<0)return[n,r,t];for(var i=this.children.iterator();n=i();){if(r+=n.colspan,n.rowspan!==1)for(var a=0;a<n.rowspan-1;a++)t[a]=(t[a]||0)+n.colspan;if(r>e)break}return[n,r,t]}},{key:`removeCell`,value:function(e){if(e<0)return[];var t=this.getCellByColumIndex(e),n=F(t,2),r=n[0],i=n[1],a=t[2];if(!r)return a;if(i-r.colspan<e||r.colspan>1){var o=r.descendants(q),s=F(o,1),c=s[0];if(r.colspan!==1&&e===i-r.colspan){var l=H(this,z.tableMain),u=l.getColIds();c.colId=u[u.indexOf(c.colId)+1]}r.rowspan!==1&&(a.skipRowNum=r.rowspan-1),--c.colspan}else r.remove();return a}},{key:`foreachCellInner`,value:function(e){for(var t=this.children.iterator(),n=0,r;r=t();){var i=r.descendants(q),a=F(i,1),o=a[0];if(e(o,n++))break}}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.rowId===this.rowId}},{key:`optimize`,value:function(e){var t=this.parent,n=this.tableId;t!==null&&t.statics.blotName!==z.tableBody&&this.wrap(z.tableBody,n),this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName),this.enforceAllowedChildren(),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,n.dataset.rowId=e.rowId,n}}])}(K);S(J,`blotName`,z.tableRow),S(J,`tagName`,`tr`),S(J,`className`,`ql-table-row`);var Y=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`insertRow`,value:function(e){var t=H(this,z.tableMain);if(t){var n=t.getColIds(),r=this.descendants(J),i=new Set(n),a=0,o=x(r),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;if(a===e)break;c.foreachCellInner(function(t){if(a+t.rowspan>e&&(t.rowspan+=1,i.delete(t.colId),t.colspan!==1))for(var r=n.indexOf(t.colId),o=0;o<t.colspan-1;o++)i.delete(n[r+o+1])}),a+=1}}catch(e){o.e(e)}finally{o.f()}var l=t.tableId,u=G(),d=this.scroll.create(z.tableRow,{tableId:l,rowId:u}),f=x(i),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=this.scroll.create(`break`),g=h.wrap(`block`),_=g.wrap(z.tableCellInner,{tableId:l,rowId:u,colId:m,rowspan:1,colspan:1}),v=_.wrap(z.tableCell,{tableId:l,rowId:u,colId:m,rowspan:1,colspan:1});d.appendChild(v)}}catch(e){f.e(e)}finally{f.f()}this.insertBefore(d,r[e]||null)}}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;if(n!==null&&n.statics.blotName!==z.tableMain){var r=this.tableId;this.wrap(z.tableMain,{tableId:r})}I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e,n}}])}(K);S(Y,`blotName`,z.tableBody),S(Y,`tagName`,`tbody`);var sr=t.default.import(`parchment`),cr=t.default.import(`blots/block`),lr=t.default.import(`blots/container`),ur=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`replaceWith`,value:function(e,t){var n=Ae(e)?this.scroll.create(e,t):e;if(n instanceof sr.ParentBlot)if(n.statics.blotName===z.tableCellInner){try{var r=H(this,z.tableCellInner),i=r.formats(),a=n.formats(),o=Object.keys(i);if(o.every(function(e){return JSON.stringify(i[e])===JSON.stringify(a[e])}))return r}catch(e){}var s=this.parent;if(s.statics.blotName===z.tableCellInner){if(s!=null&&s.insertBefore(n,this.prev?null:this.next),s.statics.blotName===z.tableCellInner)for(var c=this;c;){var l=c.next;n.appendChild(c),c=l}else n.appendChild(this);if(s&&s.length()===0){s.remove(),s.parent.statics.blotName===z.tableCell&&s.parent.length()===0&&s.parent.remove();var u=s.parent.parent;u.statics.blotName===z.tableRow&&u.children.length===0&&u.remove()}}else s instanceof lr?s.parent.insertBefore(n,s):s!=null&&s.insertBefore(n,this.next),n.appendChild(this);return n}else this.moveChildren(n);return this.parent!=null&&(this.parent.insertBefore(n,this.next),this.remove()),this.attributes.copy(n),n}},{key:`format`,value:function(e,n){if(e===z.tableCellInner&&this.parent.statics.blotName===e&&!n)try{var r=H(this,z.tableCellInner);r.unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}else I(t,`format`,this,3)([e,n])}}])}(cr),dr=t.default.import(`blots/block/embed`),fr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`delta`,value:function(){var e=I(t,`delta`,this,3)([]),n=pr(this);return n[z.tableCellInner]&&e.insert(`
5
5
  `,S({},z.tableCellInner,n[z.tableCellInner])),e}},{key:`length`,value:function(){var e=pr(this);return e[z.tableCellInner]&&(!this.next||this.next.length()<=1)?I(t,`length`,this,3)([])+1:I(t,`length`,this,3)([])}}])}(dr);function pr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e==null||(`formats`in e&&typeof e.formats==`function`&&(t=M(M({},t),e.formats()),n&&delete t[`code-token`]),e.parent==null||e.parent.statics.blotName===`scroll`||e.parent.statics.scope!==e.statics.scope)?t:pr(e.parent,t,n)}var mr=t.default.import(`parchment`),hr=t.default.import(`blots/scroll`),gr=function(e){function n(){return v(this,n),_(this,n,arguments)}return T(n,e),b(n,[{key:`enable`,value:function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=t.default.import(`formats/${z.tableCellInner}`),i=this.domNode.querySelectorAll(`.${r.className}`),a=0,o=Array.from(i);a<o.length;a++){var s=o[a];s.setAttribute(`contenteditable`,String(!!e))}for(var c=t.default.import(`formats/${z.tableCaption}`),l=this.domNode.querySelectorAll(`.${c.className}`),u=0,d=Array.from(l);u<d.length;u++){var f=d[u];f.setAttribute(`contenteditable`,String(!!e))}I(n,`enable`,this,3)([e])}},{key:`createBlock`,value:function(e,t){var n,r={};if(e[z.tableCellInner])n=z.tableCellInner;else for(var i=0,a=Object.entries(e);i<a.length;i++){var o=F(a[i],2),s=o[0],c=o[1],l=this.query(s,mr.Scope.BLOCK&mr.Scope.BLOT)!=null;l?n=s:r[s]=c}n===z.tableCellInner&&(r=M({},e),delete r[n]);var u=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(u,t||void 0);var d=u.length();u instanceof q&&d===0&&(d+=1);for(var f=0,p=Object.entries(r);f<p.length;f++){var m=F(p[f],2),h=m[0],g=m[1];u.formatAt(0,d,h,g)}return u}}])}(hr),_r=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">\r
6
6
  <!-- Icon from Tabler Icons by Paweł Kuna - https://github.com/tabler/tabler-icons/blob/master/LICENSE -->\r
7
7
  <path\r
@@ -120,11 +120,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
120
120
  <!-- Icon from TDesign Icons by TDesign - https://github.com/Tencent/tdesign-icons/blob/main/LICENSE -->
121
121
  <path fill="currentColor" d="M21 10v12h-2V12H5v10H3V10zm0-8v6H3V2zm-2 2H5v2h14z" />
122
122
  </svg>
123
- `,$r=`color-selector`,Q={Break:{name:`break`},CopyCell:{name:`CopyCell`,tip:`Copy cell`,icon:Vr,handle:function(e,t){var n=e.getTextByCell(t),r=e.getHTMLByCell(t),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},CutCell:{name:`CutCell`,tip:`Cut cell`,icon:Hr,handle:function(e,t){var n=e.getTextByCell(t),r=e.getHTMLByCell(t,!0),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},InsertTop:{name:`InsertTop`,icon:Kr,tip:`Insert row above`,handle:function(e,t){e.appendRow(t,!1),e.hideTableTools()}},InsertRight:{name:`InsertRight`,icon:Gr,tip:`Insert column right`,handle:function(e,t){e.appendCol(t,!0),e.hideTableTools()}},InsertBottom:{name:`InsertBottom`,icon:Ur,tip:`Insert row below`,handle:function(e,t){e.appendRow(t,!0),e.hideTableTools()}},InsertLeft:{name:`InsertLeft`,icon:Wr,tip:`Insert column Left`,handle:function(e,t){e.appendCol(t,!1),e.hideTableTools()}},MergeCell:{name:`MergeCell`,icon:qr,tip:`Merge Cell`,handle:function(e,t){e.mergeCells(t),e.hideTableTools()}},SplitCell:{name:`SplitCell`,icon:Zr,tip:`Split Cell`,handle:function(e,t){e.splitCell(t),e.hideTableTools()}},DeleteRow:{name:`DeleteRow`,icon:Yr,tip:`Delete Row`,handle:function(e,t){e.removeRow(t),e.hideTableTools()}},DeleteColumn:{name:`DeleteColumn`,icon:Jr,tip:`Delete Column`,handle:function(e,t){e.removeCol(t),e.hideTableTools()}},DeleteTable:{name:`DeleteTable`,icon:Xr,tip:`Delete table`,handle:function(e,t){e.deleteTable(t)}},BackgroundColor:{name:`BackgroundColor`,icon:zr,isColorChoose:!0,tip:`Set background color`,key:`background-color`,handle:function(e,t,n){e.setCellAttrs(t,`background-color`,n,!0)}},BorderColor:{name:`BorderColor`,icon:Br,isColorChoose:!0,tip:`Set border color`,key:`border-color`,handle:function(e,t,n){e.setCellAttrs(t,`border-color`,n,!0)}},SwitchWidth:{name:`SwitchWidth`,icon:Rr,tip:`Switch table width`,handle:function(e){if(e.table){var n=t.default.find(e.table);n&&(n.full?n.cancelFull():n.setFull())}}},InsertCaption:{name:`InsertCaption`,icon:Qr,tip:`Insert table caption`,handle:function(e){if(e.table){var n=t.default.find(e.table);if(n){var r=e.quill.scroll.create(`text`,`Table Caption`).wrap(z.tableCaption,{tableId:n.tableId});n.insertBefore(r,n.children.head)}}}}},ei=10,ti=V(`color-map`),$={selectWrapper:ti.b(),used:ti.bm(`used`),item:ti.be(`item`),btn:ti.be(`btn`),map:ti.be(`content`),mapRow:ti.be(`content-row`)},ni=function(){function e(n,r,i){var a=this;v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`usedColors`,new Set),S(this,`options`,void 0),S(this,`menu`,null),S(this,`isMenuDisplay`,!1),S(this,`isColorPicking`,!1),S(this,`updateUsedColor`,void 0),S(this,`tooltipItem`,[]),S(this,`activeTooltip`,null),S(this,`bem`,V(`menu`)),S(this,`colorItemClass`,`color-${G()}`),S(this,`colorChooseTooltipOption`,{direction:`top`}),S(this,`updateWhenTextChange`,function(){a.isMenuDisplay&&a.update()}),this.tableModule=n,this.quill=r,this.options=this.resolveOptions(i);try{var o=localStorage.getItem(this.options.localstorageKey)||`[]`,s=JSON.parse(o);ke(s)||(s=[]),s.slice(-1*ei).map(function(e){return a.usedColors.add(e)})}catch(e){}this.updateUsedColor=$n(function(e){if(e){if(a.usedColors.add(e),a.usedColors.size>ei){var t=Array.from(a.usedColors).slice(-1*ei);a.usedColors.clear(),t.map(function(e){return a.usedColors.add(e)})}localStorage.setItem(a.options.localstorageKey,JSON.stringify(Array.from(a.usedColors)));for(var n=Array.from(document.querySelectorAll(`.${a.colorItemClass}.${$.used}`)),r=0,i=n;r<i.length;r++){var o=i[r],s=document.createElement(`div`);s.classList.add($.item),s.style.backgroundColor=String(e);var c=Array.from(o.querySelectorAll(`.${$.item}[style*="background-color: ${s.style.backgroundColor}"]`));c.length<=0&&o.appendChild(s);var l=Array.from(o.querySelectorAll(`.${$.item}`)).slice(0,-1*ei),u=x(l),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;f.remove()}}catch(e){u.e(e)}finally{u.f()}}}},1e3),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`resolveOptions`,value:function(e){var t=Object.assign({tipText:!0,tools:[Q.InsertTop,Q.InsertRight,Q.InsertBottom,Q.InsertLeft,Q.Break,Q.MergeCell,Q.SplitCell,Q.Break,Q.DeleteRow,Q.DeleteColumn,Q.DeleteTable,Q.Break,Q.BackgroundColor,Q.BorderColor],localstorageKey:`__table-bg-used-color`,defaultColorMap:ue},e);return t}},{key:`buildTools`,value:function(){var e=this,t=document.createElement(`div`);t.classList.add(this.bem.b()),Object.assign(t.style,{display:`flex`});var n=x(this.options.tools),r;try{var i=function(){var n=r.value,i=n.name,a=n.icon,o=n.handle,s=n.isColorChoose,c=n.key,l=n.tip,u=l===void 0?``:l,d=document.createElement(`span`);if(d.classList.add(e.bem.be(`item`)),i===`break`)d.classList.add(e.bem.is(`break`));else{var f=document.createElement(`i`);if(f.classList.add(`icon`),Oe(a)?f.appendChild(a(e.tableModule)):f.innerHTML=a,d.appendChild(f),s&&c){var p=e.createColorChoose(d,{name:i,icon:a,handle:o,isColorChoose:s,key:c,tip:u});e.tooltipItem.push(p),d.classList.add($r)}else Oe(o)&&d.addEventListener(`click`,function(t){e.quill.focus(),o(e.tableModule,e.getSelectedTds(),t)},!1);var m=e.tableModule.options.texts[i]||u;e.options.tipText&&m&&u&&e.createTipText(d,m)}t.appendChild(d)};for(n.s();!(r=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}return t}},{key:`createColorChoose`,value:function(e,t){var n=this,r=t.handle,i=t.key,a=document.createElement(`div`);if(a.classList.add($.selectWrapper),this.options.defaultColorMap.length>0){var o=document.createElement(`div`);o.classList.add($.map);var s=x(this.options.defaultColorMap),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=document.createElement(`div`);u.classList.add($.mapRow);var d=x(l),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=document.createElement(`div`);m.classList.add($.item),m.style.backgroundColor=p,u.appendChild(m)}}catch(e){d.e(e)}finally{d.f()}o.appendChild(u)}}catch(e){s.e(e)}finally{s.f()}a.appendChild(o)}var h=document.createElement(`div`);h.classList.add($.mapRow),Object.assign(h.style,{marginTop:`4px`});var g=document.createElement(`div`);g.classList.add($.btn,`transparent`),g.textContent=this.tableModule.options.texts.transparent,g.addEventListener(`click`,function(){r(n.tableModule,n.getSelectedTds(),`transparent`)});var _=document.createElement(`div`);_.classList.add($.btn,`clear`),_.textContent=this.tableModule.options.texts.clear,_.addEventListener(`click`,function(){r(n.tableModule,n.getSelectedTds(),null)});var v=document.createElement(`div`);v.classList.add($.btn,`custom`),v.textContent=this.tableModule.options.texts.custom;var y=Fe({onChange:function(e){r(n.tableModule,n.getSelectedTds(),e),n.updateUsedColor(e)}}),b=Bn(v,{direction:`right`,type:`click`,content:y,container:v}),S=b.hide,C=b.destroy;h.appendChild(g),h.appendChild(_),h.appendChild(v),a.appendChild(h);var w=document.createElement(`div`);w.classList.add($.used,this.colorItemClass);var T=x(this.usedColors),E;try{for(T.s();!(E=T.n()).done;){var D=E.value,O=document.createElement(`div`);O.classList.add($.item),O.style.backgroundColor=D,w.appendChild(O)}}catch(e){T.e(e)}finally{T.f()}a.appendChild(w),a.addEventListener(`click`,function(e){e.stopPropagation(),S();var t=e.target,r=t.style.backgroundColor,a=n.getSelectedTds();if(t&&r&&a.length>0){if(n.tableModule.setCellAttrs(a,i,r,!0),!t.closest(`.${$.item}`))return;n.updateUsedColor(r)}});var k=Bn(e,M({type:`click`,content:a,onOpen:function(){return n.isMenuDisplay&&n.tableModule.tableSelection&&n.tableModule.tableSelection.hideDisplay(),n.setActiveTooltip(k),!1},onClose:function(){n.isMenuDisplay&&n.tableModule.tableSelection&&(n.tableModule.tableSelection.updateWithSelectedTds(),n.tableModule.tableSelection.showDisplay());var e=a.contains(y);return e&&S(),n.activeTooltip===k&&(n.activeTooltip=null),!1},onDestroy:function(){C(),n.activeTooltip===k&&(n.activeTooltip=null)}},this.colorChooseTooltipOption));return k.isColorPick=!0,k}},{key:`setActiveTooltip`,value:function(e){this.activeTooltip&&this.activeTooltip!==e&&this.activeTooltip.hide(!0),this.activeTooltip=e}},{key:`getSelectedTds`,value:function(){var e;return((e=this.tableModule.tableSelection)==null?void 0:e.selectedTds)||[]}},{key:`createTipText`,value:function(e,t){var n=Bn(e,{msg:t});n&&this.tooltipItem.push(n)}},{key:`show`,value:function(){!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.boundary||(Object.assign(this.menu.style,{display:`flex`}),this.isMenuDisplay=!0,this.update())}},{key:`update`,value:function(){}},{key:`hide`,value:function(){this.menu&&Object.assign(this.menu.style,{display:`none`});var e=x(this.tooltipItem),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.hide(!0)}}catch(t){e.e(t)}finally{e.f()}this.isMenuDisplay=!1}},{key:`destroy`,value:function(){this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.activeTooltip=null;var e=x(this.tooltipItem),n;try{for(e.s();!(n=e.n()).done;){var r=n.value;r.destroy()}}catch(t){e.e(t)}finally{e.f()}this.menu&&(this.hide(),this.menu.remove(),this.menu=null)}}])}(),ri=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),S(i,`colorChooseTooltipOption`,{direction:`right`}),S(i,`listenContextmenu`,function(e){var t;e.preventDefault();var n=e.composedPath();if(!(!n||n.length<=0)){var r=n.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`)});r&&(t=i.tableModule.tableSelection)!=null&&(t=t.selectedTds)!=null&&t.length?(i.menu||(i.menu=i.buildTools()),Object.assign(i.menu.style,{display:`flex`}),i.isMenuDisplay=!0,i.update({x:e.clientX,y:e.clientY}),document.addEventListener(`click`,function(){i.hide()},{once:!0})):i.hide()}}),i.tableModule=e,i.quill=n,i.quill.root.addEventListener(`contextmenu`,i.listenContextmenu),i}return T(t,e),b(t,[{key:`buildTools`,value:function(){var e=I(t,`buildTools`,this,3)([]);e.classList.add(this.bem.is(`contextmenu`));for(var n=e.getElementsByClassName($r),r=0,i=Array.from(n);r<i.length;r++){var a=i[r];a.addEventListener(`click`,function(e){return e.stopPropagation()})}return document.body.appendChild(e),e}},{key:`createTipText`,value:function(e,t){var n=document.createElement(`span`);n.textContent=t,e.appendChild(n)}},{key:`show`,value:function(){}},{key:`update`,value:function(e){if(!(!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection)&&e){I(t,`update`,this,3)([]);var n={display:`flex`,left:0,top:0},r=e.x,i=e.y;n.left=r,n.top=i,Object.assign(this.menu.style,M(M({},n),{},{left:`${n.left+window.scrollX}px`,top:`${n.top+window.scrollY}px`}));var a=this.menu.getBoundingClientRect(),o=Wn(a),s=o.left,c=o.top;Object.assign(this.menu.style,{left:`${s+window.scrollX}px`,top:`${c+window.scrollY}px`})}}},{key:`destroy`,value:function(){this.quill.root.removeEventListener(`contextmenu`,this.listenContextmenu),I(t,`destroy`,this,3)([])}}])}(ni),ii=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),i.tableModule=e,i.quill=n,i.menu=i.buildTools(),i.tableModule.addContainer(i.menu),i.show(),i.update(),i}return T(t,e),b(t,[{key:`update`,value:function(){var e=this;!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection||(I(t,`update`,this,3)([]),In(this.tableModule.tableSelection.cellSelect,this.menu,{placement:`bottom`,middleware:[Pn(),Nn({limiter:Fn()}),Mn(20)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.menu.style,{left:`${n}px`,top:`${r}px`})}))}}])}(ni),ai=function(e){return!e.full&&e.align===`right`},oi=function(){function e(t,n){v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`colIndex`,-1),S(this,`tableMain`,void 0),S(this,`dragging`,!1),S(this,`dragColBreak`,null),S(this,`handleColMouseUpFunc`,this.handleColMouseUp.bind(this)),S(this,`handleColMouseMoveFunc`,this.handleColMouseMove.bind(this)),S(this,`handleColMouseDownFunc`,this.handleColMouseDown.bind(this)),S(this,`rowIndex`,-1),S(this,`dragRowBreak`,null),S(this,`handleRowMouseUpFunc`,this.handleRowMouseUp.bind(this)),S(this,`handleRowMouseMoveFunc`,this.handleRowMouseMove.bind(this)),S(this,`handleRowMouseDownFunc`,this.handleRowMouseDown.bind(this)),S(this,`dragBEM`,V(`drag-line`)),this.tableModule=t,this.quill=n}return b(e,[{key:`findCurrentColIndex`,value:function(e){return-1}},{key:`colWidthChange`,value:function(e,t,n){}},{key:`createConfirmDialog`,value:function(){var e=g(P().mark(function e(t){var n,r,i;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.message,r=t.confirm,i=t.cancel,e.abrupt(`return`,new Promise(function(e){var t=document.createElement(`div`);Object.assign(t.style,{padding:`8px 12px`,fontSize:`14px`,lineHeight:`1.5`});var a=document.createElement(`p`);a.textContent=n;var o=document.createElement(`div`);Object.assign(o.style,{display:`flex`,justifyContent:`flex-end`,gap:`6px`});var s=Pe({content:i}),c=Pe({type:`confirm`,content:r});o.appendChild(s),o.appendChild(c),t.appendChild(a),t.appendChild(o);var l=Le({child:t}),u=l.close;s.addEventListener(`click`,function(){e(!1),u()}),c.addEventListener(`click`,function(){e(!0),u()})}));case 2:case`end`:return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`handleColMouseUp`,value:function(){var e=g(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,S,C,w,T,E,D,O,k,A,j;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!this.dragColBreak||!this.tableMain||this.colIndex===-1)){e.next=2;break}return e.abrupt(`return`);case 2:if(t=this.tableMain.getCols(),n=Number.parseInt(this.dragColBreak.dataset.w||`0`),r=this.tableMain.full,i=!1,a=[],r?(o=this.tableMain.domNode.getBoundingClientRect().width,s=n/o*100,c=t[this.colIndex].width,s<c?(s=Math.max(B.colMinWidthPre,s),t[this.colIndex+1]||t[this.colIndex-1]?(l=t[this.colIndex+1]?this.colIndex+1:this.colIndex-1,a.push({index:l,width:t[l].width+c-s})):s=100,i=!0,a.push({index:this.colIndex,width:s})):t[this.colIndex+1]&&(u=c+t[this.colIndex+1].width,s=Math.min(u-B.colMinWidthPre,s),i=!0,a.push({index:this.colIndex,width:s},{index:this.colIndex+1,width:u-s}))):(this.tableMain.domNode.style.width=`${Number.parseFloat(this.tableMain.domNode.style.width)-t[this.colIndex].domNode.getBoundingClientRect().width+n}px`,i=!0,a.push({index:this.colIndex,width:n})),document.body.removeChild(this.dragColBreak),this.dragColBreak=null,document.removeEventListener(`mouseup`,this.handleColMouseUpFunc),document.removeEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!1,!i){e.next=47;break}if(d=this.tableMain.domNode.getBoundingClientRect().width,!r){e.next=45;break}f=0,p=new Set(a.map(function(e){var t=e.index,n=e.width;return f+=n,t})),m=x(t.entries()),e.prev=19,m.s();case 21:if((h=m.n()).done){e.next=28;break}if(g=F(h.value,2),_=g[0],v=g[1],!p.has(_)){e.next=25;break}return e.abrupt(`continue`,26);case 25:f+=v.width;case 26:e.next=21;break;case 28:e.next=33;break;case 30:e.prev=30,e.t0=e.catch(19),m.e(e.t0);case 33:return e.prev=33,m.f(),e.finish(33);case 36:if(!(f>100)){e.next=45;break}return e.next=39,this.createConfirmDialog({message:this.tableModule.options.texts.perWidthInsufficient,confirm:this.tableModule.options.texts.confirmText,cancel:this.tableModule.options.texts.cancelText});case 39:if(e.sent){e.next=41;break}return e.abrupt(`return`);case 41:this.tableMain.cancelFull(),r=!1,y=x(a.entries());try{for(y.s();!(b=y.n()).done;)S=F(b.value,2),C=S[0],w=S[1],T=w.width,E=w.index,a[C]={index:E,width:T/100*d}}catch(e){y.e(e)}finally{y.f()}case 45:D=x(a);try{for(D.s();!(O=D.n()).done;)k=O.value,A=k.index,j=k.width,t[A].width=`${Math.round(j)}${r?`%`:`px`}`,this.colWidthChange(A,{px:Math.round(j/100*d),pre:Math.round(j)},r)}catch(e){D.e(e)}finally{D.f()}case 47:this.quill.emitter.emit(ce.AFTER_TABLE_RESIZE);case 48:case`end`:return e.stop()}},e,this,[[19,30,33,36]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`getColumnRect`,value:function(e){if(!this.tableMain)return null;var t=this.tableMain.getCols();if(e>=t.length)return null;for(var n=t[0].domNode.getBoundingClientRect().left,r=0;r<e;r++){var i=t[r].domNode.getBoundingClientRect();n+=i.width}var a=t[e],o=a.domNode.getBoundingClientRect().width;return{left:n,right:n+o,width:o}}},{key:`handleColMouseMove`,value:function(e){if(e.preventDefault(),!(!this.dragColBreak||!this.tableMain||this.colIndex===-1)){var t=this.tableMain.getCols(),n=this.getColumnRect(this.colIndex),r=this.tableMain.domNode.getBoundingClientRect(),i=e.clientX;if(this.tableMain.full){var a=B.colMinWidthPre/100*r.width,o=r.right;i>n.right&&t[this.colIndex+1]&&(o=Math.max(this.getColumnRect(this.colIndex+1).right-a,n.left+a));var s=n.left+a;i=Math.min(Math.max(i,s),o)}else ai(this.tableMain)?n.right-i<B.colMinWidthPx&&(i=n.right-B.colMinWidthPx):i-n.left<B.colMinWidthPx&&(i=n.left+B.colMinWidthPx);var c=i-n.left;return ai(this.tableMain)&&(c=n.right-i),this.dragColBreak.style.left=`${i}px`,this.dragColBreak.dataset.w=String(c),{left:i,width:c}}}},{key:`handleColMouseDown`,value:function(e){if(e.button===0&&(e.preventDefault(),this.tableMain)){var t=Dr(this.tableMain),n=t.rect,r=t.body;if(!(!r||!n)){var i=this.tableMain.getCols();if(this.colIndex=this.findCurrentColIndex(e),this.colIndex!==-1){var a=i[this.colIndex].width,o=this.tableMain.full?a/100*n.width:a;document.addEventListener(`mouseup`,this.handleColMouseUpFunc),document.addEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!0;var s=document.createElement(`div`);s.classList.add(this.dragBEM.b()),s.classList.add(this.dragBEM.is(`col`)),s.dataset.w=String(o);var c={top:n.y,left:e.clientX,height:n.height};Object.assign(s.style,{top:`${c.top}px`,left:`${c.left}px`,height:`${c.height}px`});var l=document.body;return l.appendChild(s),this.dragColBreak&&l.removeChild(this.dragColBreak),this.dragColBreak=s,c}}}}},{key:`findCurrentRowIndex`,value:function(e){return-1}},{key:`rowHeightChange`,value:function(e,t){}},{key:`handleRowMouseUp`,value:function(){if(!(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)){var e=Number.parseInt(this.dragRowBreak.dataset.h||`0`),t=this.tableMain.getRows();t[this.rowIndex].setHeight(`${e}px`),this.rowHeightChange(this.rowIndex,e),document.body.removeChild(this.dragRowBreak),this.dragRowBreak=null,document.removeEventListener(`mouseup`,this.handleRowMouseUpFunc),document.removeEventListener(`mousemove`,this.handleRowMouseMoveFunc),this.dragging=!1,this.quill.emitter.emit(ce.AFTER_TABLE_RESIZE)}}},{key:`handleRowMouseMove`,value:function(e){if(!(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)){e.preventDefault();var t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect(),r=e.clientY;return r-n.y<B.rowMinHeightPx&&(r=n.y+B.rowMinHeightPx),this.dragRowBreak.style.top=`${r}px`,this.dragRowBreak.dataset.h=String(r-n.y),{top:r,height:r-n.y}}}},{key:`handleRowMouseDown`,value:function(e){if(e.button===0&&(e.preventDefault(),this.tableMain&&(this.rowIndex=this.findCurrentRowIndex(e),this.rowIndex!==-1))){this.dragging=!0,document.addEventListener(`mouseup`,this.handleRowMouseUpFunc),document.addEventListener(`mousemove`,this.handleRowMouseMoveFunc);var t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect().height,r=this.tableMain.domNode.getBoundingClientRect(),i=document.createElement(`div`);i.classList.add(this.dragBEM.b()),i.classList.add(this.dragBEM.is(`row`)),i.dataset.h=String(n);var a={top:e.clientY,left:r.x,width:r.width};Object.assign(i.style,{top:`${a.top}px`,left:`${a.left}px`,width:`${a.width}px`});var o=document.body;return o.appendChild(i),this.dragRowBreak&&o.removeChild(this.dragRowBreak),this.dragRowBreak=i,a}}},{key:`update`,value:function(){}},{key:`destroy`,value:function(){}}])}(),si=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,i]),S(a,`tableModule`,void 0),S(a,`table`,void 0),S(a,`root`,void 0),S(a,`tableMain`,void 0),S(a,`tableWrapper`,void 0),S(a,`resizeObserver`,void 0),S(a,`tableCols`,[]),S(a,`tableRows`,[]),S(a,`rowHeadWrapper`,null),S(a,`colHeadWrapper`,null),S(a,`corner`,null),S(a,`scrollHandler`,[]),S(a,`lastHeaderSelect`,null),S(a,`size`,12),S(a,`bem`,V(`resize-box`)),S(a,`updateWhenTextChange`,function(){a.update()}),S(a,`handleColMouseDownFunc`,function(e){var t=this.handleColMouseDown(e);if(t&&this.dragColBreak){var n=_e(this.tableMain,xr),r=F(n,1),i=r[0],a=i&&i.side===`top`?0:this.size;Object.assign(this.dragColBreak.style,{top:`${t.top-a}px`,left:`${t.left}px`,height:`${t.height+this.size}px`})}return t}.bind(a)),S(a,`handleRowMouseDownFunc`,function(e){var t=this.handleRowMouseDown(e);return t&&this.dragRowBreak&&Object.assign(this.dragRowBreak.style,{top:`${t.top}px`,left:`${t.left-this.size}px`,width:`${t.width+this.size}px`}),t}.bind(a)),a.tableModule=e,a.table=r,a.tableMain=t.default.find(a.table),!a.tableMain||(a.tableWrapper=a.tableMain.parent,!a.tableWrapper)?te(a):(a.root=a.tableModule.addContainer(a.bem.b()),a.resizeObserver=new ResizeObserver(function(){a.show()}),a.resizeObserver.observe(a.table),a.quill.on(t.default.events.TEXT_CHANGE,a.updateWhenTextChange),a)}return T(n,e),b(n,[{key:`handleResizerHeader`,value:function(e,t,n){var r=n.clientX,i=n.clientY,a=this.table.getBoundingClientRect();if(this.tableModule.tableSelection){var o=this.tableModule.tableSelection;n.shiftKey||(this.lastHeaderSelect=null);var s=[{x:e?a.left:r,y:e?i:a.top},{x:e?a.right:r,y:e?i:a.bottom}];if(this.lastHeaderSelect){var c,l;if(this.lastHeaderSelect.isX){var u=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),d=u[this.lastHeaderSelect.index].getBoundingClientRect();c=Math.min(d.left,a.left),l=d.top+d.height/2}else{var f=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),p=f[this.lastHeaderSelect.index].getBoundingClientRect();c=p.left+p.width/2,l=Math.min(p.top,a.top)}this.lastHeaderSelect.isX===e?e?(s[0].y=Math.min(s[0].y,l),s[1].y=Math.max(s[1].y,l)):(s[0].x=Math.min(s[0].x,c),s[1].x=Math.max(s[1].x,c)):(s[1]={x:Math.max(s[0].x,c),y:Math.max(s[0].y,l)},s[0]={x:Math.min(s[0].x,c),y:Math.min(s[0].y,l)})}else this.lastHeaderSelect={isX:e,index:t};o.table=this.table,o.selectedTds=o.computeSelectedTds.apply(o,s),o.show()}}},{key:`findCurrentColIndex`,value:function(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`))).indexOf(e.target)}},{key:`colWidthChange`,value:function(e,t,n){var r=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`)));r[e].style.width=n?`${t.pre}%`:`${t.px}px`}},{key:`bindColEvents`,value:function(){var e=this,t=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),n=Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`)));Kn.call(this,this.tableWrapper.domNode,function(){e.colHeadWrapper.scrollLeft=e.tableWrapper.domNode.scrollLeft});var r=x(t.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=F(i.value,2),o=a[0],s=a[1];s.addEventListener(`click`,this.handleResizerHeader.bind(this,!1,o))}}catch(e){r.e(e)}finally{r.f()}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.addEventListener(`mousedown`,this.handleColMouseDownFunc),u.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}},{key:`findCurrentRowIndex`,value:function(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`))).indexOf(e.target)}},{key:`rowHeightChange`,value:function(e,t){var n=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`)));n[e].style.height=`${t}px`}},{key:`bindRowEvents`,value:function(){var e=this,t=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),n=Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`)));Kn.call(this,this.tableWrapper.domNode,function(){e.rowHeadWrapper.scrollTop=e.tableWrapper.domNode.scrollTop});var r=x(t.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=F(i.value,2),o=a[0],s=a[1];s.addEventListener(`click`,this.handleResizerHeader.bind(this,!0,o))}}catch(e){r.e(e)}finally{r.f()}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.addEventListener(`mousedown`,this.handleRowMouseDownFunc),u.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}},{key:`update`,value:function(){var e=Dr(this.tableMain),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.tableWrapper.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect();Object.assign(this.root.style,{top:`${Math.max(t.y,r.y)-i.y}px`,left:`${Math.max(t.x,r.x)-i.x}px`});var a=-1*this.size,o=-1*this.size;ai(this.tableMain)?(this.root.classList.add(this.bem.is(`align-right`)),a=Math.min(r.width,t.width),o=Math.min(r.width,t.width)):this.root.classList.remove(this.bem.is(`align-right`));var s=_e(this.tableMain,xr),c=F(s,1),l=c[0],u=!l||!(l&&l.side===`top`);u?this.root.classList.remove(this.bem.is(`caption-bottom`)):this.root.classList.add(this.bem.is(`caption-bottom`)),this.corner&&Object.assign(this.corner.style,{transform:`translateY(${-1*this.size}px) translateX(${a}px)`,top:`${u?0:t.height+this.size}px`}),this.rowHeadWrapper&&Object.assign(this.rowHeadWrapper.style,{transform:`translateX(${o}px)`}),this.colHeadWrapper&&Object.assign(this.colHeadWrapper.style,{top:`${u?0:t.height+this.size}px`})}}},{key:`show`,value:function(){var e=this;this.tableCols=this.tableMain.getCols(),this.tableRows=this.tableMain.getRows(),this.root.innerHTML=``;var t=Dr(this.tableMain),n=t.rect,r=t.body;if(!(!r||!n)){var i=this.tableWrapper.domNode.getBoundingClientRect();if(this.tableCols.length>0&&this.tableRows.length>0&&(this.corner=document.createElement(`div`),this.corner.classList.add(this.bem.be(`corner`)),Object.assign(this.corner.style,{width:`${this.size}px`,height:`${this.size}px`}),this.corner.addEventListener(`click`,function(){if(e.tableModule.tableSelection){var t=e.tableMain.descendants(q),n=e.tableModule.tableSelection;n.selectedTds=t,n.show(),n.updateWithSelectedTds()}}),this.root.appendChild(this.corner)),this.tableCols.length>0){var a=``,o=x(this.tableCols.entries()),s;try{for(o.s();!(s=o.n()).done;){var c=F(s.value,2),l=c[1],u=l.domNode.getBoundingClientRect().width;a+=`<div class="${this.bem.be(`col-header`)}" style="width: ${u}px">
123
+ `,$r=`color-selector`,Q={Break:{name:`break`},CopyCell:{name:`CopyCell`,tip:`Copy cell`,icon:Vr,handle:function(e,t){var n=e.getTextByCell(t),r=e.getHTMLByCell(t),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},CutCell:{name:`CutCell`,tip:`Cut cell`,icon:Hr,handle:function(e,t){var n=e.getTextByCell(t),r=e.getHTMLByCell(t,!0),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},InsertTop:{name:`InsertTop`,icon:Kr,tip:`Insert row above`,handle:function(e,t){e.appendRow(t,!1),e.hideTableTools()}},InsertRight:{name:`InsertRight`,icon:Gr,tip:`Insert column right`,handle:function(e,t){e.appendCol(t,!0),e.hideTableTools()}},InsertBottom:{name:`InsertBottom`,icon:Ur,tip:`Insert row below`,handle:function(e,t){e.appendRow(t,!0),e.hideTableTools()}},InsertLeft:{name:`InsertLeft`,icon:Wr,tip:`Insert column Left`,handle:function(e,t){e.appendCol(t,!1),e.hideTableTools()}},MergeCell:{name:`MergeCell`,icon:qr,tip:`Merge Cell`,handle:function(e,t){e.mergeCells(t),e.hideTableTools()}},SplitCell:{name:`SplitCell`,icon:Zr,tip:`Split Cell`,handle:function(e,t){e.splitCell(t),e.hideTableTools()}},DeleteRow:{name:`DeleteRow`,icon:Yr,tip:`Delete Row`,handle:function(e,t){e.removeRow(t),e.hideTableTools()}},DeleteColumn:{name:`DeleteColumn`,icon:Jr,tip:`Delete Column`,handle:function(e,t){e.removeCol(t),e.hideTableTools()}},DeleteTable:{name:`DeleteTable`,icon:Xr,tip:`Delete table`,handle:function(e,t){e.deleteTable(t)}},BackgroundColor:{name:`BackgroundColor`,icon:zr,isColorChoose:!0,tip:`Set background color`,key:`background-color`,handle:function(e,t,n){e.setCellAttrs(t,`background-color`,n,!0)}},BorderColor:{name:`BorderColor`,icon:Br,isColorChoose:!0,tip:`Set border color`,key:`border-color`,handle:function(e,t,n){e.setCellAttrs(t,`border-color`,n,!0)}},SwitchWidth:{name:`SwitchWidth`,icon:Rr,tip:`Switch table width`,handle:function(e){if(e.table){var n=t.default.find(e.table);n&&(n.full?n.cancelFull():n.setFull())}}},InsertCaption:{name:`InsertCaption`,icon:Qr,tip:`Insert table caption`,handle:function(e){if(e.table){var n=t.default.find(e.table);if(n){var r=e.quill.scroll.create(`text`,`Table Caption`).wrap(z.tableCaption,{tableId:n.tableId});n.insertBefore(r,n.children.head)}}}}},ei=10,ti=V(`color-map`),$={selectWrapper:ti.b(),used:ti.bm(`used`),item:ti.be(`item`),btn:ti.be(`btn`),map:ti.be(`content`),mapRow:ti.be(`content-row`)},ni=function(){function e(n,r,i){var a=this;v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`usedColors`,new Set),S(this,`options`,void 0),S(this,`menu`,null),S(this,`isMenuDisplay`,!1),S(this,`isColorPicking`,!1),S(this,`updateUsedColor`,void 0),S(this,`tooltipItem`,[]),S(this,`activeTooltip`,null),S(this,`bem`,V(`menu`)),S(this,`colorItemClass`,`color-${G()}`),S(this,`colorChooseTooltipOption`,{direction:`top`}),S(this,`updateWhenTextChange`,function(){a.isMenuDisplay&&a.update()}),this.tableModule=n,this.quill=r,this.options=this.resolveOptions(i);try{var o=localStorage.getItem(this.options.localstorageKey)||`[]`,s=JSON.parse(o);ke(s)||(s=[]),s.slice(-1*ei).map(function(e){return a.usedColors.add(e)})}catch(e){}this.updateUsedColor=$n(function(e){if(e){if(a.usedColors.add(e),a.usedColors.size>ei){var t=Array.from(a.usedColors).slice(-1*ei);a.usedColors.clear(),t.map(function(e){return a.usedColors.add(e)})}localStorage.setItem(a.options.localstorageKey,JSON.stringify(Array.from(a.usedColors)));for(var n=Array.from(document.querySelectorAll(`.${a.colorItemClass}.${$.used}`)),r=0,i=n;r<i.length;r++){var o=i[r],s=document.createElement(`div`);s.classList.add($.item),s.style.backgroundColor=String(e);var c=Array.from(o.querySelectorAll(`.${$.item}[style*="background-color: ${s.style.backgroundColor}"]`));c.length<=0&&o.appendChild(s);var l=Array.from(o.querySelectorAll(`.${$.item}`)).slice(0,-1*ei),u=x(l),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;f.remove()}}catch(e){u.e(e)}finally{u.f()}}}},1e3),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`resolveOptions`,value:function(e){var t=Object.assign({tipText:!0,tools:[Q.InsertTop,Q.InsertRight,Q.InsertBottom,Q.InsertLeft,Q.Break,Q.MergeCell,Q.SplitCell,Q.Break,Q.DeleteRow,Q.DeleteColumn,Q.DeleteTable,Q.Break,Q.BackgroundColor,Q.BorderColor],localstorageKey:`__table-bg-used-color`,defaultColorMap:ue},e);return t}},{key:`buildTools`,value:function(){var e=this,t=document.createElement(`div`);t.classList.add(this.bem.b()),Object.assign(t.style,{display:`flex`});var n=x(this.options.tools),r;try{var i=function(){var n=r.value,i=n.name,a=n.icon,o=n.handle,s=n.isColorChoose,c=n.key,l=n.tip,u=l===void 0?``:l,d=document.createElement(`span`);if(d.classList.add(e.bem.be(`item`)),i===`break`)d.classList.add(e.bem.is(`break`));else{var f=document.createElement(`i`);if(f.classList.add(`icon`),Oe(a)?f.appendChild(a(e.tableModule)):f.innerHTML=a,d.appendChild(f),s&&c){var p=e.createColorChoose(d,{name:i,icon:a,handle:o,isColorChoose:s,key:c,tip:u});e.tooltipItem.push(p),d.classList.add($r)}else Oe(o)&&d.addEventListener(`click`,function(t){e.quill.focus(),o(e.tableModule,e.getSelectedTds(),t)},!1);var m=e.tableModule.options.texts[i]||u;e.options.tipText&&m&&u&&e.createTipText(d,m)}t.appendChild(d)};for(n.s();!(r=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}return t}},{key:`createColorChoose`,value:function(e,t){var n=this,r=t.handle,i=t.key,a=document.createElement(`div`);if(a.classList.add($.selectWrapper),this.options.defaultColorMap.length>0){var o=document.createElement(`div`);o.classList.add($.map);var s=x(this.options.defaultColorMap),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=document.createElement(`div`);u.classList.add($.mapRow);var d=x(l),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=document.createElement(`div`);m.classList.add($.item),m.style.backgroundColor=p,u.appendChild(m)}}catch(e){d.e(e)}finally{d.f()}o.appendChild(u)}}catch(e){s.e(e)}finally{s.f()}a.appendChild(o)}var h=document.createElement(`div`);h.classList.add($.mapRow),Object.assign(h.style,{marginTop:`4px`});var g=document.createElement(`div`);g.classList.add($.btn,`transparent`),g.textContent=this.tableModule.options.texts.transparent,g.addEventListener(`click`,function(){r(n.tableModule,n.getSelectedTds(),`transparent`)});var _=document.createElement(`div`);_.classList.add($.btn,`clear`),_.textContent=this.tableModule.options.texts.clear,_.addEventListener(`click`,function(){r(n.tableModule,n.getSelectedTds(),null)});var v=document.createElement(`div`);v.classList.add($.btn,`custom`),v.textContent=this.tableModule.options.texts.custom;var y=Fe({onChange:function(e){r(n.tableModule,n.getSelectedTds(),e),n.updateUsedColor(e)}}),b=Bn(v,{direction:`right`,type:`click`,content:y,container:v}),S=b.hide,C=b.destroy;h.appendChild(g),h.appendChild(_),h.appendChild(v),a.appendChild(h);var w=document.createElement(`div`);w.classList.add($.used,this.colorItemClass);var T=x(this.usedColors),E;try{for(T.s();!(E=T.n()).done;){var D=E.value,O=document.createElement(`div`);O.classList.add($.item),O.style.backgroundColor=D,w.appendChild(O)}}catch(e){T.e(e)}finally{T.f()}a.appendChild(w),a.addEventListener(`click`,function(e){e.stopPropagation(),S();var t=e.target,r=t.style.backgroundColor,a=n.getSelectedTds();if(t&&r&&a.length>0){if(n.tableModule.setCellAttrs(a,i,r,!0),!t.closest(`.${$.item}`))return;n.updateUsedColor(r)}});var k=Bn(e,M({type:`click`,content:a,onOpen:function(){return n.isMenuDisplay&&n.tableModule.tableSelection&&n.tableModule.tableSelection.hideDisplay(),n.setActiveTooltip(k),!1},onClose:function(){n.isMenuDisplay&&n.tableModule.tableSelection&&(n.tableModule.tableSelection.updateWithSelectedTds(),n.tableModule.tableSelection.showDisplay());var e=a.contains(y);return e&&S(),n.activeTooltip===k&&(n.activeTooltip=null),!1},onDestroy:function(){C(),n.activeTooltip===k&&(n.activeTooltip=null)}},this.colorChooseTooltipOption));return k.isColorPick=!0,k}},{key:`setActiveTooltip`,value:function(e){this.activeTooltip&&this.activeTooltip!==e&&this.activeTooltip.hide(!0),this.activeTooltip=e}},{key:`getSelectedTds`,value:function(){var e;return((e=this.tableModule.tableSelection)==null?void 0:e.selectedTds)||[]}},{key:`createTipText`,value:function(e,t){var n=Bn(e,{msg:t});n&&this.tooltipItem.push(n)}},{key:`show`,value:function(){!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.boundary||(Object.assign(this.menu.style,{display:`flex`}),this.isMenuDisplay=!0,this.update())}},{key:`update`,value:function(){}},{key:`hide`,value:function(){this.menu&&Object.assign(this.menu.style,{display:`none`});var e=x(this.tooltipItem),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.hide(!0)}}catch(t){e.e(t)}finally{e.f()}this.isMenuDisplay=!1}},{key:`destroy`,value:function(){this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.activeTooltip=null;var e=x(this.tooltipItem),n;try{for(e.s();!(n=e.n()).done;){var r=n.value;r.destroy()}}catch(t){e.e(t)}finally{e.f()}this.menu&&(this.hide(),this.menu.remove(),this.menu=null)}}])}(),ri=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),S(i,`colorChooseTooltipOption`,{direction:`right`}),S(i,`listenContextmenu`,function(e){var t;e.preventDefault();var n=e.composedPath();if(!(!n||n.length<=0)){var r=n.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`)});r&&(t=i.tableModule.tableSelection)!=null&&(t=t.selectedTds)!=null&&t.length?(i.menu||(i.menu=i.buildTools()),Object.assign(i.menu.style,{display:`flex`}),i.isMenuDisplay=!0,i.update({x:e.clientX,y:e.clientY}),document.addEventListener(`click`,function(){i.hide()},{once:!0})):i.hide()}}),i.tableModule=e,i.quill=n,i.quill.root.addEventListener(`contextmenu`,i.listenContextmenu),i}return T(t,e),b(t,[{key:`buildTools`,value:function(){var e=I(t,`buildTools`,this,3)([]);e.classList.add(this.bem.is(`contextmenu`));for(var n=e.getElementsByClassName($r),r=0,i=Array.from(n);r<i.length;r++){var a=i[r];a.addEventListener(`click`,function(e){return e.stopPropagation()})}return document.body.appendChild(e),e}},{key:`createTipText`,value:function(e,t){var n=document.createElement(`span`);n.textContent=t,e.appendChild(n)}},{key:`show`,value:function(){}},{key:`update`,value:function(e){if(!(!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection)&&e){I(t,`update`,this,3)([]);var n={display:`flex`,left:0,top:0},r=e.x,i=e.y;n.left=r,n.top=i,Object.assign(this.menu.style,M(M({},n),{},{left:`${n.left+window.scrollX}px`,top:`${n.top+window.scrollY}px`}));var a=this.menu.getBoundingClientRect(),o=Wn(a),s=o.left,c=o.top;Object.assign(this.menu.style,{left:`${s+window.scrollX}px`,top:`${c+window.scrollY}px`})}}},{key:`destroy`,value:function(){this.quill.root.removeEventListener(`contextmenu`,this.listenContextmenu),I(t,`destroy`,this,3)([])}}])}(ni),ii=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),i.tableModule=e,i.quill=n,i.menu=i.buildTools(),i.tableModule.addContainer(i.menu),i.show(),i.update(),i}return T(t,e),b(t,[{key:`update`,value:function(){var e=this;!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection||(I(t,`update`,this,3)([]),In(this.tableModule.tableSelection.cellSelect,this.menu,{placement:`bottom`,middleware:[Pn(),Nn({limiter:Fn()}),Mn(20)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.menu.style,{left:`${n}px`,top:`${r}px`})}))}}])}(ni),ai=function(e){return!e.full&&e.align===`right`},oi=function(){function e(t,n){v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`colIndex`,-1),S(this,`tableMain`,void 0),S(this,`dragging`,!1),S(this,`dragColBreak`,null),S(this,`handleColMouseUpFunc`,this.handleColMouseUp.bind(this)),S(this,`handleColMouseMoveFunc`,this.handleColMouseMove.bind(this)),S(this,`handleColMouseDownFunc`,this.handleColMouseDown.bind(this)),S(this,`rowIndex`,-1),S(this,`dragRowBreak`,null),S(this,`handleRowMouseUpFunc`,this.handleRowMouseUp.bind(this)),S(this,`handleRowMouseMoveFunc`,this.handleRowMouseMove.bind(this)),S(this,`handleRowMouseDownFunc`,this.handleRowMouseDown.bind(this)),S(this,`dragBEM`,V(`drag-line`)),this.tableModule=t,this.quill=n}return b(e,[{key:`findCurrentColIndex`,value:function(e){return-1}},{key:`colWidthChange`,value:function(e,t,n){}},{key:`createConfirmDialog`,value:function(){var e=g(P().mark(function e(t){var n,r,i;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.message,r=t.confirm,i=t.cancel,e.abrupt(`return`,new Promise(function(e){var t=document.createElement(`div`);Object.assign(t.style,{padding:`8px 12px`,fontSize:`14px`,lineHeight:`1.5`});var a=document.createElement(`p`);a.textContent=n;var o=document.createElement(`div`);Object.assign(o.style,{display:`flex`,justifyContent:`flex-end`,gap:`6px`});var s=Pe({content:i}),c=Pe({type:`confirm`,content:r});o.appendChild(s),o.appendChild(c),t.appendChild(a),t.appendChild(o);var l=Le({child:t}),u=l.close;s.addEventListener(`click`,function(){e(!1),u()}),c.addEventListener(`click`,function(){e(!0),u()})}));case 2:case`end`:return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`handleColMouseUp`,value:function(){var e=g(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,S,C,w,T,E,D,O,k,A,j;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!this.dragColBreak||!this.tableMain||this.colIndex===-1)){e.next=2;break}return e.abrupt(`return`);case 2:if(t=this.tableMain.getCols(),n=Number.parseInt(this.dragColBreak.dataset.w||`0`),r=this.tableMain.full,i=!1,a=[],r?(o=this.tableMain.domNode.getBoundingClientRect().width,s=n/o*100,c=t[this.colIndex].width,s<c?(s=Math.max(B.colMinWidthPre,s),t[this.colIndex+1]||t[this.colIndex-1]?(l=t[this.colIndex+1]?this.colIndex+1:this.colIndex-1,a.push({index:l,width:t[l].width+c-s})):s=100,i=!0,a.push({index:this.colIndex,width:s})):t[this.colIndex+1]&&(u=c+t[this.colIndex+1].width,s=Math.min(u-B.colMinWidthPre,s),i=!0,a.push({index:this.colIndex,width:s},{index:this.colIndex+1,width:u-s}))):(this.tableMain.domNode.style.width=`${Number.parseFloat(this.tableMain.domNode.style.width)-t[this.colIndex].domNode.getBoundingClientRect().width+n}px`,i=!0,a.push({index:this.colIndex,width:n})),document.body.removeChild(this.dragColBreak),this.dragColBreak=null,document.removeEventListener(`mouseup`,this.handleColMouseUpFunc),document.removeEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!1,!i){e.next=47;break}if(d=this.tableMain.domNode.getBoundingClientRect().width,!r){e.next=45;break}f=0,p=new Set(a.map(function(e){var t=e.index,n=e.width;return f+=n,t})),m=x(t.entries()),e.prev=19,m.s();case 21:if((h=m.n()).done){e.next=28;break}if(g=F(h.value,2),_=g[0],v=g[1],!p.has(_)){e.next=25;break}return e.abrupt(`continue`,26);case 25:f+=v.width;case 26:e.next=21;break;case 28:e.next=33;break;case 30:e.prev=30,e.t0=e.catch(19),m.e(e.t0);case 33:return e.prev=33,m.f(),e.finish(33);case 36:if(!(f>100)){e.next=45;break}return e.next=39,this.createConfirmDialog({message:this.tableModule.options.texts.perWidthInsufficient,confirm:this.tableModule.options.texts.confirmText,cancel:this.tableModule.options.texts.cancelText});case 39:if(e.sent){e.next=41;break}return e.abrupt(`return`);case 41:this.tableMain.cancelFull(),r=!1,y=x(a.entries());try{for(y.s();!(b=y.n()).done;)S=F(b.value,2),C=S[0],w=S[1],T=w.width,E=w.index,a[C]={index:E,width:T/100*d}}catch(e){y.e(e)}finally{y.f()}case 45:D=x(a);try{for(D.s();!(O=D.n()).done;)k=O.value,A=k.index,j=k.width,t[A].width=`${Math.round(j)}${r?`%`:`px`}`,this.colWidthChange(A,{px:Math.round(j/100*d),pre:Math.round(j)},r)}catch(e){D.e(e)}finally{D.f()}case 47:this.quill.emitter.emit(ce.AFTER_TABLE_RESIZE);case 48:case`end`:return e.stop()}},e,this,[[19,30,33,36]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`getColumnRect`,value:function(e){if(!this.tableMain)return null;var t=this.tableMain.getCols();if(e>=t.length)return null;for(var n=t[0].domNode.getBoundingClientRect().left,r=0;r<e;r++){var i=t[r].domNode.getBoundingClientRect();n+=i.width}var a=t[e],o=a.domNode.getBoundingClientRect().width;return{left:n,right:n+o,width:o}}},{key:`handleColMouseMove`,value:function(e){if(e.preventDefault(),!(!this.dragColBreak||!this.tableMain||this.colIndex===-1)){var t=this.tableMain.getCols(),n=this.getColumnRect(this.colIndex),r=this.tableMain.domNode.getBoundingClientRect(),i=e.clientX;if(this.tableMain.full){var a=B.colMinWidthPre/100*r.width,o=r.right;i>n.right&&t[this.colIndex+1]&&(o=Math.max(this.getColumnRect(this.colIndex+1).right-a,n.left+a));var s=n.left+a;i=Math.min(Math.max(i,s),o)}else ai(this.tableMain)?n.right-i<B.colMinWidthPx&&(i=n.right-B.colMinWidthPx):i-n.left<B.colMinWidthPx&&(i=n.left+B.colMinWidthPx);var c=i-n.left;return ai(this.tableMain)&&(c=n.right-i),this.dragColBreak.style.left=`${i}px`,this.dragColBreak.dataset.w=String(c),{left:i,width:c}}}},{key:`handleColMouseDown`,value:function(e){if(e.button===0&&(e.preventDefault(),this.tableMain)){var t=Dr(this.tableMain),n=t.rect,r=t.body;if(!(!r||!n)){var i=this.tableMain.getCols();if(this.colIndex=this.findCurrentColIndex(e),this.colIndex!==-1){var a=i[this.colIndex].width,o=this.tableMain.full?a/100*n.width:a;document.addEventListener(`mouseup`,this.handleColMouseUpFunc),document.addEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!0;var s=document.createElement(`div`);s.classList.add(this.dragBEM.b(),this.dragBEM.is(`col`)),s.dataset.w=String(o);var c={top:n.y,left:e.clientX,height:n.height};Object.assign(s.style,{top:`${c.top}px`,left:`${c.left}px`,height:`${c.height}px`});var l=document.body;return l.appendChild(s),this.dragColBreak&&l.removeChild(this.dragColBreak),this.dragColBreak=s,c}}}}},{key:`findCurrentRowIndex`,value:function(e){return-1}},{key:`rowHeightChange`,value:function(e,t){}},{key:`handleRowMouseUp`,value:function(){if(!(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)){var e=Number.parseInt(this.dragRowBreak.dataset.h||`0`),t=this.tableMain.getRows();t[this.rowIndex].setHeight(`${e}px`),this.rowHeightChange(this.rowIndex,e),document.body.removeChild(this.dragRowBreak),this.dragRowBreak=null,document.removeEventListener(`mouseup`,this.handleRowMouseUpFunc),document.removeEventListener(`mousemove`,this.handleRowMouseMoveFunc),this.dragging=!1,this.quill.emitter.emit(ce.AFTER_TABLE_RESIZE)}}},{key:`handleRowMouseMove`,value:function(e){if(!(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)){e.preventDefault();var t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect(),r=e.clientY;return r-n.y<B.rowMinHeightPx&&(r=n.y+B.rowMinHeightPx),this.dragRowBreak.style.top=`${r}px`,this.dragRowBreak.dataset.h=String(r-n.y),{top:r,height:r-n.y}}}},{key:`handleRowMouseDown`,value:function(e){if(e.button===0&&(e.preventDefault(),this.tableMain&&(this.rowIndex=this.findCurrentRowIndex(e),this.rowIndex!==-1))){this.dragging=!0,document.addEventListener(`mouseup`,this.handleRowMouseUpFunc),document.addEventListener(`mousemove`,this.handleRowMouseMoveFunc);var t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect().height,r=this.tableMain.domNode.getBoundingClientRect(),i=document.createElement(`div`);i.classList.add(this.dragBEM.b(),this.dragBEM.is(`row`)),i.dataset.h=String(n);var a={top:e.clientY,left:r.x,width:r.width};Object.assign(i.style,{top:`${a.top}px`,left:`${a.left}px`,width:`${a.width}px`});var o=document.body;return o.appendChild(i),this.dragRowBreak&&o.removeChild(this.dragRowBreak),this.dragRowBreak=i,a}}},{key:`update`,value:function(){}},{key:`destroy`,value:function(){}}])}(),si=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,i]),S(a,`tableModule`,void 0),S(a,`table`,void 0),S(a,`root`,void 0),S(a,`tableMain`,void 0),S(a,`tableWrapper`,void 0),S(a,`resizeObserver`,void 0),S(a,`tableCols`,[]),S(a,`tableRows`,[]),S(a,`rowHeadWrapper`,null),S(a,`colHeadWrapper`,null),S(a,`corner`,null),S(a,`scrollHandler`,[]),S(a,`lastHeaderSelect`,null),S(a,`size`,12),S(a,`bem`,V(`resize-box`)),S(a,`updateWhenTextChange`,function(){a.update()}),S(a,`handleColMouseDownFunc`,function(e){var t=this.handleColMouseDown(e);if(t&&this.dragColBreak){var n=_e(this.tableMain,xr),r=F(n,1),i=r[0],a=i&&i.side===`top`?0:this.size;Object.assign(this.dragColBreak.style,{top:`${t.top-a}px`,left:`${t.left}px`,height:`${t.height+this.size}px`})}return t}.bind(a)),S(a,`handleRowMouseDownFunc`,function(e){var t=this.handleRowMouseDown(e);return t&&this.dragRowBreak&&Object.assign(this.dragRowBreak.style,{top:`${t.top}px`,left:`${t.left-this.size}px`,width:`${t.width+this.size}px`}),t}.bind(a)),a.tableModule=e,a.table=r,a.tableMain=t.default.find(a.table),!a.tableMain||(a.tableWrapper=a.tableMain.parent,!a.tableWrapper)?te(a):(a.root=a.tableModule.addContainer(a.bem.b()),a.resizeObserver=new ResizeObserver(function(){a.show()}),a.resizeObserver.observe(a.table),a.quill.on(t.default.events.TEXT_CHANGE,a.updateWhenTextChange),a)}return T(n,e),b(n,[{key:`handleResizerHeader`,value:function(e,t,n){var r=n.clientX,i=n.clientY,a=this.table.getBoundingClientRect();if(this.tableModule.tableSelection){var o=this.tableModule.tableSelection;n.shiftKey||(this.lastHeaderSelect=null);var s=[{x:e?a.left:r,y:e?i:a.top},{x:e?a.right:r,y:e?i:a.bottom}];if(this.lastHeaderSelect){var c,l;if(this.lastHeaderSelect.isX){var u=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),d=u[this.lastHeaderSelect.index].getBoundingClientRect();c=Math.min(d.left,a.left),l=d.top+d.height/2}else{var f=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),p=f[this.lastHeaderSelect.index].getBoundingClientRect();c=p.left+p.width/2,l=Math.min(p.top,a.top)}this.lastHeaderSelect.isX===e?e?(s[0].y=Math.min(s[0].y,l),s[1].y=Math.max(s[1].y,l)):(s[0].x=Math.min(s[0].x,c),s[1].x=Math.max(s[1].x,c)):(s[1]={x:Math.max(s[0].x,c),y:Math.max(s[0].y,l)},s[0]={x:Math.min(s[0].x,c),y:Math.min(s[0].y,l)})}else this.lastHeaderSelect={isX:e,index:t};o.table=this.table,o.selectedTds=o.computeSelectedTds.apply(o,s),o.show()}}},{key:`findCurrentColIndex`,value:function(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`))).indexOf(e.target)}},{key:`colWidthChange`,value:function(e,t,n){var r=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`)));r[e].style.width=n?`${t.pre}%`:`${t.px}px`}},{key:`bindColEvents`,value:function(){var e=this,t=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),n=Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`)));Kn.call(this,this.tableWrapper.domNode,function(){e.colHeadWrapper.scrollLeft=e.tableWrapper.domNode.scrollLeft});var r=x(t.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=F(i.value,2),o=a[0],s=a[1];s.addEventListener(`click`,this.handleResizerHeader.bind(this,!1,o))}}catch(e){r.e(e)}finally{r.f()}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.addEventListener(`mousedown`,this.handleColMouseDownFunc),u.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}},{key:`findCurrentRowIndex`,value:function(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`))).indexOf(e.target)}},{key:`rowHeightChange`,value:function(e,t){var n=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`)));n[e].style.height=`${t}px`}},{key:`bindRowEvents`,value:function(){var e=this,t=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),n=Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`)));Kn.call(this,this.tableWrapper.domNode,function(){e.rowHeadWrapper.scrollTop=e.tableWrapper.domNode.scrollTop});var r=x(t.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=F(i.value,2),o=a[0],s=a[1];s.addEventListener(`click`,this.handleResizerHeader.bind(this,!0,o))}}catch(e){r.e(e)}finally{r.f()}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.addEventListener(`mousedown`,this.handleRowMouseDownFunc),u.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}},{key:`update`,value:function(){var e=Dr(this.tableMain),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.tableWrapper.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect();Object.assign(this.root.style,{top:`${Math.max(t.y,r.y)-i.y}px`,left:`${Math.max(t.x,r.x)-i.x}px`});var a=-1*this.size,o=-1*this.size;ai(this.tableMain)?(this.root.classList.add(this.bem.is(`align-right`)),a=Math.min(r.width,t.width),o=Math.min(r.width,t.width)):this.root.classList.remove(this.bem.is(`align-right`));var s=_e(this.tableMain,xr),c=F(s,1),l=c[0],u=!l||!(l&&l.side===`top`);u?this.root.classList.remove(this.bem.is(`caption-bottom`)):this.root.classList.add(this.bem.is(`caption-bottom`)),this.corner&&Object.assign(this.corner.style,{transform:`translateY(${-1*this.size}px) translateX(${a}px)`,top:`${u?0:t.height+this.size}px`}),this.rowHeadWrapper&&Object.assign(this.rowHeadWrapper.style,{transform:`translateX(${o}px)`}),this.colHeadWrapper&&Object.assign(this.colHeadWrapper.style,{top:`${u?0:t.height+this.size}px`})}}},{key:`show`,value:function(){var e=this;this.tableCols=this.tableMain.getCols(),this.tableRows=this.tableMain.getRows(),this.root.innerHTML=``;var t=Dr(this.tableMain),n=t.rect,r=t.body;if(!(!r||!n)){var i=this.tableWrapper.domNode.getBoundingClientRect();if(this.tableCols.length>0&&this.tableRows.length>0&&(this.corner=document.createElement(`div`),this.corner.classList.add(this.bem.be(`corner`)),Object.assign(this.corner.style,{width:`${this.size}px`,height:`${this.size}px`}),this.corner.addEventListener(`click`,function(){if(e.tableModule.tableSelection){var t=e.tableMain.descendants(q),n=e.tableModule.tableSelection;n.selectedTds=t,n.show(),n.updateWithSelectedTds()}}),this.root.appendChild(this.corner)),this.tableCols.length>0){var a=``,o=x(this.tableCols.entries()),s;try{for(o.s();!(s=o.n()).done;){var c=F(s.value,2),l=c[1],u=l.domNode.getBoundingClientRect().width;a+=`<div class="${this.bem.be(`col-header`)}" style="width: ${u}px">
124
124
  <div class="${this.bem.be(`col-separator`)}" style="height: ${n.height+this.size-3}px"></div>
125
125
  </div>`}}catch(e){o.e(e)}finally{o.f()}var d=document.createElement(`div`);d.classList.add(this.bem.be(`col`));var f=document.createElement(`div`);f.classList.add(this.bem.be(`col-wrapper`)),Object.assign(d.style,{transform:`translateY(-${this.size}px)`,maxWidth:`${i.width}px`,height:`${this.size}px`}),Object.assign(f.style,{width:`${n.width}px`}),f.innerHTML=a,d.appendChild(f),this.root.appendChild(d),d.scrollLeft=this.tableWrapper.domNode.scrollLeft,this.colHeadWrapper=d,this.bindColEvents()}if(this.tableRows.length>0){var p=``,m=x(this.tableRows.entries()),h;try{for(m.s();!(h=m.n()).done;){var g=F(h.value,2),_=g[1],v=`${_.domNode.getBoundingClientRect().height}px`;p+=`<div class="${this.bem.be(`row-header`)}" style="height: ${Number.parseFloat(v)}px">
126
126
  <div class="${this.bem.be(`row-separator`)}" style="width: ${n.width+this.size-3}px"></div>
127
- </div>`}}catch(e){m.e(e)}finally{m.f()}var y=document.createElement(`div`);y.classList.add(this.bem.be(`row`));var b=document.createElement(`div`);b.classList.add(this.bem.be(`row-wrapper`)),Object.assign(y.style,{transform:`translateX(-${this.size}px)`,width:`${this.size}px`,maxHeight:`${i.height}px`}),Object.assign(b.style,{height:`${n.height}px`}),b.innerHTML=p,y.appendChild(b),this.root.appendChild(y),y.scrollTop=this.tableWrapper.domNode.scrollTop,this.rowHeadWrapper=y,this.bindRowEvents()}this.update(),Kn.call(this,this.quill.root,function(){e.update()})}}},{key:`hide`,value:function(){this.root.classList.add(this.bem.is(`hidden`))}},{key:`destroy`,value:function(){this.hide(),qn.call(this),this.resizeObserver.disconnect(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);var e=x(this.scrollHandler),n;try{for(e.s();!(n=e.n()).done;){var r=F(n.value,2),i=r[0],a=r[1];i.removeEventListener(`scroll`,a)}}catch(t){e.e(t)}finally{e.f()}this.root.remove()}}])}(oi),ci=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,i]),S(a,`tableModule`,void 0),S(a,`table`,void 0),S(a,`colResizer`,void 0),S(a,`rowResizer`,void 0),S(a,`currentTableCell`,void 0),S(a,`dragging`,!1),S(a,`curColIndex`,-1),S(a,`curRowIndex`,-1),S(a,`tableCellBlot`,void 0),S(a,`bem`,V(`resize-line`)),S(a,`mousemoveHandler`,function(e){if(!a.dragging&&!(a.tableModule.tableSelection&&a.tableModule.tableSelection.dragging)){var n=a.findTableCell(e);if(!n)return a.hide();var r=t.default.find(n);r&&a.currentTableCell!==n&&(a.show(),a.currentTableCell=n,a.tableCellBlot=r,a.tableMain=H(r,z.tableMain),a.tableMain.getCols().length>0&&a.updateColResizer(),a.updateRowResizer())}}),S(a,`hideWhenTextChange`,function(){a.hide()}),S(a,`handleColMouseUpFunc`,g(P().mark(function e(){return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.handleColMouseUp();case 2:this.updateColResizer();case 3:case`end`:return e.stop()}},e,this)})).bind(a)),S(a,`handleRowMouseUpFunc`,function(){this.handleRowMouseUp(),this.updateRowResizer()}.bind(a)),a.tableModule=e,a.table=r,a.colResizer=a.tableModule.addContainer(a.bem.be(`col`)),a.rowResizer=a.tableModule.addContainer(a.bem.be(`row`)),a.table.addEventListener(`mousemove`,a.mousemoveHandler),a.quill.on(t.default.events.TEXT_CHANGE,a.hideWhenTextChange),a}return T(n,e),b(n,[{key:`findTableCell`,value:function(e){var t=x(e.composedPath()),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;if(r instanceof HTMLElement&&r.tagName===`TD`)return r;if(r===document.body)return null}}catch(e){t.e(e)}finally{t.f()}return null}},{key:`findCurrentColIndex`,value:function(){var e;return this.curColIndex+(((e=this.tableCellBlot)==null?void 0:e.colspan)||1)-1}},{key:`updateColResizer`,value:function(){if(!(!this.tableMain||!this.tableCellBlot)){var e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.colResizer),this.colResizer=this.tableModule.addContainer(this.bem.be(`col`));var t=he(e,[z.tableBody]),n=F(t,1),r=n[0],i=r.domNode.getBoundingClientRect(),a=e.domNode.getBoundingClientRect(),o=this.quill.root.getBoundingClientRect(),s=a.right-o.x;ai(this.tableMain)&&(s=a.left-o.x),Object.assign(this.colResizer.style,{top:`${i.y-o.y}px`,left:`${s}px`,height:`${i.height}px`});var c=this.tableMain.getCols();this.curColIndex=c.findIndex(function(t){return t.colId===e.colId}),this.colResizer.addEventListener(`mousedown`,this.handleColMouseDownFunc),this.colResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}},{key:`findCurrentRowIndex`,value:function(){return this.curRowIndex}},{key:`updateRowResizer`,value:function(){if(!(!this.tableMain||!this.tableCellBlot)){var e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.rowResizer),this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`));var t=e.parent;if(t instanceof J){var n=he(e,[z.tableBody]),r=F(n,1),i=r[0],a=i.domNode.getBoundingClientRect(),o=e.domNode.getBoundingClientRect(),s=this.quill.root.getBoundingClientRect();Object.assign(this.rowResizer.style,{top:`${o.bottom-s.y}px`,left:`${a.x-s.x}px`,width:`${a.width}px`});var c=this.tableMain.getRows();this.curRowIndex=c.indexOf(t),this.rowResizer.addEventListener(`mousedown`,this.handleRowMouseDownFunc),this.rowResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}}},{key:`show`,value:function(){this.rowResizer.classList.remove(this.bem.is(`hidden`)),this.colResizer.classList.remove(this.bem.is(`hidden`))}},{key:`hide`,value:function(){this.currentTableCell=void 0,this.rowResizer.classList.add(this.bem.is(`hidden`)),this.colResizer.classList.add(this.bem.is(`hidden`))}},{key:`update`,value:function(){this.updateColResizer(),this.updateRowResizer()}},{key:`destroy`,value:function(){this.colResizer.remove(),this.rowResizer.remove(),this.table.removeEventListener(`mousemove`,this.mousemoveHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.hideWhenTextChange)}}])}(oi),li=function(){function e(n,r,i,a){var o=this;v(this,e),S(this,`tableModule`,void 0),S(this,`table`,void 0),S(this,`quill`,void 0),S(this,`scrollHandler`,[]),S(this,`tableMainBlot`,null),S(this,`tableWrapperBlot`,null),S(this,`bem`,V(`scale`)),S(this,`startX`,0),S(this,`startY`,0),S(this,`offset`,6),S(this,`options`,void 0),S(this,`root`,void 0),S(this,`block`,void 0),S(this,`resizeobserver`,new ResizeObserver(function(){return o.update()})),S(this,`updateWhenTextChange`,function(){o.update()}),this.tableModule=n,this.table=r,this.quill=i,this.options=this.resolveOptions(a),this.tableMainBlot=t.default.find(r),this.tableMainBlot&&!this.tableMainBlot.full&&(this.tableWrapperBlot=this.tableMainBlot.parent,this.buildResizer(),this.show()),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`resolveOptions`,value:function(e){return Object.assign({blockSize:12},e)}},{key:`buildResizer`,value:function(){var e=this;if(!(!this.tableMainBlot||!this.tableWrapperBlot)){this.root=this.tableModule.addContainer(this.bem.b()),this.root.classList.add(this.bem.is(`hidden`)),this.block=document.createElement(`div`),this.block.classList.add(this.bem.be(`block`)),Object.assign(this.block.style,{width:`${this.options.blockSize}px`,height:`${this.options.blockSize}px`}),this.root.appendChild(this.block);var t=[],n=[],r=function(r){if(e.tableMainBlot){var i=ai(e.tableMainBlot)?-1:1,a=(r.clientX-e.startX)*i,o=r.clientY-e.startY,s=Math.floor(a/t.length),c=Math.floor(o/n.length),l=x(t),u;try{for(l.s();!(u=l.n()).done;){var d=u.value,f=d.blot,p=d.width;f.width=Math.max(p+s,B.colMinWidthPx)}}catch(e){l.e(e)}finally{l.f()}var m=x(n),h;try{for(m.s();!(h=m.n()).done;){var g=h.value,_=g.blot,v=g.height;_.setHeight(`${Math.max(v+c,B.rowMinHeightPx)}px`)}}catch(e){m.e(e)}finally{m.f()}}},i=function(){t=[],n=[],document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};this.block.addEventListener(`mousedown`,function(a){!e.tableMainBlot||e.isTableOutofEditor()||(e.startX=a.clientX,e.startY=a.clientY,t=e.tableMainBlot.getCols().map(function(e){return{blot:e,width:Math.floor(e.width)}}),n=e.tableMainBlot.getRows().map(function(e){return{blot:e,height:Math.floor(e.domNode.getBoundingClientRect().height)}}),document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i))}),this.block.addEventListener(`dragstart`,function(e){return e.preventDefault()}),this.resizeobserver.observe(this.tableMainBlot.domNode),Kn.call(this,this.quill.root,function(){return e.update()}),Kn.call(this,this.tableWrapperBlot.domNode,function(){return e.update()})}}},{key:`isTableOutofEditor`,value:function(){if(!this.tableMainBlot||!this.tableWrapperBlot||this.tableMainBlot.full)return!1;var e=this.tableMainBlot.domNode.getBoundingClientRect(),t=this.tableWrapperBlot.domNode.getBoundingClientRect();if(e.width>t.width){var n=x(this.tableMainBlot.getCols()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.width=Math.floor(i.width/e.width*t.width)}}catch(e){n.e(e)}finally{n.f()}return this.tableMainBlot.colWidthFillTable(),!0}return!1}},{key:`update`,value:function(){if(!(!this.block||!this.root||!this.tableMainBlot||!this.tableWrapperBlot)){if(this.tableMainBlot.full){this.hide();return}var e=Dr(this.tableMainBlot),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.tableWrapperBlot.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect(),a=this.tableWrapperBlot.domNode,o=a.scrollTop,s=a.scrollLeft,c=this.options.blockSize*2+this.offset,l=Math.min(t.width,r.width)+c,u=Math.min(t.height,r.height)+c;Object.assign(this.root.style,{width:`${l}px`,height:`${u}px`,left:`${Math.max(t.x,r.x)-i.x-this.options.blockSize}px`,top:`${Math.max(t.y,r.y)-i.y-this.options.blockSize}px`});var d={left:`${t.width+c-s}px`,top:`${u-o}px`};ai(this.tableMainBlot)?(this.root.classList.add(this.bem.is(`align-right`)),d.left=`${this.options.blockSize+-1*s}px`):this.root.classList.remove(this.bem.is(`align-right`)),Object.assign(this.block.style,d)}}}},{key:`show`,value:function(){this.root&&(this.root.classList.remove(this.bem.is(`hidden`)),this.update())}},{key:`hide`,value:function(){this.root&&this.root.classList.add(this.bem.is(`hidden`))}},{key:`destroy`,value:function(){this.hide(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.resizeobserver.disconnect(),this.root&&this.root.remove(),qn.call(this)}}])}(),ui=function(){function e(n,r,i,a){var o=this;v(this,e),S(this,`quill`,void 0),S(this,`isVertical`,void 0),S(this,`table`,void 0),S(this,`scrollbarContainer`,void 0),S(this,`minSize`,20),S(this,`gap`,4),S(this,`move`,0),S(this,`cursorDown`,!1),S(this,`cursorLeave`,!1),S(this,`ratioY`,1),S(this,`ratioX`,1),S(this,`sizeWidth`,``),S(this,`sizeHeight`,``),S(this,`size`,``),S(this,`thumbState`,{X:0,Y:0}),S(this,`ob`,void 0),S(this,`container`,void 0),S(this,`scrollbar`,void 0),S(this,`thumb`,document.createElement(`div`)),S(this,`scrollHandler`,[]),S(this,`propertyMap`,void 0),S(this,`bem`,V(`scrollbar`)),S(this,`tableMainBlot`,void 0),S(this,`showScrollbar`,$n(function(){o.cursorLeave=!1,o.scrollbar.removeEventListener(`transitionend`,o.hideScrollbarTransitionend),o.scrollbar.style.display=o.size?`block`:`none`,requestAnimationFrame(function(){o.scrollbar.classList.remove(o.bem.is(`transparent`))})},200)),S(this,`hideScrollbar`,$n(function(){o.cursorLeave=!0,!o.cursorDown&&(o.scrollbar.removeEventListener(`transitionend`,o.hideScrollbarTransitionend),o.scrollbar.addEventListener(`transitionend`,o.hideScrollbarTransitionend,{once:!0}),o.scrollbar.classList.add(o.bem.is(`transparent`)))},200)),S(this,`hideScrollbarTransitionend`,function(){o.scrollbar.style.display=o.cursorDown&&o.size?`block`:`none`}),this.quill=n,this.isVertical=r,this.table=i,this.scrollbarContainer=a,this.tableMainBlot=t.default.find(this.table),this.container=i.parentElement,this.propertyMap=this.isVertical?{size:`height`,offset:`offsetHeight`,scrollDirection:`scrollTop`,scrollSize:`scrollHeight`,axis:`Y`,direction:`top`,client:`clientY`}:{size:`width`,offset:`offsetWidth`,scrollDirection:`scrollLeft`,scrollSize:`scrollWidth`,axis:`X`,direction:`left`,client:`clientX`},this.calculateSize(),this.ob=new ResizeObserver(function(){o.update()}),this.ob.observe(i),this.scrollbar=this.createScrollbar(),this.setScrollbarPosition(),Kn.call(this,this.quill.root,function(){return o.setScrollbarPosition()}),this.showScrollbar()}return b(e,[{key:`update`,value:function(){this.calculateSize(),this.setScrollbarPosition()}},{key:`setScrollbarPosition`,value:function(){var e=Dr(this.tableMainBlot),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.quill.root,i=r.scrollLeft,a=r.scrollTop,o=r.offsetLeft,s=r.offsetTop,c=this.container,l=c.offsetLeft,u=c.offsetTop,d=n.domNode,f=d.offsetLeft,p=d.offsetTop,m=this.container.getBoundingClientRect(),h=m.width,g=m.height,_=l+f-o,v=u+p-s;this.isVertical?_+=Math.min(h,t.width):v+=Math.min(g,t.height),this.tableMainBlot&&this.tableMainBlot.align!==`left`&&(_+=this.table.offsetLeft-l),Object.assign(this.scrollbar.style,S(S({},this.propertyMap.size,`${this.isVertical?Math.min(g,t.height):h}px`),`transform`,`translate(${_-i}px, ${v-a}px)`)),this.containerScrollHandler(this.container)}}},{key:`calculateSize`,value:function(){var e=this.container.offsetHeight-this.gap,t=this.container.offsetWidth-this.gap,n=Math.pow(e,2)/this.container.scrollHeight,r=Math.pow(t,2)/this.container.scrollWidth,i=Math.max(n,this.minSize),a=Math.max(r,this.minSize);this.ratioY=n/(e-n)/(i/(e-i)),this.ratioX=r/(t-r)/(a/(t-a)),this.sizeWidth=a+this.gap<t?`${a}px`:``,this.sizeHeight=i+this.gap<e?`${i}px`:``,this.size=this.isVertical?this.sizeHeight:this.sizeWidth}},{key:`createScrollbar`,value:function(){var e=this,t=document.createElement(`div`);t.classList.add(this.bem.b()),t.classList.add(this.isVertical?this.bem.is(`vertical`):this.bem.is(`horizontal`),this.bem.is(`transparent`)),Object.assign(t.style,{display:`none`}),this.thumb.classList.add(this.bem.be(`thumb`));var n=null,r=function(t){if(e.cursorDown!==!1){var n=e.thumbState[e.propertyMap.axis];if(n){var r=Math.pow(e.scrollbar[e.propertyMap.offset],2)/e.container[e.propertyMap.scrollSize]/(e.isVertical?e.ratioY:e.ratioX)/e.thumb[e.propertyMap.offset],i=(e.scrollbar.getBoundingClientRect()[e.propertyMap.direction]-t[e.propertyMap.client])*-1,a=e.thumb[e.propertyMap.offset]-n,o=(i-a)*100*r/e.scrollbar[e.propertyMap.offset];e.container[e.propertyMap.scrollDirection]=o*e.container[e.propertyMap.scrollSize]/100}}},i=function(){e.thumbState[e.propertyMap.axis]=0,e.cursorDown=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),e.cursorLeave&&e.hideScrollbar(),document.onselectstart=n},a=function(t){t.stopImmediatePropagation(),e.cursorDown=!0,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i),n=document.onselectstart,document.onselectstart=function(){return!1}};this.thumb.addEventListener(`mousedown`,function(t){var n;if(t.stopPropagation(),!(t.ctrlKey||[1,2].includes(t.button))){(n=window.getSelection())==null||n.removeAllRanges(),a(t);var r=t.currentTarget;r&&(e.thumbState[e.propertyMap.axis]=r[e.propertyMap.offset]-(t[e.propertyMap.client]-r.getBoundingClientRect()[e.propertyMap.direction]))}});for(var o=[this.table,t],s=0,c=o;s<c.length;s++){var l=c[s];l.addEventListener(`mouseenter`,this.showScrollbar),l.addEventListener(`mouseleave`,this.hideScrollbar)}return Kn.call(this,this.container,function(){e.containerScrollHandler(e.container)}),t.appendChild(this.thumb),t}},{key:`containerScrollHandler`,value:function(e){var t=e[this.propertyMap.offset]-this.gap;this.move=e[this.propertyMap.scrollDirection]*100/t*(this.isVertical?this.ratioY:this.ratioX),Object.assign(this.thumb.style,S(S({},this.propertyMap.size,this.size),`transform`,`translate${this.propertyMap.axis}(${this.move}%)`))}},{key:`destroy`,value:function(){this.ob.disconnect(),qn.call(this),this.table.removeEventListener(`mouseenter`,this.showScrollbar),this.table.removeEventListener(`mouseleave`,this.hideScrollbar)}}])}(),di=function(){function e(n,r,i){var a=this;v(this,e),S(this,`tableModule`,void 0),S(this,`table`,void 0),S(this,`quill`,void 0),S(this,`scrollbarContainer`,void 0),S(this,`scrollbar`,void 0),S(this,`bem`,V(`scrollbar`)),S(this,`updateWhenTextChange`,function(){a.update()}),this.tableModule=n,this.table=r,this.quill=i,this.scrollbarContainer=this.tableModule.addContainer(this.bem.be(`container`)),this.scrollbar=[new ui(i,!0,r,this.scrollbarContainer),new ui(i,!1,r,this.scrollbarContainer)];var o=x(this.scrollbar),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;this.scrollbarContainer.appendChild(c.scrollbar)}}catch(e){o.e(e)}finally{o.f()}this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`hide`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.hideScrollbar()}}catch(t){e.e(t)}finally{e.f()}}},{key:`show`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.showScrollbar()}}catch(t){e.e(t)}finally{e.f()}}},{key:`update`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.calculateSize(),n.setScrollbarPosition()}}catch(t){e.e(t)}finally{e.f()}}},{key:`destroy`,value:function(){this.scrollbarContainer.remove(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);var e=x(this.scrollbar),n;try{for(e.s();!(n=e.n()).done;){var r=n.value;r.destroy()}}catch(t){e.e(t)}finally{e.f()}}}])}(),fi=0,pi=function(){function e(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`boundary`,null),S(this,`scrollRecordEls`,[]),S(this,`startScrollRecordPosition`,[]),S(this,`selectedTableScrollX`,0),S(this,`selectedTableScrollY`,0),S(this,`selectedEditorScrollX`,0),S(this,`selectedEditorScrollY`,0),S(this,`selectedTds`,[]),S(this,`cellSelectWrap`,void 0),S(this,`cellSelect`,void 0),S(this,`dragging`,!1),S(this,`scrollHandler`,[]),S(this,`tableMenu`,void 0),S(this,`resizeObserver`,void 0),S(this,`table`,void 0),S(this,`isDisplaySelection`,!1),S(this,`bem`,V(`selection`)),S(this,`lastSelection`,{anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0}),S(this,`updateAfterEvent`,function(){i.updateWithSelectedTds()}),S(this,`quillSelectionChangeHandler`,function(e,n,r){if(r!==t.default.sources.API&&e&&!i.quill.composition.isComposing&&i.selectedTds.length>0){var a=i.quill.getFormat(e),o=i.quill.getLine(e.index),s=F(o,1),c=s[0],l=!!a[z.tableCellInner]&&!!c,u=i.selectedTds.some(function(e){return e.children.contains(c)});if(l&&!u)try{var d=H(c,z.tableCellInner);i.selectedTds=[d],i.updateWithSelectedTds()}catch(e){}else l&&u||i.hide()}}),S(this,`selectionChangeHandler`,function(){var e=window.getSelection();if(e){var n=e.anchorNode,r=e.focusNode,a=e.anchorOffset,o=e.focusOffset;if(!(!n||!r)){var s=t.default.find(n),c=t.default.find(r);if(!(!s||!c||s.scroll!==i.quill.scroll||c.scroll!==i.quill.scroll)){var l=ge(s),u=ge(c),d=l.has(z.tableColgroup),f=u.has(z.tableColgroup);if(d||f){var p=n,m=a,h=r,g=o;if(d){var _=l.get(z.tableWrapper),v=_.descendants(q);v.length>0&&(p=v[0].domNode,m=0)}if(f){var y=u.get(z.tableWrapper),b=y.descendants(q);b.length>0&&(h=b[0].domNode,g=0)}i.setSelectionData(e,{anchorNode:p,anchorOffset:m,focusNode:h,focusOffset:g});return}var x=l.has(z.tableCellInner),S=u.has(z.tableCellInner),C=x&&S;if(C){var w=l.get(z.tableCellInner),T=u.get(z.tableCellInner);C&&(C=w!==T)}if(x&&S&&C||!x&&S||!S&&x){i.setSelectionData(e,i.lastSelection),i.selectedTds.length>0&&i.hide();return}i.lastSelection={anchorNode:n,anchorOffset:a,focusNode:r,focusOffset:o}}}}}),S(this,`mouseDownHandler`,function(e){var t=e.button,n=e.target,r=e.clientX,a=e.clientY,o=n.closest(`.ql-table`),s=n.closest(`caption`);if(!(t!==0||!o||s)){i.setSelectionTable(o);var c=o.dataset.tableId,l={x:r,y:a};i.recordScrollPosition(),i.selectedTds=i.computeSelectedTds(l,l),i.dragging=!0,i.show();var u=function(e){i.tableMenu&&i.tableMenu.hide(),i.tableModule.tableResize&&i.tableModule.tableResize.hide();var t=e.button,n=e.target,r=e.clientX,a=e.clientY,o=n.closest(`.ql-table`),s=n.closest(`caption`);if(!(t!==0||s||!o||o.dataset.tableId!==c)){var u={x:r,y:a};i.selectedTds=i.computeSelectedTds(l,u),i.selectedTds.length>1&&i.quill.blur(),i.update()}},d=function(){document.body.removeEventListener(`mousemove`,u,!1),document.body.removeEventListener(`mouseup`,d,!1),i.dragging=!1,i.clearRecordScrollPosition(),i.tableMenu&&i.selectedTds.length>0&&i.tableMenu.show()};document.body.addEventListener(`mousemove`,u,!1),document.body.addEventListener(`mouseup`,d,!1)}}),S(this,`removeCell`,function(e){var n=i.quill.getSelection();if(!(n||e.key!==`Backspace`&&e.key!==`Delete`)){var r=x(i.selectedTds),a;try{for(r.s();!(a=r.n()).done;){var o=a.value;o.deleteAt(0,o.length()-1)}}catch(e){r.e(e)}finally{r.f()}if(i.table){var s=t.default.find(i.table),c=s.descendants(q);i.selectedTds.length===c.length&&s.remove()}}}),this.tableModule=n,this.quill=r,this.options=this.resolveOptions(a),this.scrollRecordEls=[this.quill.root,document.documentElement],this.cellSelectWrap=n.addContainer(this.bem.b()),this.cellSelect=this.helpLinesInitial(),this.resizeObserver=Gn(function(){return i.updateAfterEvent()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.quill.root),this.quill.root.addEventListener(`mousedown`,this.mouseDownHandler,{passive:!1}),document.addEventListener(`selectionchange`,this.selectionChangeHandler,{passive:!1}),this.quill.on(ce.AFTER_TABLE_RESIZE,this.updateAfterEvent),this.quill.on(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.on(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.options.tableMenu&&(this.tableMenu=new this.options.tableMenu(n,r,this.options.tableMenuOptions)),this.hide()}return b(e,[{key:`getFirstTextNode`,value:function(e){for(var t=0,n=Array.from(e.childNodes);t<n.length;t++){var r=n[t];if(r.nodeType===Node.TEXT_NODE)return r}return e}},{key:`getLastTextNode`,value:function(e){for(var t=e.childNodes.length-1;t>=0;t--){var n=e.childNodes[t];if(n.nodeType===Node.TEXT_NODE)return n}return e}},{key:`getNodeTailOffset`,value:function(e){var t=document.createRange();return t.selectNodeContents(e),t.collapse(!1),t.startOffset}},{key:`setSelectionData`,value:function(e,t){var n=t.anchorNode,r=t.anchorOffset,i=t.focusNode,a=t.focusOffset;if(!(!n||!i)){var o=document.createRange(),s=this.selectionDirectionUp(t);s?(o.setStart(n,r),o.setEnd(n,r)):(o.setStart(n,r),o.setEnd(i,a)),e.removeAllRanges(),e.addRange(o),s&&e.extend(i,a)}}},{key:`selectionDirectionUp`,value:function(e){var t=e.anchorNode,n=e.anchorOffset,r=e.focusNode,i=e.focusOffset;if(!t||!r)return!1;if(t===r)return n>i;var a=t.compareDocumentPosition(r);return a&Node.DOCUMENT_POSITION_CONTAINS||a&Node.DOCUMENT_POSITION_CONTAINED_BY?(a&Node.DOCUMENT_POSITION_FOLLOWING)!==0:(a&Node.DOCUMENT_POSITION_PRECEDING)!==0}},{key:`findWrapSelection`,value:function(e){var t=null,n=0,r=null,i=0,a=x(e),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=s.node,l=s.offset;c&&((!t||this.selectionDirectionUp({anchorNode:t,anchorOffset:n,focusNode:c,focusOffset:l}))&&(t=c,n=l),(!r||this.selectionDirectionUp({anchorNode:c,anchorOffset:l,focusNode:r,focusOffset:i}))&&(r=c,i=l))}}catch(e){a.e(e)}finally{a.f()}return{startNode:t,startOffset:n,endNode:r,endOffset:i}}},{key:`resolveOptions`,value:function(e){return Object.assign({selectColor:`#0589f340`,tableMenuOptions:{}},e)}},{key:`helpLinesInitial`,value:function(){this.cellSelectWrap.style.setProperty(`--select-color`,this.options.selectColor);var e=document.createElement(`div`);return e.classList.add(this.bem.be(`line`)),this.cellSelectWrap.appendChild(e),e}},{key:`computeSelectedTds`,value:function(e,n){if(!this.table)return[];var r=t.default.find(this.table);if(!r)return[];var i=r.descendants(Y)[0];if(!i)return[];var a=new Set(i.descendants(X).map(function(e,t){return e.index=t,e})),o=this.getScrollPositionDiff(),s=Dr(r),c=s.rect;if(!c)return[];for(var l=e.x+o.x,u=e.y+o.y,d={x:Math.max(c.left,Math.min(n.x,l)),y:Math.max(c.top,Math.min(n.y,u)),x1:Math.min(c.right,Math.max(n.x,l)),y1:Math.min(c.bottom,Math.max(n.y,u))},f=new Set,p=!0;p;){p=!1;var m=x(a),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;g.__rect||(g.__rect=g.domNode.getBoundingClientRect());var _=g.__rect,v=_.x,y=_.y,b=_.right,S=_.bottom;if(Vn({x:Math.floor(d.x),y:Math.floor(d.y),x1:Math.floor(d.x1),y1:Math.floor(d.y1)},{x:Math.floor(v),y:Math.floor(y),x1:Math.floor(b),y1:Math.floor(S)},fi,f.size===0)){f.add(g),a.delete(g),d={x:Math.min(d.x,v),y:Math.min(d.y,y),x1:Math.max(d.x1,b),y1:Math.max(d.y1,S)},p=!0;break}}}catch(e){m.e(e)}finally{m.f()}}for(var C=0,w=[].concat(L(f),L(a));C<w.length;C++){var T=w[C];delete T.__rect}return this.boundary=Hn(M(M({},d),{},{width:d.x1-d.x,height:d.y1-d.y}),this.quill.root),Array.from(f).sort(function(e,t){return e.index-t.index}).map(function(e){return delete e.index,e.getCellInner()})}},{key:`getScrollPositionDiff`,value:function(){var e=this,t=this.getTableViewScroll(),n=t.x,r=t.y,i=Jn(this.quill.root),a=i.x,o=i.y;return this.selectedTableScrollX=n,this.selectedTableScrollY=r,this.selectedEditorScrollX=a,this.selectedEditorScrollY=o,this.startScrollRecordPosition.reduce(function(t,n,r){var i=n.x,a=n.y,o=Jn(e.scrollRecordEls[r]),s=o.x,c=o.y;return t.x+=i-s,t.y+=a-c,t},{x:0,y:0})}},{key:`recordScrollPosition`,value:function(){this.clearRecordScrollPosition();var e=x(this.scrollRecordEls),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.startScrollRecordPosition.push(Jn(n))}}catch(t){e.e(t)}finally{e.f()}}},{key:`clearRecordScrollPosition`,value:function(){this.startScrollRecordPosition=[]}},{key:`updateWithSelectedTds`,value:function(){if(!(this.selectedTds.length<=0)){var e={x:1/0,y:1/0},t={x:-1/0,y:-1/0},n=x(this.selectedTds),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.domNode.getBoundingClientRect();e.x=Math.min(e.x,a.left),e.y=Math.min(e.y,a.top),t.x=Math.max(t.x,a.right),t.y=Math.max(t.y,a.bottom)}}catch(e){n.e(e)}finally{n.f()}this.selectedTds=this.computeSelectedTds(e,t),this.selectedTds.length>0?this.update():this.hide()}}},{key:`update`,value:function(){if(!(this.selectedTds.length===0||!this.boundary||!this.table)){var e=Jn(this.quill.root),t=e.x,n=e.y,r=this.getTableViewScroll(),i=r.x,a=r.y,o=this.table.parentElement.getBoundingClientRect(),s=this.quill.root.getBoundingClientRect(),c=o.x-s.x,l=o.y-s.y;Object.assign(this.cellSelect.style,{left:`${this.selectedEditorScrollX*2-t+this.boundary.x+this.selectedTableScrollX-i-c}px`,top:`${this.selectedEditorScrollY*2-n+this.boundary.y+this.selectedTableScrollY-a-l}px`,width:`${this.boundary.width}px`,height:`${this.boundary.height}px`}),Object.assign(this.cellSelectWrap.style,{left:`${c}px`,top:`${l}px`,width:`${o.width}px`,height:`${o.height}px`}),!this.dragging&&this.tableMenu&&this.tableMenu.update()}}},{key:`getTableViewScroll`,value:function(){return this.table?Jn(this.table.parentElement):{x:0,y:0}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.table=e,this.table?this.scrollRecordEls.push(this.table.parentElement):this.scrollRecordEls.pop())}},{key:`showDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`block`}),this.isDisplaySelection=!0,this.table&&this.resizeObserver.observe(this.table)}},{key:`show`,value:function(){var e=this;this.table&&(qn.call(this),this.update(),this.showDisplay(),document.addEventListener(`keydown`,this.removeCell),Kn.call(this,this.quill.root,function(){e.update()}),Kn.call(this,this.table.parentElement,function(){e.update()}))}},{key:`hideDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`none`}),this.isDisplaySelection=!1,this.table&&this.resizeObserver.unobserve(this.table)}},{key:`hide`,value:function(){qn.call(this),document.removeEventListener(`keydown`,this.removeCell),this.hideDisplay(),this.boundary=null,this.selectedTds=[],this.setSelectionTable(void 0),this.tableMenu&&this.tableMenu.hide()}},{key:`destroy`,value:function(){this.resizeObserver.disconnect(),this.hide(),this.cellSelectWrap.remove(),this.tableMenu&&this.tableMenu.destroy(),qn.call(this),this.quill.root.removeEventListener(`mousedown`,this.mouseDownHandler),document.removeEventListener(`selectionchange`,this.selectionChangeHandler),this.quill.off(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.quill.on(ce.AFTER_TABLE_RESIZE,this.updateAfterEvent)}}])}(),mi=[`attributes`],hi=[`style`],gi=t.default.import(`parchment`),_i=t.default.import(`delta`),vi=t.default.import(`ui/icons`),yi=t.default.import(`blots/break`),bi=t.default.import(`blots/block`),xi=t.default.import(`blots/block/embed`);function Si(e,t){var n=t.tableId,r=t.rowId,i=t.colId,a={tableId:n,rowId:r,colId:i,colspan:1,rowspan:1},o=e.create(z.tableCell,a),s=e.create(z.tableCellInner,a),c=e.create(`block`);return c.appendChild(e.create(`break`)),s.appendChild(c),o.appendChild(s),o}function Ci(e){fe.delete(z.tableCellInner),Object.assign(z,e.blotName||{}),Object.assign(B,e.tableUpSize||{}),Object.assign(ce,e.tableUpEvent||{}),Object.assign(le,e.tableUpInternal||{}),Ei.moduleName=le.moduleName,Ei.toolName=z.tableWrapper,K.blotName=z.container,Er.blotName=z.tableWrapper,Z.blotName=z.tableMain,wr.blotName=z.tableColgroup,Cr.blotName=z.tableCol,Y.blotName=z.tableBody,J.blotName=z.tableRow,X.blotName=z.tableCell,q.blotName=z.tableCellInner,fe.add(z.tableCellInner)}function wi(e,t){return Ve({onSelect:function(n,r){e.insertTable(n,r),t&&t.close()},customBtn:e.options.customBtn,texts:e.options.texts})}function Ti(e){return{bindInHead:!1,key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[z.tableCellInner],handler:function(n,r){var i=e?`prev`:`next`,a=e?`tail`:`head`;if(r.line[i])return!0;var o=this.quill.selection.getBounds(n.index),s=r.line.domNode.getBoundingClientRect();if(!o||!s)return!0;if(e){if(o.top-s.top>3)return!0}else if(s.bottom-o.bottom>3)return!0;var c,l,u,d;try{var f=he(r.line,[z.tableWrapper,z.tableMain,z.tableRow,z.tableCell]),p=F(f,4);c=p[0],l=p[1],u=p[2],d=p[3]}catch(e){return!0}var m=l.getColIds(),h=c.descendants(xr,0)[0],g;if(h){var _=window.getComputedStyle(h.domNode);g=i===`next`&&_.captionSide===`bottom`?h:i===`next`?c.next:h}else g=c[i];if(r.line[i]||!g)return!0;var v=u[i];if(v){var y=m.indexOf(d.colId),b=v.getCellByColId(m[y],i);if(!b)return!0;var x=b.children[a];x.children&&(x=x.children[a]);var S=x.offset(this.quill.scroll)+Math.min(r.offset,x.length()-1);this.quill.setSelection(S,0,t.default.sources.USER)}else{var C=g.offset(this.quill.scroll)+(e?g.length()-1:0);this.quill.setSelection(C,0,t.default.sources.USER)}return!1}}}var Ei=function(){function e(n,r){var i=this;if(v(this,e),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`toolBox`,void 0),S(this,`fixTableByLisenter`,$n(this.balanceTables,100)),S(this,`selector`,void 0),S(this,`table`,void 0),S(this,`tableSelection`,void 0),S(this,`tableResize`,void 0),S(this,`tableScrollbar`,void 0),S(this,`tableAlign`,void 0),S(this,`tableResizeScale`,void 0),S(this,`resizeOb`,void 0),this.quill=n,this.options=this.resolveOptions(r||{}),this.toolBox=this.initialContainer(),!this.options.scrollbar){var a=V(`scrollbar`);this.quill.container.classList.add(a.bm(`origin`))}this.options.selection&&(this.tableSelection=new this.options.selection(this,this.quill,this.options.selectionOptions));var o=this.quill.getModule(`toolbar`);if(o&&this.quill.theme.pickers){var s=(o.controls||[]).find(function(e){var t=F(e,1),n=t[0];return n===i.statics.toolName})||[],c=F(s,2),l=c[1];if(l&&l.tagName.toLocaleLowerCase()===`select`){var u=this.quill.theme.pickers.find(function(e){return e.select===l});u&&(u.label.innerHTML=this.options.icon,this.buildCustomSelect(this.options.customSelect,u),u.label.addEventListener(`mousedown`,function(){if(!(!i.selector||!u)){var e=i.selector.getBoundingClientRect(),t=Wn(e),n=t.leftLimited;if(n){var r=u.label.getBoundingClientRect();Object.assign(u.options.style,{transform:`translateX(calc(-100% + ${r.width}px))`})}else Object.assign(u.options.style,{transform:void 0})}}))}}for(var d=this.quill.getModule(`keyboard`),f=0,p=Object.values(e.keyboradHandler);f<p.length;f++){var m=p[f];m.bindInHead?d.bindings[m.key].unshift(m):d.addBinding(m.key,m)}this.quill.root.addEventListener(`click`,function(e){var t=e.composedPath();if(!(!t||t.length<=0)){var n=t.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`)});if(n){if(i.table===n){i.tableSelection&&i.tableSelection.show(),i.tableAlign&&i.tableAlign.update(),i.tableResize&&i.tableResize.update(),i.tableScrollbar&&i.tableScrollbar.update();return}i.table&&i.hideTableTools(),i.showTableTools(n)}else i.table&&i.hideTableTools()}},!1),this.quill.on(t.default.events.EDITOR_CHANGE,function(e){e===t.default.events.TEXT_CHANGE&&(!i.table||!i.quill.root.contains(i.table))&&i.hideTableTools()}),this.quillHack(),this.listenBalanceCells()}return b(e,[{key:`statics`,get:function(){return this.constructor}},{key:`initialContainer`,value:function(){var e=this,t=V(`toolbox`),n=this.quill.addContainer(t.b()),r=function(){var t=e.quill.root.getBoundingClientRect(),r=e.quill.root,i=r.offsetLeft,a=r.offsetTop;Object.assign(n.style,{top:`${a}px`,left:`${i}px`,width:`${t.width}px`,height:`${t.height}px`})};return this.resizeOb=new ResizeObserver(r),this.resizeOb.observe(this.quill.root),n}},{key:`addContainer`,value:function(e){if(Ae(e)){var t=document.createElement(`div`),n=x(e.split(` `)),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t.classList.add(i)}}catch(e){n.e(e)}finally{n.f()}return this.toolBox.appendChild(t),t}else return this.toolBox.appendChild(e),e}},{key:`resolveOptions`,value:function(e){return Object.assign({customBtn:!1,texts:this.resolveTexts(e.texts||{}),full:!1,fullSwitch:!0,icon:vi.table,selectionOptions:{},alignOptions:{},scrollbarOptions:{},resizeOptions:{},resizeScaleOptions:{},autoMergeCell:!0},e)}},{key:`resolveTexts`,value:function(e){return Object.assign({fullCheckboxText:`Insert full width table`,customBtnText:`Custom`,confirmText:`Confirm`,cancelText:`Cancel`,rowText:`Row`,colText:`Column`,notPositiveNumberError:`Please enter a positive integer`,custom:`Custom`,clear:`Clear`,transparent:`Transparent`,perWidthInsufficient:`The percentage width is insufficient. To complete the operation, the table needs to be converted to a fixed width. Do you want to continue?`,CopyCell:`Copy cell`,CutCell:`Cut cell`,InsertTop:`Insert row above`,InsertRight:`Insert column right`,InsertBottom:`Insert row below`,InsertLeft:`Insert column Left`,MergeCell:`Merge Cell`,SplitCell:`Split Cell`,DeleteRow:`Delete Row`,DeleteColumn:`Delete Column`,DeleteTable:`Delete table`,BackgroundColor:`Set background color`,BorderColor:`Set border color`},e)}},{key:`quillHack`,value:function(){var e=this,n=this.quill.getSemanticHTML;this.quill.getSemanticHTML=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1?arguments[1]:void 0,a=n.call(e.quill,r,i),o=t.default.import(`formats/${z.tableWrapper}`),s=new DOMParser,c=s.parseFromString(a,`text/html`),l=0,u=Array.from(c.querySelectorAll(`.${o.className} caption[contenteditable], .${o.className} td > [contenteditable]`));l<u.length;l++){var d=u[l];d.removeAttribute(`contenteditable`)}return c.body.innerHTML};var r=this.quill.format;this.quill.format=function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.default.sources.API,a=this.scroll.query(e);if(!(a.prototype instanceof gi.EmbedBlot)){var o=this.getModule(le.moduleName),s=this.getSelection(!0),c=this.getFormat(s);if(!c[z.tableCellInner]||s.length>0||o&&o.tableSelection&&o.tableSelection.selectedTds.length<=1)return r.call(this,e,n,i);if(o&&o.tableSelection&&o.tableSelection.selectedTds.length>0){var l=o.tableSelection.selectedTds,u=!1,d=[],f=x(l),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.offset(this.scroll),g=m.length();d.push({index:h,length:g});var _=this.getFormat(h,g);_[e]!==n&&(u=!0)}}catch(e){f.e(e)}finally{f.f()}var v=u?n:!1,y=new _i,b=x(d.entries()),C;try{for(b.s();!(C=b.n()).done;){var w=F(C.value,2),T=w[0],E=w[1],D=E.index,O=E.length,k=T===0?0:d[T-1].index+d[T-1].length;y.retain(D-k).retain(O,S({},e,v))}}catch(e){b.e(e)}finally{b.f()}var A=this.updateContents(y,i);return this.blur(),A}}return r.call(this,e,n,i)};var i=this.quill.theme.modules.toolbar;if(i){var a,o=(a=i.handlers)==null?void 0:a.clean;if(o){var s=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return``},i=e.quill.getText(t,n),a=e.quill.getLine(t+n),o=F(a,2),s=o[0],c=o[1],l=0,u=new _i;s!=null&&(l=s.length()-c,u=s.delta().slice(c,c+l-1).insert(`
127
+ </div>`}}catch(e){m.e(e)}finally{m.f()}var y=document.createElement(`div`);y.classList.add(this.bem.be(`row`));var b=document.createElement(`div`);b.classList.add(this.bem.be(`row-wrapper`)),Object.assign(y.style,{transform:`translateX(-${this.size}px)`,width:`${this.size}px`,maxHeight:`${i.height}px`}),Object.assign(b.style,{height:`${n.height}px`}),b.innerHTML=p,y.appendChild(b),this.root.appendChild(y),y.scrollTop=this.tableWrapper.domNode.scrollTop,this.rowHeadWrapper=y,this.bindRowEvents()}this.update(),Kn.call(this,this.quill.root,function(){e.update()})}}},{key:`hide`,value:function(){this.root.classList.add(this.bem.is(`hidden`))}},{key:`destroy`,value:function(){this.hide(),qn.call(this),this.resizeObserver.disconnect(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);var e=x(this.scrollHandler),n;try{for(e.s();!(n=e.n()).done;){var r=F(n.value,2),i=r[0],a=r[1];i.removeEventListener(`scroll`,a)}}catch(t){e.e(t)}finally{e.f()}this.root.remove()}}])}(oi),ci=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,i]),S(a,`tableModule`,void 0),S(a,`table`,void 0),S(a,`colResizer`,void 0),S(a,`rowResizer`,void 0),S(a,`currentTableCell`,void 0),S(a,`dragging`,!1),S(a,`curColIndex`,-1),S(a,`curRowIndex`,-1),S(a,`tableCellBlot`,void 0),S(a,`bem`,V(`resize-line`)),S(a,`mousemoveHandler`,function(e){if(!a.dragging&&!(a.tableModule.tableSelection&&a.tableModule.tableSelection.dragging)){var n=a.findTableCell(e);if(!n)return a.hide();var r=t.default.find(n);r&&a.currentTableCell!==n&&(a.show(),a.currentTableCell=n,a.tableCellBlot=r,a.tableMain=H(r,z.tableMain),a.tableMain.getCols().length>0&&a.updateColResizer(),a.updateRowResizer())}}),S(a,`hideWhenTextChange`,function(){a.hide()}),S(a,`handleColMouseUpFunc`,g(P().mark(function e(){return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.handleColMouseUp();case 2:this.updateColResizer();case 3:case`end`:return e.stop()}},e,this)})).bind(a)),S(a,`handleRowMouseUpFunc`,function(){this.handleRowMouseUp(),this.updateRowResizer()}.bind(a)),a.tableModule=e,a.table=r,a.colResizer=a.tableModule.addContainer(a.bem.be(`col`)),a.rowResizer=a.tableModule.addContainer(a.bem.be(`row`)),a.table.addEventListener(`mousemove`,a.mousemoveHandler),a.quill.on(t.default.events.TEXT_CHANGE,a.hideWhenTextChange),a}return T(n,e),b(n,[{key:`findTableCell`,value:function(e){var t=x(e.composedPath()),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;if(r instanceof HTMLElement&&r.tagName===`TD`)return r;if(r===document.body)return null}}catch(e){t.e(e)}finally{t.f()}return null}},{key:`findCurrentColIndex`,value:function(){var e;return this.curColIndex+(((e=this.tableCellBlot)==null?void 0:e.colspan)||1)-1}},{key:`updateColResizer`,value:function(){if(!(!this.tableMain||!this.tableCellBlot)){var e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.colResizer),this.colResizer=this.tableModule.addContainer(this.bem.be(`col`));var t=he(e,[z.tableBody]),n=F(t,1),r=n[0],i=r.domNode.getBoundingClientRect(),a=e.domNode.getBoundingClientRect(),o=this.quill.root.getBoundingClientRect(),s=a.right-o.x;ai(this.tableMain)&&(s=a.left-o.x),Object.assign(this.colResizer.style,{top:`${i.y-o.y}px`,left:`${s}px`,height:`${i.height}px`});var c=this.tableMain.getCols();this.curColIndex=c.findIndex(function(t){return t.colId===e.colId}),this.colResizer.addEventListener(`mousedown`,this.handleColMouseDownFunc),this.colResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}},{key:`findCurrentRowIndex`,value:function(){return this.curRowIndex}},{key:`updateRowResizer`,value:function(){if(!(!this.tableMain||!this.tableCellBlot)){var e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.rowResizer),this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`));var t=e.parent;if(t instanceof J){var n=he(e,[z.tableBody]),r=F(n,1),i=r[0],a=i.domNode.getBoundingClientRect(),o=e.domNode.getBoundingClientRect(),s=this.quill.root.getBoundingClientRect();Object.assign(this.rowResizer.style,{top:`${o.bottom-s.y}px`,left:`${a.x-s.x}px`,width:`${a.width}px`});var c=this.tableMain.getRows();this.curRowIndex=c.indexOf(t),this.rowResizer.addEventListener(`mousedown`,this.handleRowMouseDownFunc),this.rowResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}}},{key:`show`,value:function(){this.rowResizer.classList.remove(this.bem.is(`hidden`)),this.colResizer.classList.remove(this.bem.is(`hidden`))}},{key:`hide`,value:function(){this.currentTableCell=void 0,this.rowResizer.classList.add(this.bem.is(`hidden`)),this.colResizer.classList.add(this.bem.is(`hidden`))}},{key:`update`,value:function(){this.updateColResizer(),this.updateRowResizer()}},{key:`destroy`,value:function(){this.colResizer.remove(),this.rowResizer.remove(),this.table.removeEventListener(`mousemove`,this.mousemoveHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.hideWhenTextChange)}}])}(oi),li=function(){function e(n,r,i,a){var o=this;v(this,e),S(this,`tableModule`,void 0),S(this,`table`,void 0),S(this,`quill`,void 0),S(this,`scrollHandler`,[]),S(this,`tableMainBlot`,null),S(this,`tableWrapperBlot`,null),S(this,`bem`,V(`scale`)),S(this,`startX`,0),S(this,`startY`,0),S(this,`offset`,6),S(this,`options`,void 0),S(this,`root`,void 0),S(this,`block`,void 0),S(this,`resizeobserver`,new ResizeObserver(function(){return o.update()})),S(this,`updateWhenTextChange`,function(){o.update()}),this.tableModule=n,this.table=r,this.quill=i,this.options=this.resolveOptions(a),this.tableMainBlot=t.default.find(r),this.tableMainBlot&&!this.tableMainBlot.full&&(this.tableWrapperBlot=this.tableMainBlot.parent,this.buildResizer(),this.show()),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`resolveOptions`,value:function(e){return Object.assign({blockSize:12},e)}},{key:`buildResizer`,value:function(){var e=this;if(!(!this.tableMainBlot||!this.tableWrapperBlot)){this.root=this.tableModule.addContainer(this.bem.b()),this.root.classList.add(this.bem.is(`hidden`)),this.block=document.createElement(`div`),this.block.classList.add(this.bem.be(`block`)),Object.assign(this.block.style,{width:`${this.options.blockSize}px`,height:`${this.options.blockSize}px`}),this.root.appendChild(this.block);var t=[],n=[],r=function(r){if(e.tableMainBlot){var i=ai(e.tableMainBlot)?-1:1,a=(r.clientX-e.startX)*i,o=r.clientY-e.startY,s=Math.floor(a/t.length),c=Math.floor(o/n.length),l=x(t),u;try{for(l.s();!(u=l.n()).done;){var d=u.value,f=d.blot,p=d.width;f.width=Math.max(p+s,B.colMinWidthPx)}}catch(e){l.e(e)}finally{l.f()}var m=x(n),h;try{for(m.s();!(h=m.n()).done;){var g=h.value,_=g.blot,v=g.height;_.setHeight(`${Math.max(v+c,B.rowMinHeightPx)}px`)}}catch(e){m.e(e)}finally{m.f()}}},i=function(){t=[],n=[],document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};this.block.addEventListener(`mousedown`,function(a){!e.tableMainBlot||e.isTableOutofEditor()||(e.startX=a.clientX,e.startY=a.clientY,t=e.tableMainBlot.getCols().map(function(e){return{blot:e,width:Math.floor(e.width)}}),n=e.tableMainBlot.getRows().map(function(e){return{blot:e,height:Math.floor(e.domNode.getBoundingClientRect().height)}}),document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i))}),this.block.addEventListener(`dragstart`,function(e){return e.preventDefault()}),this.resizeobserver.observe(this.tableMainBlot.domNode),Kn.call(this,this.quill.root,function(){return e.update()}),Kn.call(this,this.tableWrapperBlot.domNode,function(){return e.update()})}}},{key:`isTableOutofEditor`,value:function(){if(!this.tableMainBlot||!this.tableWrapperBlot||this.tableMainBlot.full)return!1;var e=this.tableMainBlot.domNode.getBoundingClientRect(),t=this.tableWrapperBlot.domNode.getBoundingClientRect();if(e.width>t.width){var n=x(this.tableMainBlot.getCols()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.width=Math.floor(i.width/e.width*t.width)}}catch(e){n.e(e)}finally{n.f()}return this.tableMainBlot.colWidthFillTable(),!0}return!1}},{key:`update`,value:function(){if(!(!this.block||!this.root||!this.tableMainBlot||!this.tableWrapperBlot)){if(this.tableMainBlot.full){this.hide();return}var e=Dr(this.tableMainBlot),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.tableWrapperBlot.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect(),a=this.tableWrapperBlot.domNode,o=a.scrollTop,s=a.scrollLeft,c=this.options.blockSize*2+this.offset,l=Math.min(t.width,r.width)+c,u=Math.min(t.height,r.height)+c;Object.assign(this.root.style,{width:`${l}px`,height:`${u}px`,left:`${Math.max(t.x,r.x)-i.x-this.options.blockSize}px`,top:`${Math.max(t.y,r.y)-i.y-this.options.blockSize}px`});var d={left:`${t.width+c-s}px`,top:`${u-o}px`};ai(this.tableMainBlot)?(this.root.classList.add(this.bem.is(`align-right`)),d.left=`${this.options.blockSize+-1*s}px`):this.root.classList.remove(this.bem.is(`align-right`)),Object.assign(this.block.style,d)}}}},{key:`show`,value:function(){this.root&&(this.root.classList.remove(this.bem.is(`hidden`)),this.update())}},{key:`hide`,value:function(){this.root&&this.root.classList.add(this.bem.is(`hidden`))}},{key:`destroy`,value:function(){this.hide(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.resizeobserver.disconnect(),this.root&&this.root.remove(),qn.call(this)}}])}(),ui=function(){function e(n,r,i,a){var o=this;v(this,e),S(this,`quill`,void 0),S(this,`isVertical`,void 0),S(this,`table`,void 0),S(this,`scrollbarContainer`,void 0),S(this,`minSize`,20),S(this,`gap`,4),S(this,`move`,0),S(this,`cursorDown`,!1),S(this,`cursorLeave`,!1),S(this,`ratioY`,1),S(this,`ratioX`,1),S(this,`sizeWidth`,``),S(this,`sizeHeight`,``),S(this,`size`,``),S(this,`thumbState`,{X:0,Y:0}),S(this,`ob`,void 0),S(this,`container`,void 0),S(this,`scrollbar`,void 0),S(this,`thumb`,document.createElement(`div`)),S(this,`scrollHandler`,[]),S(this,`propertyMap`,void 0),S(this,`bem`,V(`scrollbar`)),S(this,`tableMainBlot`,void 0),S(this,`showScrollbar`,$n(function(){o.cursorLeave=!1,o.scrollbar.removeEventListener(`transitionend`,o.hideScrollbarTransitionend),o.scrollbar.style.display=o.size?`block`:`none`,requestAnimationFrame(function(){o.scrollbar.classList.remove(o.bem.is(`transparent`))})},200)),S(this,`hideScrollbar`,$n(function(){o.cursorLeave=!0,!o.cursorDown&&(o.scrollbar.removeEventListener(`transitionend`,o.hideScrollbarTransitionend),o.scrollbar.addEventListener(`transitionend`,o.hideScrollbarTransitionend,{once:!0}),o.scrollbar.classList.add(o.bem.is(`transparent`)))},200)),S(this,`hideScrollbarTransitionend`,function(){o.scrollbar.style.display=o.cursorDown&&o.size?`block`:`none`}),this.quill=n,this.isVertical=r,this.table=i,this.scrollbarContainer=a,this.tableMainBlot=t.default.find(this.table),this.container=i.parentElement,this.propertyMap=this.isVertical?{size:`height`,offset:`offsetHeight`,scrollDirection:`scrollTop`,scrollSize:`scrollHeight`,axis:`Y`,direction:`top`,client:`clientY`}:{size:`width`,offset:`offsetWidth`,scrollDirection:`scrollLeft`,scrollSize:`scrollWidth`,axis:`X`,direction:`left`,client:`clientX`},this.calculateSize(),this.ob=new ResizeObserver(function(){o.update()}),this.ob.observe(i),this.scrollbar=this.createScrollbar(),this.setScrollbarPosition(),Kn.call(this,this.quill.root,function(){return o.setScrollbarPosition()}),this.showScrollbar()}return b(e,[{key:`update`,value:function(){this.calculateSize(),this.setScrollbarPosition()}},{key:`setScrollbarPosition`,value:function(){var e=Dr(this.tableMainBlot),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.quill.root,i=r.scrollLeft,a=r.scrollTop,o=r.offsetLeft,s=r.offsetTop,c=this.container,l=c.offsetLeft,u=c.offsetTop,d=n.domNode,f=d.offsetLeft,p=d.offsetTop,m=this.container.getBoundingClientRect(),h=m.width,g=m.height,_=l+f-o,v=u+p-s;this.isVertical?_+=Math.min(h,t.width):v+=Math.min(g,t.height),this.tableMainBlot&&this.tableMainBlot.align!==`left`&&(_+=this.table.offsetLeft-l),Object.assign(this.scrollbar.style,S(S({},this.propertyMap.size,`${this.isVertical?Math.min(g,t.height):h}px`),`transform`,`translate(${_-i}px, ${v-a}px)`)),this.containerScrollHandler(this.container)}}},{key:`calculateSize`,value:function(){var e=this.container.offsetHeight-this.gap,t=this.container.offsetWidth-this.gap,n=Math.pow(e,2)/this.container.scrollHeight,r=Math.pow(t,2)/this.container.scrollWidth,i=Math.max(n,this.minSize),a=Math.max(r,this.minSize);this.ratioY=n/(e-n)/(i/(e-i)),this.ratioX=r/(t-r)/(a/(t-a)),this.sizeWidth=a+this.gap<t?`${a}px`:``,this.sizeHeight=i+this.gap<e?`${i}px`:``,this.size=this.isVertical?this.sizeHeight:this.sizeWidth}},{key:`createScrollbar`,value:function(){var e=this,t=document.createElement(`div`);t.classList.add(this.bem.b(),this.isVertical?this.bem.is(`vertical`):this.bem.is(`horizontal`),this.bem.is(`transparent`)),Object.assign(t.style,{display:`none`}),this.thumb.classList.add(this.bem.be(`thumb`));var n=null,r=function(t){if(e.cursorDown!==!1){var n=e.thumbState[e.propertyMap.axis];if(n){var r=Math.pow(e.scrollbar[e.propertyMap.offset],2)/e.container[e.propertyMap.scrollSize]/(e.isVertical?e.ratioY:e.ratioX)/e.thumb[e.propertyMap.offset],i=(e.scrollbar.getBoundingClientRect()[e.propertyMap.direction]-t[e.propertyMap.client])*-1,a=e.thumb[e.propertyMap.offset]-n,o=(i-a)*100*r/e.scrollbar[e.propertyMap.offset];e.container[e.propertyMap.scrollDirection]=o*e.container[e.propertyMap.scrollSize]/100}}},i=function(){e.thumbState[e.propertyMap.axis]=0,e.cursorDown=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),e.cursorLeave&&e.hideScrollbar(),document.onselectstart=n},a=function(t){t.stopImmediatePropagation(),e.cursorDown=!0,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i),n=document.onselectstart,document.onselectstart=function(){return!1}};this.thumb.addEventListener(`mousedown`,function(t){var n;if(t.stopPropagation(),!(t.ctrlKey||[1,2].includes(t.button))){(n=window.getSelection())==null||n.removeAllRanges(),a(t);var r=t.currentTarget;r&&(e.thumbState[e.propertyMap.axis]=r[e.propertyMap.offset]-(t[e.propertyMap.client]-r.getBoundingClientRect()[e.propertyMap.direction]))}});for(var o=[this.table,t],s=0,c=o;s<c.length;s++){var l=c[s];l.addEventListener(`mouseenter`,this.showScrollbar),l.addEventListener(`mouseleave`,this.hideScrollbar)}return Kn.call(this,this.container,function(){e.containerScrollHandler(e.container)}),t.appendChild(this.thumb),t}},{key:`containerScrollHandler`,value:function(e){var t=e[this.propertyMap.offset]-this.gap;this.move=e[this.propertyMap.scrollDirection]*100/t*(this.isVertical?this.ratioY:this.ratioX),Object.assign(this.thumb.style,S(S({},this.propertyMap.size,this.size),`transform`,`translate${this.propertyMap.axis}(${this.move}%)`))}},{key:`destroy`,value:function(){this.ob.disconnect(),qn.call(this),this.table.removeEventListener(`mouseenter`,this.showScrollbar),this.table.removeEventListener(`mouseleave`,this.hideScrollbar)}}])}(),di=function(){function e(n,r,i){var a=this;v(this,e),S(this,`tableModule`,void 0),S(this,`table`,void 0),S(this,`quill`,void 0),S(this,`scrollbarContainer`,void 0),S(this,`scrollbar`,void 0),S(this,`bem`,V(`scrollbar`)),S(this,`updateWhenTextChange`,function(){a.update()}),this.tableModule=n,this.table=r,this.quill=i,this.scrollbarContainer=this.tableModule.addContainer(this.bem.be(`container`)),this.scrollbar=[new ui(i,!0,r,this.scrollbarContainer),new ui(i,!1,r,this.scrollbarContainer)];var o=x(this.scrollbar),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;this.scrollbarContainer.appendChild(c.scrollbar)}}catch(e){o.e(e)}finally{o.f()}this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`hide`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.hideScrollbar()}}catch(t){e.e(t)}finally{e.f()}}},{key:`show`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.showScrollbar()}}catch(t){e.e(t)}finally{e.f()}}},{key:`update`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.calculateSize(),n.setScrollbarPosition()}}catch(t){e.e(t)}finally{e.f()}}},{key:`destroy`,value:function(){this.scrollbarContainer.remove(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);var e=x(this.scrollbar),n;try{for(e.s();!(n=e.n()).done;){var r=n.value;r.destroy()}}catch(t){e.e(t)}finally{e.f()}}}])}(),fi=0,pi=function(){function e(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`boundary`,null),S(this,`scrollRecordEls`,[]),S(this,`startScrollRecordPosition`,[]),S(this,`selectedTableScrollX`,0),S(this,`selectedTableScrollY`,0),S(this,`selectedEditorScrollX`,0),S(this,`selectedEditorScrollY`,0),S(this,`selectedTds`,[]),S(this,`cellSelectWrap`,void 0),S(this,`cellSelect`,void 0),S(this,`dragging`,!1),S(this,`scrollHandler`,[]),S(this,`tableMenu`,void 0),S(this,`resizeObserver`,void 0),S(this,`table`,void 0),S(this,`isDisplaySelection`,!1),S(this,`bem`,V(`selection`)),S(this,`lastSelection`,{anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0}),S(this,`updateAfterEvent`,function(){i.updateWithSelectedTds()}),S(this,`quillSelectionChangeHandler`,function(e,n,r){if(r!==t.default.sources.API&&e&&!i.quill.composition.isComposing&&i.selectedTds.length>0){var a=i.quill.getFormat(e),o=i.quill.getLine(e.index),s=F(o,1),c=s[0],l=!!a[z.tableCellInner]&&!!c,u=i.selectedTds.some(function(e){return e.children.contains(c)});if(l&&!u)try{var d=H(c,z.tableCellInner);i.selectedTds=[d],i.updateWithSelectedTds()}catch(e){}else l&&u||i.hide()}}),S(this,`selectionChangeHandler`,function(){var e=window.getSelection();if(e){var n=e.anchorNode,r=e.focusNode,a=e.anchorOffset,o=e.focusOffset;if(!(!n||!r)){var s=t.default.find(n),c=t.default.find(r);if(!(!s||!c||s.scroll!==i.quill.scroll||c.scroll!==i.quill.scroll)){var l=ge(s),u=ge(c),d=l.has(z.tableColgroup),f=u.has(z.tableColgroup);if(d||f){var p=n,m=a,h=r,g=o;if(d){var _=l.get(z.tableWrapper),v=_.descendants(q);v.length>0&&(p=v[0].domNode,m=0)}if(f){var y=u.get(z.tableWrapper),b=y.descendants(q);b.length>0&&(h=b[0].domNode,g=0)}i.setSelectionData(e,{anchorNode:p,anchorOffset:m,focusNode:h,focusOffset:g});return}var x=l.has(z.tableCellInner),S=u.has(z.tableCellInner),C=x&&S;if(C){var w=l.get(z.tableCellInner),T=u.get(z.tableCellInner);C&&(C=w!==T)}if(x&&S&&C||!x&&S||!S&&x){i.setSelectionData(e,i.lastSelection),i.selectedTds.length>0&&i.hide();return}i.lastSelection={anchorNode:n,anchorOffset:a,focusNode:r,focusOffset:o}}}}}),S(this,`mouseDownHandler`,function(e){var t=e.button,n=e.target,r=e.clientX,a=e.clientY,o=n.closest(`.ql-table`),s=n.closest(`caption`);if(!(t!==0||!o||s)){i.setSelectionTable(o);var c=o.dataset.tableId,l={x:r,y:a};i.recordScrollPosition(),i.selectedTds=i.computeSelectedTds(l,l),i.dragging=!0,i.show();var u=function(e){i.tableMenu&&i.tableMenu.hide(),i.tableModule.tableResize&&i.tableModule.tableResize.hide();var t=e.button,n=e.target,r=e.clientX,a=e.clientY,o=n.closest(`.ql-table`),s=n.closest(`caption`);if(!(t!==0||s||!o||o.dataset.tableId!==c)){var u={x:r,y:a};i.selectedTds=i.computeSelectedTds(l,u),i.selectedTds.length>1&&i.quill.blur(),i.update()}},d=function(){document.body.removeEventListener(`mousemove`,u,!1),document.body.removeEventListener(`mouseup`,d,!1),i.dragging=!1,i.clearRecordScrollPosition(),i.tableMenu&&i.selectedTds.length>0&&i.tableMenu.show()};document.body.addEventListener(`mousemove`,u,!1),document.body.addEventListener(`mouseup`,d,!1)}}),S(this,`removeCell`,function(e){var n=i.quill.getSelection();if(!(n||e.key!==`Backspace`&&e.key!==`Delete`)){var r=x(i.selectedTds),a;try{for(r.s();!(a=r.n()).done;){var o=a.value;o.deleteAt(0,o.length()-1)}}catch(e){r.e(e)}finally{r.f()}if(i.table){var s=t.default.find(i.table),c=s.descendants(q);i.selectedTds.length===c.length&&s.remove()}}}),this.tableModule=n,this.quill=r,this.options=this.resolveOptions(a),this.scrollRecordEls=[this.quill.root,document.documentElement],this.cellSelectWrap=n.addContainer(this.bem.b()),this.cellSelect=this.helpLinesInitial(),this.resizeObserver=Gn(function(){return i.updateAfterEvent()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.quill.root),this.quill.root.addEventListener(`mousedown`,this.mouseDownHandler,{passive:!1}),document.addEventListener(`selectionchange`,this.selectionChangeHandler,{passive:!1}),this.quill.on(ce.AFTER_TABLE_RESIZE,this.updateAfterEvent),this.quill.on(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.on(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.options.tableMenu&&(this.tableMenu=new this.options.tableMenu(n,r,this.options.tableMenuOptions)),this.hide()}return b(e,[{key:`getFirstTextNode`,value:function(e){for(var t=0,n=Array.from(e.childNodes);t<n.length;t++){var r=n[t];if(r.nodeType===Node.TEXT_NODE)return r}return e}},{key:`getLastTextNode`,value:function(e){for(var t=e.childNodes.length-1;t>=0;t--){var n=e.childNodes[t];if(n.nodeType===Node.TEXT_NODE)return n}return e}},{key:`getNodeTailOffset`,value:function(e){var t=document.createRange();return t.selectNodeContents(e),t.collapse(!1),t.startOffset}},{key:`setSelectionData`,value:function(e,t){var n=t.anchorNode,r=t.anchorOffset,i=t.focusNode,a=t.focusOffset;if(!(!n||!i)){var o=document.createRange(),s=this.selectionDirectionUp(t);s?(o.setStart(n,r),o.setEnd(n,r)):(o.setStart(n,r),o.setEnd(i,a)),e.removeAllRanges(),e.addRange(o),s&&e.extend(i,a)}}},{key:`selectionDirectionUp`,value:function(e){var t=e.anchorNode,n=e.anchorOffset,r=e.focusNode,i=e.focusOffset;if(!t||!r)return!1;if(t===r)return n>i;var a=t.compareDocumentPosition(r);return a&Node.DOCUMENT_POSITION_CONTAINS||a&Node.DOCUMENT_POSITION_CONTAINED_BY?(a&Node.DOCUMENT_POSITION_FOLLOWING)!==0:(a&Node.DOCUMENT_POSITION_PRECEDING)!==0}},{key:`findWrapSelection`,value:function(e){var t=null,n=0,r=null,i=0,a=x(e),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=s.node,l=s.offset;c&&((!t||this.selectionDirectionUp({anchorNode:t,anchorOffset:n,focusNode:c,focusOffset:l}))&&(t=c,n=l),(!r||this.selectionDirectionUp({anchorNode:c,anchorOffset:l,focusNode:r,focusOffset:i}))&&(r=c,i=l))}}catch(e){a.e(e)}finally{a.f()}return{startNode:t,startOffset:n,endNode:r,endOffset:i}}},{key:`resolveOptions`,value:function(e){return Object.assign({selectColor:`#0589f340`,tableMenuOptions:{}},e)}},{key:`helpLinesInitial`,value:function(){this.cellSelectWrap.style.setProperty(`--select-color`,this.options.selectColor);var e=document.createElement(`div`);return e.classList.add(this.bem.be(`line`)),this.cellSelectWrap.appendChild(e),e}},{key:`computeSelectedTds`,value:function(e,n){if(!this.table)return[];var r=t.default.find(this.table);if(!r)return[];var i=r.descendants(Y)[0];if(!i)return[];var a=new Set(i.descendants(X).map(function(e,t){return e.index=t,e})),o=this.getScrollPositionDiff(),s=Dr(r),c=s.rect;if(!c)return[];for(var l=e.x+o.x,u=e.y+o.y,d={x:Math.max(c.left,Math.min(n.x,l)),y:Math.max(c.top,Math.min(n.y,u)),x1:Math.min(c.right,Math.max(n.x,l)),y1:Math.min(c.bottom,Math.max(n.y,u))},f=new Set,p=!0;p;){p=!1;var m=x(a),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;g.__rect||(g.__rect=g.domNode.getBoundingClientRect());var _=g.__rect,v=_.x,y=_.y,b=_.right,S=_.bottom;if(Vn({x:Math.floor(d.x),y:Math.floor(d.y),x1:Math.floor(d.x1),y1:Math.floor(d.y1)},{x:Math.floor(v),y:Math.floor(y),x1:Math.floor(b),y1:Math.floor(S)},fi,f.size===0)){f.add(g),a.delete(g),d={x:Math.min(d.x,v),y:Math.min(d.y,y),x1:Math.max(d.x1,b),y1:Math.max(d.y1,S)},p=!0;break}}}catch(e){m.e(e)}finally{m.f()}}for(var C=0,w=[].concat(L(f),L(a));C<w.length;C++){var T=w[C];delete T.__rect}return this.boundary=Hn(M(M({},d),{},{width:d.x1-d.x,height:d.y1-d.y}),this.quill.root),Array.from(f).sort(function(e,t){return e.index-t.index}).map(function(e){return delete e.index,e.getCellInner()})}},{key:`getScrollPositionDiff`,value:function(){var e=this,t=this.getTableViewScroll(),n=t.x,r=t.y,i=Jn(this.quill.root),a=i.x,o=i.y;return this.selectedTableScrollX=n,this.selectedTableScrollY=r,this.selectedEditorScrollX=a,this.selectedEditorScrollY=o,this.startScrollRecordPosition.reduce(function(t,n,r){var i=n.x,a=n.y,o=Jn(e.scrollRecordEls[r]),s=o.x,c=o.y;return t.x+=i-s,t.y+=a-c,t},{x:0,y:0})}},{key:`recordScrollPosition`,value:function(){this.clearRecordScrollPosition();var e=x(this.scrollRecordEls),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.startScrollRecordPosition.push(Jn(n))}}catch(t){e.e(t)}finally{e.f()}}},{key:`clearRecordScrollPosition`,value:function(){this.startScrollRecordPosition=[]}},{key:`updateWithSelectedTds`,value:function(){if(!(this.selectedTds.length<=0)){var e={x:1/0,y:1/0},t={x:-1/0,y:-1/0},n=x(this.selectedTds),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.domNode.getBoundingClientRect();e.x=Math.min(e.x,a.left),e.y=Math.min(e.y,a.top),t.x=Math.max(t.x,a.right),t.y=Math.max(t.y,a.bottom)}}catch(e){n.e(e)}finally{n.f()}this.selectedTds=this.computeSelectedTds(e,t),this.selectedTds.length>0?this.update():this.hide()}}},{key:`update`,value:function(){if(!(this.selectedTds.length===0||!this.boundary||!this.table)){var e=Jn(this.quill.root),t=e.x,n=e.y,r=this.getTableViewScroll(),i=r.x,a=r.y,o=this.table.parentElement.getBoundingClientRect(),s=this.quill.root.getBoundingClientRect(),c=o.x-s.x,l=o.y-s.y;Object.assign(this.cellSelect.style,{left:`${this.selectedEditorScrollX*2-t+this.boundary.x+this.selectedTableScrollX-i-c}px`,top:`${this.selectedEditorScrollY*2-n+this.boundary.y+this.selectedTableScrollY-a-l}px`,width:`${this.boundary.width}px`,height:`${this.boundary.height}px`}),Object.assign(this.cellSelectWrap.style,{left:`${c}px`,top:`${l}px`,width:`${o.width}px`,height:`${o.height}px`}),!this.dragging&&this.tableMenu&&this.tableMenu.update()}}},{key:`getTableViewScroll`,value:function(){return this.table?Jn(this.table.parentElement):{x:0,y:0}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.table=e,this.table?this.scrollRecordEls.push(this.table.parentElement):this.scrollRecordEls.pop())}},{key:`showDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`block`}),this.isDisplaySelection=!0,this.table&&this.resizeObserver.observe(this.table)}},{key:`show`,value:function(){var e=this;this.table&&(qn.call(this),this.update(),this.showDisplay(),document.addEventListener(`keydown`,this.removeCell),Kn.call(this,this.quill.root,function(){e.update()}),Kn.call(this,this.table.parentElement,function(){e.update()}))}},{key:`hideDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`none`}),this.isDisplaySelection=!1,this.table&&this.resizeObserver.unobserve(this.table)}},{key:`hide`,value:function(){qn.call(this),document.removeEventListener(`keydown`,this.removeCell),this.hideDisplay(),this.boundary=null,this.selectedTds=[],this.setSelectionTable(void 0),this.tableMenu&&this.tableMenu.hide()}},{key:`destroy`,value:function(){this.resizeObserver.disconnect(),this.hide(),this.cellSelectWrap.remove(),this.tableMenu&&this.tableMenu.destroy(),qn.call(this),this.quill.root.removeEventListener(`mousedown`,this.mouseDownHandler),document.removeEventListener(`selectionchange`,this.selectionChangeHandler),this.quill.off(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.quill.on(ce.AFTER_TABLE_RESIZE,this.updateAfterEvent)}}])}(),mi=[`attributes`],hi=[`style`],gi=t.default.import(`parchment`),_i=t.default.import(`delta`),vi=t.default.import(`ui/icons`),yi=t.default.import(`blots/break`),bi=t.default.import(`blots/block`),xi=t.default.import(`blots/block/embed`);function Si(e,t){var n=t.tableId,r=t.rowId,i=t.colId,a={tableId:n,rowId:r,colId:i,colspan:1,rowspan:1},o=e.create(z.tableCell,a),s=e.create(z.tableCellInner,a),c=e.create(`block`);return c.appendChild(e.create(`break`)),s.appendChild(c),o.appendChild(s),o}function Ci(e){fe.delete(z.tableCellInner),Object.assign(z,e.blotName||{}),Object.assign(B,e.tableUpSize||{}),Object.assign(ce,e.tableUpEvent||{}),Object.assign(le,e.tableUpInternal||{}),Ei.moduleName=le.moduleName,Ei.toolName=z.tableWrapper,K.blotName=z.container,Er.blotName=z.tableWrapper,Z.blotName=z.tableMain,wr.blotName=z.tableColgroup,Cr.blotName=z.tableCol,Y.blotName=z.tableBody,J.blotName=z.tableRow,X.blotName=z.tableCell,q.blotName=z.tableCellInner,fe.add(z.tableCellInner)}function wi(e,t){return Ve({onSelect:function(n,r){e.insertTable(n,r),t&&t.close()},customBtn:e.options.customBtn,texts:e.options.texts})}function Ti(e){return{bindInHead:!1,key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[z.tableCellInner],handler:function(n,r){var i=e?`prev`:`next`,a=e?`tail`:`head`;if(r.line[i])return!0;var o=this.quill.selection.getBounds(n.index),s=r.line.domNode.getBoundingClientRect();if(!o||!s)return!0;if(e){if(o.top-s.top>3)return!0}else if(s.bottom-o.bottom>3)return!0;var c,l,u,d;try{var f=he(r.line,[z.tableWrapper,z.tableMain,z.tableRow,z.tableCell]),p=F(f,4);c=p[0],l=p[1],u=p[2],d=p[3]}catch(e){return!0}var m=l.getColIds(),h=c.descendants(xr,0)[0],g;if(h){var _=window.getComputedStyle(h.domNode);g=i===`next`&&_.captionSide===`bottom`?h:i===`next`?c.next:h}else g=c[i];if(r.line[i]||!g)return!0;var v=u[i];if(v){var y=m.indexOf(d.colId),b=v.getCellByColId(m[y],i);if(!b)return!0;var x=b.children[a];x.children&&(x=x.children[a]);var S=x.offset(this.quill.scroll)+Math.min(r.offset,x.length()-1);this.quill.setSelection(S,0,t.default.sources.USER)}else{var C=g.offset(this.quill.scroll)+(e?g.length()-1:0);this.quill.setSelection(C,0,t.default.sources.USER)}return!1}}}var Ei=function(){function e(n,r){var i=this;if(v(this,e),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`toolBox`,void 0),S(this,`fixTableByLisenter`,$n(this.balanceTables,100)),S(this,`selector`,void 0),S(this,`table`,void 0),S(this,`tableSelection`,void 0),S(this,`tableResize`,void 0),S(this,`tableScrollbar`,void 0),S(this,`tableAlign`,void 0),S(this,`tableResizeScale`,void 0),S(this,`resizeOb`,void 0),this.quill=n,this.options=this.resolveOptions(r||{}),this.toolBox=this.initialContainer(),!this.options.scrollbar){var a=V(`scrollbar`);this.quill.container.classList.add(a.bm(`origin`))}this.options.selection&&(this.tableSelection=new this.options.selection(this,this.quill,this.options.selectionOptions));var o=this.quill.getModule(`toolbar`);if(o&&this.quill.theme.pickers){var s=(o.controls||[]).find(function(e){var t=F(e,1),n=t[0];return n===i.statics.toolName})||[],c=F(s,2),l=c[1];if(l&&l.tagName.toLocaleLowerCase()===`select`){var u=this.quill.theme.pickers.find(function(e){return e.select===l});u&&(u.label.innerHTML=this.options.icon,this.buildCustomSelect(this.options.customSelect,u),u.label.addEventListener(`mousedown`,function(){if(!(!i.selector||!u)){var e=i.selector.getBoundingClientRect(),t=Wn(e),n=t.leftLimited;if(n){var r=u.label.getBoundingClientRect();Object.assign(u.options.style,{transform:`translateX(calc(-100% + ${r.width}px))`})}else Object.assign(u.options.style,{transform:void 0})}}))}}for(var d=this.quill.getModule(`keyboard`),f=0,p=Object.values(e.keyboradHandler);f<p.length;f++){var m=p[f];m.bindInHead?d.bindings[m.key].unshift(m):d.addBinding(m.key,m)}this.quill.root.addEventListener(`click`,function(e){var t=e.composedPath();if(!(!t||t.length<=0)){var n=t.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`)});if(n){if(i.table===n){i.tableSelection&&i.tableSelection.show(),i.tableAlign&&i.tableAlign.update(),i.tableResize&&i.tableResize.update(),i.tableScrollbar&&i.tableScrollbar.update();return}i.table&&i.hideTableTools(),i.showTableTools(n)}else i.table&&i.hideTableTools()}},!1),this.quill.on(t.default.events.EDITOR_CHANGE,function(e){e===t.default.events.TEXT_CHANGE&&(!i.table||!i.quill.root.contains(i.table))&&i.hideTableTools()}),this.quillHack(),this.listenBalanceCells()}return b(e,[{key:`statics`,get:function(){return this.constructor}},{key:`initialContainer`,value:function(){var e=this,t=V(`toolbox`),n=this.quill.addContainer(t.b()),r=function(){var t=e.quill.root.getBoundingClientRect(),r=e.quill.root,i=r.offsetLeft,a=r.offsetTop;Object.assign(n.style,{top:`${a}px`,left:`${i}px`,width:`${t.width}px`,height:`${t.height}px`})};return this.resizeOb=new ResizeObserver(r),this.resizeOb.observe(this.quill.root),n}},{key:`addContainer`,value:function(e){if(Ae(e)){var t=document.createElement(`div`),n=x(e.split(` `)),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t.classList.add(i)}}catch(e){n.e(e)}finally{n.f()}return this.toolBox.appendChild(t),t}else return this.toolBox.appendChild(e),e}},{key:`resolveOptions`,value:function(e){return Object.assign({customBtn:!1,texts:this.resolveTexts(e.texts||{}),full:!1,fullSwitch:!0,icon:vi.table,selectionOptions:{},alignOptions:{},scrollbarOptions:{},resizeOptions:{},resizeScaleOptions:{},autoMergeCell:!0},e)}},{key:`resolveTexts`,value:function(e){return Object.assign({fullCheckboxText:`Insert full width table`,customBtnText:`Custom`,confirmText:`Confirm`,cancelText:`Cancel`,rowText:`Row`,colText:`Column`,notPositiveNumberError:`Please enter a positive integer`,custom:`Custom`,clear:`Clear`,transparent:`Transparent`,perWidthInsufficient:`The percentage width is insufficient. To complete the operation, the table needs to be converted to a fixed width. Do you want to continue?`,CopyCell:`Copy cell`,CutCell:`Cut cell`,InsertTop:`Insert row above`,InsertRight:`Insert column right`,InsertBottom:`Insert row below`,InsertLeft:`Insert column Left`,MergeCell:`Merge Cell`,SplitCell:`Split Cell`,DeleteRow:`Delete Row`,DeleteColumn:`Delete Column`,DeleteTable:`Delete table`,BackgroundColor:`Set background color`,BorderColor:`Set border color`},e)}},{key:`quillHack`,value:function(){var e=this,n=this.quill.getSemanticHTML;this.quill.getSemanticHTML=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1?arguments[1]:void 0,a=n.call(e.quill,r,i),o=t.default.import(`formats/${z.tableWrapper}`),s=new DOMParser,c=s.parseFromString(a,`text/html`),l=0,u=Array.from(c.querySelectorAll(`.${o.className} caption[contenteditable], .${o.className} td > [contenteditable]`));l<u.length;l++){var d=u[l];d.removeAttribute(`contenteditable`)}return c.body.innerHTML};var r=this.quill.format;this.quill.format=function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.default.sources.API,a=this.scroll.query(e);if(!(a.prototype instanceof gi.EmbedBlot)){var o=this.getModule(le.moduleName),s=this.getSelection(!0),c=this.getFormat(s);if(!c[z.tableCellInner]||s.length>0||o&&o.tableSelection&&o.tableSelection.selectedTds.length<=1)return r.call(this,e,n,i);if(o&&o.tableSelection&&o.tableSelection.selectedTds.length>0){var l=o.tableSelection.selectedTds,u=!1,d=[],f=x(l),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.offset(this.scroll),g=m.length();d.push({index:h,length:g});var _=this.getFormat(h,g);_[e]!==n&&(u=!0)}}catch(e){f.e(e)}finally{f.f()}var v=u?n:!1,y=new _i,b=x(d.entries()),C;try{for(b.s();!(C=b.n()).done;){var w=F(C.value,2),T=w[0],E=w[1],D=E.index,O=E.length,k=T===0?0:d[T-1].index+d[T-1].length;y.retain(D-k).retain(O,S({},e,v))}}catch(e){b.e(e)}finally{b.f()}var A=this.updateContents(y,i);return this.blur(),A}}return r.call(this,e,n,i)};var i=this.quill.theme.modules.toolbar;if(i){var a,o=(a=i.handlers)==null?void 0:a.clean;if(o){var s=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return``},i=e.quill.getText(t,n),a=e.quill.getLine(t+n),o=F(a,2),s=o[0],c=o[1],l=0,u=new _i;s!=null&&(l=s.length()-c,u=s.delta().slice(c,c+l-1).insert(`
128
128
  `));var d=e.quill.getContents(t,n+l),f=d.diff(new _i().insert(i).concat(u)),p=0,m=f.ops.map(function(e){var t=e.attributes,n=N(e,mi);if(e.insert?p-=Ae(e.insert)?e.insert.length:1:e.retain?p+=je(e.retain)?e.retain:1:e.delete&&(p+=e.delete),t){var i=z.tableCellInner,a=t[i],o=N(t,[i].map(R));if(r){var s=d.slice(p-1,p).ops[0];if(s&&s.attributes&&s.attributes[z.tableCellInner]){var c=s.attributes[z.tableCellInner],l=c.style,u=N(c,hi),f=r(l);return f?M(M({},n),{},{attributes:M(M({},o),{},S({},z.tableCellInner,M({style:f},u)))}):M(M({},n),{},{attributes:M(M({},o),{},S({},z.tableCellInner,u))})}}return M(M({},n),{},{attributes:M({},o)})}return e});return new _i(m)};i.handlers.clean=function(e){var n=this,r=this.quill.getModule(le.moduleName),i=this.quill.getSelection();if(i&&i.length>0){var a=this.quill.getFormat(i);if(a[z.tableCellInner]){var c=s(i.index,i.length,!1),l=new _i().retain(i.index).concat(c);this.quill.updateContents(l,t.default.sources.USER);return}}if(r&&r.tableSelection&&r.tableSelection.selectedTds.length>0&&r.tableSelection.table){var u=t.default.find(r.tableSelection.table);if(!u){console.warn(`TableMainFormat not found`);return}var d=r.tableSelection.selectedTds,f=new Set,p=[],m=x(d),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;if(g.parent instanceof X){var _=x(g.parent.getNearByCell(`top`)),v;try{for(_.s();!(v=_.n()).done;){var y=v.value;f.has(y)||(f.add(y),p.push({td:y,cleanBorder:`bottom`}))}}catch(e){_.e(e)}finally{_.f()}var b=x(g.parent.getNearByCell(`left`)),S;try{for(b.s();!(S=b.n()).done;){var C=S.value;f.has(C)||(f.add(C),p.push({td:C,cleanBorder:`right`}))}}catch(e){b.e(e)}finally{b.f()}f.add(g.parent),p.push({td:g.parent,cleanBorder:!0})}}}catch(e){m.e(e)}finally{m.f()}var w=u.descendants(X),T=new Map(w.map(function(e,t){return[e,t]}));p.sort(function(e,t){return T.get(e.td)-T.get(t.td)});for(var E=new _i,D=0,O=function(){var e=A[k],t=e.td,r=e.cleanBorder,i=t.getCellInner().offset(n.quill.scroll),a=t.getCellInner().length(),o=s(i,a-1,function(e){if(!e||r===!0)return``;var t=Yn(e),n=Object.keys(t).filter(function(e){return!e.startsWith(Qn(`border-${r}`))}).reduce(function(e,n){return e[n]=t[n],e},{});return Xn(n)}),c=new _i().retain(i-D).concat(o);E=E.concat(c),D=i+a},k=0,A=p;k<A.length;k++)O();this.quill.updateContents(E,t.default.sources.USER),d.length>1&&this.quill.blur();return}return o.call(this,e)}}}}},{key:`showTableTools`,value:function(e){if(e){var t;this.table=e,(t=this.tableSelection)==null||t.show(),this.options.align&&(this.tableAlign=new this.options.align(this,e,this.quill,this.options.alignOptions)),this.options.scrollbar&&(this.tableScrollbar=new this.options.scrollbar(this,e,this.quill,this.options.scrollbarOptions)),this.options.resize&&(this.tableResize=new this.options.resize(this,e,this.quill,this.options.resizeOptions)),this.options.resizeScale&&(this.tableResizeScale=new this.options.resizeScale(this,e,this.quill,this.options.resizeScaleOptions))}}},{key:`hideTableTools`,value:function(){var e;(e=this.tableSelection)==null||e.hide(),this.tableScrollbar&&(this.tableScrollbar.destroy(),this.tableScrollbar=void 0),this.tableAlign&&(this.tableAlign.destroy(),this.tableAlign=void 0),this.tableResize&&(this.tableResize.destroy(),this.tableResize=void 0),this.tableResizeScale&&this.tableResizeScale.destroy(),this.table=void 0}},{key:`buildCustomSelect`,value:function(){var e=g(P().mark(function e(t,n){var r=this,i,a,o,s,c;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t||!Oe(t))){e.next=2;break}return e.abrupt(`return`);case 2:return i=document.createElement(`div`),i.classList.add(`ql-custom-select`),e.next=6,t(this,n);case 6:this.selector=e.sent,i.appendChild(this.selector),this.options.fullSwitch&&(a=V(`creator`),o=document.createElement(`label`),o.classList.add(a.be(`checkbox`)),s=document.createElement(`input`),s.type=`checkbox`,s.checked=this.options.full,s.addEventListener(`change`,function(){r.options.full=s.checked}),c=document.createElement(`span`),c.textContent=this.options.texts.fullCheckboxText,o.appendChild(s),o.appendChild(c),i.appendChild(o)),n.options.innerHTML=``,n.options.appendChild(i);case 11:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`setCellAttrs`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length!==0){var i=x(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;o.setFormatValue(t,n,r)}}catch(e){i.e(e)}finally{i.f()}}}},{key:`getTextByCell`,value:function(e){var t=``,n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.offset(this.quill.scroll),o=i.length(),s=x(this.quill.getContents(a,o).ops),c;try{for(s.s();!(c=s.n()).done;){var l=c.value;Ae(l.insert)&&(t+=l.insert)}}catch(e){s.e(e)}finally{s.f()}}}catch(e){n.e(e)}finally{n.f()}return t}},{key:`getHTMLByCell`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.length===0)return``;var n=null;try{var r=x(e),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=H(a,z.tableMain);if(n||(n=o),o!==n)return console.error(`tableMain is not same`),``}}catch(e){r.e(e)}finally{r.f()}}catch(e){return console.error(`tds must be in same tableMain`),``}if(!n)return``;var s=this.quill.getIndex(n),c=n.length(),l=this.quill.getSemanticHTML(s,c),u=new DOMParser,d=u.parseFromString(l,`text/html`),f=[],p=new Set,m=new Set,h=x(e),g;try{for(h.s();!(g=h.n()).done;){var _=g.value;p.add(_.colId),m.add(`${_.rowId}-${_.colId}`)}}catch(e){h.e(e)}finally{h.f()}for(var v=0,y=Array.from(d.querySelectorAll(`col`));v<y.length;v++){var b=y[v];p.has(b.dataset.colId)?f.push(b.getAttribute(`width`)):b.remove()}for(var S=0,C=null,w=0,T=Array.from(d.querySelectorAll(`td`));w<T.length;w++){var E=T[w];if(m.has(`${E.dataset.rowId}-${E.dataset.colId}`))C!==E.dataset.rowId&&(S+=1,C=E.dataset.rowId);else{var D=E.parentElement;E.remove(),D&&D.children.length<=0&&D.remove()}}var O=Array.from(d.querySelectorAll(`col`)),k=O.map(function(e){return Cr.value(e)});if(n.full){var A=k.reduce(function(e,t){return t.width+e},0),j=x(k.entries()),M;try{for(j.s();!(M=j.n()).done;){var N=F(M.value,2),ee=N[0],te=N[1];te.width=Math.round(te.width/A*100),O[ee].setAttribute(`width`,`${te.width}%`)}}catch(e){j.e(e)}finally{j.f()}}else{var P=0,ne=x(k),re;try{for(ne.s();!(re=ne.n()).done;){var I=re.value;P+=I.width}}catch(e){ne.e(e)}finally{ne.f()}var L=d.querySelector(`table`);L.style.width=`${P}px`}if(t){var ie=n.getRows();if(S===ie.length)this.removeCol(e);else{var R=x(e),ae;try{for(R.s();!(ae=R.n()).done;){var oe=ae.value;oe.domNode.innerHTML=`<p><br></p>`}}catch(e){R.e(e)}finally{R.f()}}}return d.body.innerHTML}},{key:`insertTable`,value:function(e,n){if(e>=30||n>=30)throw Error(`Both rows and columns must be less than 30.`);this.quill.focus();var r=this.quill.getSelection();if(r!=null){var i=this.quill.getLeaf(r.index),a=F(i,1),o=a[0];if(o){if(me(o))throw Error(`Not supported ${o.statics.blotName} insert into table.`);var s=this.calculateTableCellBorderWidth(),c=getComputedStyle(this.quill.root),l=Number.parseInt(c.paddingLeft),u=Number.parseInt(c.paddingRight),d=Number.parseInt(c.width)-l-u-s,f=G(),p=Array(n).fill(0).map(function(){return G()}),m=this.options.full?`${Math.max(1/n*100,B.colMinWidthPre)}%`:`${Math.max(Math.floor(d/n),B.colMinWidthPx)}px`,h=[{retain:r.index}],g=this.quill.getContents(r.index,1),_=this.quill.getLine(r.index),v=F(_,2),y=v[1];g.ops[0].insert!==`
129
129
  `&&y!==0&&h.push({insert:`
130
130
  `});for(var b=0;b<n;b++)h.push({insert:S({},z.tableCol,{width:m,tableId:f,colId:p[b],full:this.options.full})});for(var x=0;x<e;x++)for(var C=G(),w=0;w<n;w++)h.push({insert:`