quill-table-up 3.0.1 → 3.0.2
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.d.ts +3 -2
- package/dist/index.js +29 -29
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +26 -26
- package/dist/index.umd.js.map +1 -1
- package/package.json +18 -18
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +2 -2
- package/src/__tests__/e2e/table-menu.test.ts +4 -5
- package/src/__tests__/unit/table-clipboard.test.ts +39 -39
- package/src/__tests__/unit/table-hack.test.ts +2 -2
- package/src/__tests__/unit/table-insert.test.ts +50 -0
- package/src/__tests__/unit/table-redo-undo.test.ts +217 -25
- package/src/__tests__/unit/table-remove.test.ts +3 -1
- package/src/__tests__/unit/utils.ts +2 -1
- package/src/formats/overrides/block-embed.ts +1 -2
- package/src/formats/overrides/block.ts +7 -2
- package/src/formats/table-cell-inner-format.ts +20 -4
- package/src/formats/table-col-format.ts +26 -30
- package/src/formats/table-wrapper-format.ts +9 -1
- package/src/modules/table-selection.ts +4 -1
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/table-up.ts +6 -5
- package/src/utils/blot-helper.ts +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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,ae(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=se(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=ae(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)||se(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)||se(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 ae(e){var t=ie(e,`string`);return typeof t==`symbol`?t:t+``}function oe(e){"@babel/helpers - typeof";return oe=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},oe(e)}function se(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 ce(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)}ce.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},ce.prototype.next=function(e){return this._invoke(`next`,e)},ce.prototype.throw=function(e){return this._invoke(`throw`,e)},ce.prototype.return=function(e){return this._invoke(`return`,e)};var R={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableHead:`table-up-head`,tableBody:`table-up-body`,tableFoot:`table-up-foot`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},z={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},B={AFTER_TABLE_RESIZE:`after-table-resize`,TABLE_SELECTION_DRAG_START:`table-selection-drag-start`,TABLE_SELECTION_DRAG_END:`table-selection-drag-end`,TABLE_SELECTION_CHANGE:`table-selection-change`,TABLE_SELECTION_DISPLAY_CHANGE:`table-selection-display-change`},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([R.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&&oe(e)===`object`},Ne=function(e){return!Number.isNaN(e)&&Number(e)>0},Pe=function(e){return ke(e)?e:[e]};function Fe(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 Ie(){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 ae(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,ae),E=!1}function oe(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,ae),E=!0,ne(e)}m.addEventListener(`mousedown`,oe);function se(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,se),D=!1}function ce(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,se),D=!0,re(e)}return d.addEventListener(`mousedown`,ce),ee(),o}var Le=8e3;function Re(){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(Le);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),Le+=1,{dialog:c,close:f}}function ze(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 Be(){return Ve.apply(this,arguments)}function Ve(){return Ve=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=ze(t.rowText||`Row`,{type:`number`,value:String(t.row||``),max:99}),o=a.item,s=a.input,c=a.errorTip,l=ze(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=Fe({type:`confirm`,content:t.confirmText||`Confirm`}),h=Fe({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=Re({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)}).finally(function(){document.removeEventListener(`keydown`,v)}));case 21:case`end`:return e.stop()}},e)})),Ve.apply(this,arguments)}function He(){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,Be(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 Ue(e){"@babel/helpers - typeof";return Ue=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},Ue(e)}function We(e,t){if(Ue(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ue(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ge(e){var t=We(e,`string`);return Ue(t)==`symbol`?t:t+``}function Ke(e,t,n){return(t=Ge(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(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?qe(Object(n),!0).forEach(function(t){Ke(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Je=Math.min,Ye=Math.max,Xe=Math.round,Ze=Math.floor,Qe=e=>({x:e,y:e}),$e={left:`right`,right:`left`,bottom:`top`,top:`bottom`},et={start:`end`,end:`start`};function tt(e,t,n){return Ye(e,Je(t,n))}function nt(e,t){return typeof e==`function`?e(t):e}function rt(e){return e.split(`-`)[0]}function it(e){return e.split(`-`)[1]}function at(e){return e===`x`?`y`:`x`}function ot(e){return e===`y`?`height`:`width`}function st(e){return[`top`,`bottom`].includes(rt(e))?`y`:`x`}function ct(e){return at(st(e))}function lt(e,t,n){n===void 0&&(n=!1);let r=it(e),i=ct(e),a=ot(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=mt(o)),[o,mt(o)]}function ut(e){let t=mt(e);return[dt(e),t,dt(t)]}function dt(e){return e.replace(/start|end/g,e=>et[e])}function ft(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 pt(e,t,n,r){let i=it(e),a=ft(rt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(dt)))),a}function mt(e){return e.replace(/left|right|bottom|top/g,e=>$e[e])}function ht(e){return U({top:0,right:0,bottom:0,left:0},e)}function gt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ht(e)}function _t(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 vt(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 yt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){vt(a,r,i,o,s,`next`,e)}function s(e){vt(a,r,i,o,s,`throw`,e)}o(void 0)})}}function bt(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 xt(e,t){if(e==null)return{};var n,r,i=bt(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 St=[`crossAxis`,`alignment`,`allowedPlacements`,`autoAlignment`],Ct=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],wt=[`strategy`],Tt=[`mainAxis`,`crossAxis`,`limiter`],Et=[`apply`];function Dt(e,t,n){let{reference:r,floating:i}=e,a=st(t),o=ct(t),s=ot(o),c=rt(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(it(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let Ot=function(){var e=yt(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}=Dt(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}=Dt(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 kt(e,t){return At.apply(this,arguments)}function At(){return At=yt(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}=nt(t,e),m=gt(p),h=d===`floating`?`reference`:`floating`,g=s[f?h:d],_=_t(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=_t(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}}),At.apply(this,arguments)}let jt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return yt(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=nt(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=xt(u,Ct);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=rt(i),y=st(s),b=rt(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[mt(s)]:ut(s)),C=h!==`none`;!p&&C&&S.push(...pt(s,g,h,x));let w=[s,...S],T=yield kt(t,_),E=[],D=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&E.push(T[v]),f){let e=lt(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!==st(t):!1;if(!n||D.every(e=>e.overflows[0]>0&&st(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=st(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 Mt(e,t){return Nt.apply(this,arguments)}function Nt(){return Nt=yt(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=rt(n),s=it(n),c=st(n)===`y`,l=[`left`,`top`].includes(o)?-1:1,u=a&&c?-1:1,d=nt(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}}),Nt.apply(this,arguments)}let Pt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return yt(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield Mt(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})}})()}}},Ft=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return yt(function*(){let{x:n,y:r,placement:i}=t,a=nt(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=xt(a,Tt),u={x:n,y:r},d=yield kt(t,l),f=st(rt(i)),p=at(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=tt(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=tt(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}}})})()}}},It=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}=nt(e,t),u={x:n,y:r},d=st(i),f=at(d),p=u[f],m=u[d],h=nt(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(rt(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 Lt(){return typeof window<`u`}function Rt(e){return Bt(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function zt(e){var t;return(t=(Bt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bt(e){return Lt()?e instanceof Node||e instanceof W(e).Node:!1}function Vt(e){return Lt()?e instanceof Element||e instanceof W(e).Element:!1}function Ht(e){return Lt()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Ut(e){return!Lt()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Wt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&![`inline`,`contents`].includes(i)}function Gt(e){return[`table`,`td`,`th`].includes(Rt(e))}function Kt(e){return[`:popover-open`,`:modal`].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function qt(e){let t=Yt(),n=Vt(e)?Zt(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 Jt(e){let t=$t(e);for(;Ht(t)&&!Xt(t);){if(qt(t))return t;if(Kt(t))return null;t=$t(t)}return null}function Yt(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}function Xt(e){return[`html`,`body`,`#document`].includes(Rt(e))}function Zt(e){return W(e).getComputedStyle(e)}function Qt(e){return Vt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $t(e){if(Rt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ut(e)&&e.host||zt(e);return Ut(t)?t.host:t}function en(e){let t=$t(e);return Xt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ht(t)&&Wt(t)?t:en(t)}function tn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=en(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=W(i);if(a){let e=nn(o);return t.concat(o,o.visualViewport||[],Wt(i)?i:[],e&&n?tn(e):[])}return t.concat(i,tn(i,[],n))}function nn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function rn(e){let t=Zt(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ht(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Xe(n)!==a||Xe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function an(e){return Vt(e)?e:e.contextElement}function on(e){let t=an(e);if(!Ht(t))return Qe(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=rn(t),o=(a?Xe(n.width):n.width)/r,s=(a?Xe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let sn=Qe(0);function cn(e){let t=W(e);return!Yt()||!t.visualViewport?sn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ln(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function un(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=an(e),o=Qe(1);t&&(r?Vt(r)&&(o=on(r)):o=on(e));let s=ln(a,n,r)?cn(a):Qe(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&&Vt(r)?W(r):r,n=e,i=nn(n);for(;i&&r&&t!==n;){let e=on(i),t=i.getBoundingClientRect(),r=Zt(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=nn(n)}}return _t({width:u,height:d,x:c,y:l})}function dn(e,t){let n=Qt(e).scrollLeft;return t?t.left+n:un(zt(e)).left+n}function fn(e,t,n){n===void 0&&(n=!1);let r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:dn(e,r)),a=r.top+t.scrollTop;return{x:i,y:a}}function pn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=zt(r),s=t?Kt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Qe(1),u=Qe(0),d=Ht(r);if((d||!d&&!a)&&((Rt(r)!==`body`||Wt(o))&&(c=Qt(r)),Ht(r))){let e=un(r);l=on(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?fn(o,c,!0):Qe(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 mn(e){return Array.from(e.getClientRects())}function hn(e){let t=zt(e),n=Qt(e),r=e.ownerDocument.body,i=Ye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+dn(e),s=-n.scrollTop;return Zt(r).direction===`rtl`&&(o+=Ye(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function gn(e,t){let n=W(e),r=zt(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Yt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}function _n(e,t){let n=un(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ht(e)?on(e):Qe(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 vn(e,t,n){let r;if(t===`viewport`)r=gn(e,n);else if(t===`document`)r=hn(zt(e));else if(Vt(t))r=_n(t,n);else{let n=cn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _t(r)}function yn(e,t){let n=$t(e);return n===t||!Vt(n)||Xt(n)?!1:Zt(n).position===`fixed`||yn(n,t)}function bn(e,t){let n=t.get(e);if(n)return n;let r=tn(e,[],!1).filter(e=>Vt(e)&&Rt(e)!==`body`),i=null,a=Zt(e).position===`fixed`,o=a?$t(e):e;for(;Vt(o)&&!Xt(o);){let t=Zt(o),n=qt(o);!n&&t.position===`fixed`&&(i=null);let s=a?!n&&!i:!n&&t.position===`static`&&!!i&&[`absolute`,`fixed`].includes(i.position)||Wt(o)&&!n&&yn(e,o);s?r=r.filter(e=>e!==o):i=t,o=$t(o)}return t.set(e,r),r}function xn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=n===`clippingAncestors`?Kt(t)?[]:bn(t,this._c):[].concat(n),o=[...a,r],s=o[0],c=o.reduce((e,n)=>{let r=vn(t,n,i);return e.top=Ye(r.top,e.top),e.right=Je(r.right,e.right),e.bottom=Je(r.bottom,e.bottom),e.left=Ye(r.left,e.left),e},vn(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Sn(e){let{width:t,height:n}=rn(e);return{width:t,height:n}}function Cn(e,t,n){let r=Ht(t),i=zt(t),a=n===`fixed`,o=un(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Qe(0);function l(){c.x=dn(i)}if(r||!r&&!a)if((Rt(t)!==`body`||Wt(i))&&(s=Qt(t)),r){let e=un(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?fn(i,s):Qe(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 wn(e){return Zt(e).position===`static`}function Tn(e,t){if(!Ht(e)||Zt(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return zt(e)===n&&(n=n.ownerDocument.body),n}function En(e,t){let n=W(e);if(Kt(e))return n;if(!Ht(e)){let t=$t(e);for(;t&&!Xt(t);){if(Vt(t)&&!wn(t))return t;t=$t(t)}return n}let r=Tn(e,t);for(;r&&Gt(r)&&wn(r);)r=Tn(r,t);return r&&Xt(r)&&wn(r)&&!qt(r)?n:r||Jt(e)||n}let Dn=function(){var e=yt(function*(e){let t=this.getOffsetParent||En,n=this.getDimensions,r=yield n(e.floating);return{reference:Cn(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 On(e){return Zt(e).direction===`rtl`}let kn={convertOffsetParentRelativeRectToViewportRelativeRect:pn,getDocumentElement:zt,getClippingRect:xn,getOffsetParent:En,getElementRects:Dn,getClientRects:mn,getDimensions:Sn,getScale:on,isElement:Vt,isRTL:On};function An(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jn(e,t){let n=null,r,i=zt(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=Ze(d),h=Ze(i.clientWidth-(u+f)),g=Ze(i.clientHeight-(d+p)),_=Ze(u),v=-m+`px `+-h+`px `+-g+`px `+-_+`px`,y={rootMargin:v,threshold:Ye(0,Je(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&&!An(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 Mn(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=an(e),u=i||a?[...l?tn(l):[],...tn(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?jn(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?un(e):null;c&&g();function g(){let t=un(e);h&&!An(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 Nn=Pt,Pn=Ft,Fn=jt,In=It,Ln=(e,t,n)=>{let r=new Map,i=U({platform:kn},n),a=U(U({},i.platform),{},{_c:r});return Ot(e,t,U(U({},i),{},{platform:a}))};function Rn(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(function(){n()},t)}var zn=4,Bn;function Vn(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){Bn||(Bn=document.createElement(`div`));var _=d||Bn,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(),Ln(e,v,{placement:c,middleware:[Fn(),Pn({limiter:In()}),Nn(zn)]}).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),_===Bn&&!Bn.hasChildNodes()&&document.body.removeChild(Bn)),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}_===Bn&&!Bn.parentElement&&document.body.appendChild(Bn),_.appendChild(v),v.removeEventListener(`transitionend`,C),v.classList.remove(`hidden`),x=Mn(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}Rn(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 Hn(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 Un(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 Wn=8;function Gn(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-Wn,c=!0):t<0&&(t=Wn,c=!0),n+i>s?(n=s-i-Wn,l=!0):n<0&&(n=Wn,l=!0),{left:t,top:n,leftLimited:c,topLimited:l}}function Kn(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 qn(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function Jn(){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 Yn(e){return{y:e.scrollTop,x:e.scrollLeft}}function Xn(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.target,r=n===void 0?document.body:n,i=document.createElement(`div`);Object.assign(i.style,{visibility:`hidden`,width:`100px`,height:`100%`,overflow:`auto`,position:`absolute`,top:`-9999px`}),r.appendChild(i);var a=i.offsetWidth;i.style.overflow=`scroll`;var o=document.createElement(`div`);o.style.width=`100%`,i.appendChild(o);var s=o.offsetWidth;return(e=i.parentNode)==null||e.removeChild(i),a-s}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()})}function $n(e){var t={};if(!e.style.cssText)return t;var n=e.style.cssText,r=n.split(`;`).filter(function(e){return e.trim()}),i=x(r),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.indexOf(`:`);if(s!==-1){var c=o.slice(0,s).trim(),l=o.slice(s+1).trim();t[c]=l}}}catch(e){i.e(e)}finally{i.f()}return t}function er(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 tr(e){return Object.entries(e).map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${Zn(n)}: ${r};`}).join(` `)}var G=function(){return Math.random().toString(36).slice(2)};function nr(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 rr=t.default.import(`parchment`),ir=t.default.import(`blots/container`),ar=t.default.import(`blots/block`),or=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:`setFormatValue`,value:function(e,t){if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var n=e;this.statics.allowDataAttrs.has(e)&&(n=`data-${e}`),t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n);var r=this.statics.allowDataAttrsChangeHandler[e];r&&Oe(this[r])&&this[r](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===rr.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 rr.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}}])}(ir);S(K,`tagName`,void 0),S(K,`blotName`,R.container),S(K,`scope`,rr.Scope.BLOCK_BLOT),S(K,`allowedChildren`,[ar,or,ir]),S(K,`requiredContainer`,void 0),S(K,`defaultChild`,void 0),S(K,`allowAttrs`,new Set([])),S(K,`allowDataAttrs`,new Set([])),S(K,`allowDataAttrsChangeHandler`,{});var sr=function(e){return Ne(e)?e:1};function cr(e,t){return Object.keys(e).every(function(n){return JSON.stringify(e[n])===JSON.stringify(t[n])})}var lr=t.default.import(`parchment`),ur=t.default.import(`blots/block`),dr=t.default.import(`blots/container`),fr=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 lr.ParentBlot)if(n.statics.blotName===R.tableCellInner){var r=null;try{r=H(this,R.tableCellInner);var i=r.formats(),a=n.formats();if(cr(i,a))return r}catch(e){}if(r)r.insertBefore(n,this),n.appendChild(this);else{for(var o=this,s=o;o.parent!==this.scroll&&o.parent instanceof dr;)s=o,o=o.parent;o===this.scroll&&(o=s);var c=this.offset(o),l=this.length();o.split(c+l);var u=o.split(c);u&&u.parent&&u.parent.insertBefore(n,u.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===R.tableCellInner&&this.parent.statics.blotName===e&&!n)try{var r=H(this,R.tableCellInner);r.unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}else I(t,`format`,this,3)([e,n])}}])}(ur),pr=t.default.import(`blots/block/embed`),mr=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=hr(this);return n[R.tableCellInner]&&e.insert(`
|
|
5
|
-
`,S({},R.tableCellInner,n[R.tableCellInner])),e}},{key:`length`,value:function(){var e=
|
|
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(){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)||se(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)||se(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 ae(e){var t=ie(e,`string`);return typeof t==`symbol`?t:t+``}function oe(e){"@babel/helpers - typeof";return oe=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},oe(e)}function se(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 ce(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)}ce.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},ce.prototype.next=function(e){return this._invoke(`next`,e)},ce.prototype.throw=function(e){return this._invoke(`throw`,e)},ce.prototype.return=function(e){return this._invoke(`return`,e)};var R={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableHead:`table-up-head`,tableBody:`table-up-body`,tableFoot:`table-up-foot`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},z={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},B={AFTER_TABLE_RESIZE:`after-table-resize`,TABLE_SELECTION_DRAG_START:`table-selection-drag-start`,TABLE_SELECTION_DRAG_END:`table-selection-drag-end`,TABLE_SELECTION_CHANGE:`table-selection-change`,TABLE_SELECTION_DISPLAY_CHANGE:`table-selection-display-change`},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([R.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);var e=[...arguments];return _(this,t,[].concat(e))}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&&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&&oe(e)===`object`},Ne=function(e){return!Number.isNaN(e)&&Number(e)>0},Pe=function(e){return ke(e)?e:[e]};function Fe(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 Ie(){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 ae(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,ae),E=!1}function oe(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,ae),E=!0,ne(e)}m.addEventListener(`mousedown`,oe);function se(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,se),D=!1}function ce(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,se),D=!0,re(e)}return d.addEventListener(`mousedown`,ce),ee(),o}var Le=8e3;function Re(){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(Le);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),Le+=1,{dialog:c,close:f}}function ze(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 Be(){return Ve.apply(this,arguments)}function Ve(){return Ve=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=ze(t.rowText||`Row`,{type:`number`,value:String(t.row||``),max:99}),o=a.item,s=a.input,c=a.errorTip,l=ze(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=Fe({type:`confirm`,content:t.confirmText||`Confirm`}),h=Fe({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=Re({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 1:case`end`:return t.stop()}},t)}))),document.addEventListener(`keydown`,v),h.addEventListener(`click`,i)}).finally(function(){document.removeEventListener(`keydown`,v)}));case 1:case`end`:return e.stop()}},e)})),Ve.apply(this,arguments)}function He(){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=1,Be(c);case 1:n=t.sent,n&&e.onSelect&&e.onSelect(n.row,n.col);case 2:case`end`:return t.stop()}},t)}))),n.appendChild(l)}return n}function Ue(e){"@babel/helpers - typeof";return Ue=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},Ue(e)}function We(e,t){if(Ue(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ue(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ge(e){var t=We(e,`string`);return Ue(t)==`symbol`?t:t+``}function Ke(e,t,n){return(t=Ge(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(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?qe(Object(n),!0).forEach(function(t){Ke(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Je=Math.min,Ye=Math.max,Xe=Math.round,Ze=Math.floor,Qe=e=>({x:e,y:e}),$e={left:`right`,right:`left`,bottom:`top`,top:`bottom`},et={start:`end`,end:`start`};function tt(e,t,n){return Ye(e,Je(t,n))}function nt(e,t){return typeof e==`function`?e(t):e}function rt(e){return e.split(`-`)[0]}function it(e){return e.split(`-`)[1]}function at(e){return e===`x`?`y`:`x`}function ot(e){return e===`y`?`height`:`width`}let st=new Set([`top`,`bottom`]);function ct(e){return st.has(rt(e))?`y`:`x`}function lt(e){return at(ct(e))}function ut(e,t,n){n===void 0&&(n=!1);let r=it(e),i=lt(e),a=ot(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=yt(o)),[o,yt(o)]}function dt(e){let t=yt(e);return[ft(e),t,ft(t)]}function ft(e){return e.replace(/start|end/g,e=>et[e])}let pt=[`left`,`right`],mt=[`right`,`left`],ht=[`top`,`bottom`],gt=[`bottom`,`top`];function _t(e,t,n){switch(e){case`top`:case`bottom`:return n?t?mt:pt:t?pt:mt;case`left`:case`right`:return t?ht:gt;default:return[]}}function vt(e,t,n,r){let i=it(e),a=_t(rt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ft)))),a}function yt(e){return e.replace(/left|right|bottom|top/g,e=>$e[e])}function bt(e){return U({top:0,right:0,bottom:0,left:0},e)}function xt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:bt(e)}function St(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 Ct(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 wt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Ct(a,r,i,o,s,`next`,e)}function s(e){Ct(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Tt(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 Et(e,t){if(e==null)return{};var n,r,i=Tt(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 Dt=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],Ot=[`mainAxis`,`crossAxis`,`limiter`];function kt(e,t,n){let{reference:r,floating:i}=e,a=ct(t),o=lt(t),s=ot(o),c=rt(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(it(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let At=function(){var e=wt(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}=kt(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}=kt(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 jt(e,t){return Mt.apply(this,arguments)}function Mt(){return Mt=wt(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}=nt(t,e),m=xt(p),h=d===`floating`?`reference`:`floating`,g=s[f?h:d],_=St(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=St(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}}),Mt.apply(this,arguments)}let Nt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return wt(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=nt(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=Et(u,Dt);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=rt(i),y=ct(s),b=rt(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[yt(s)]:dt(s)),C=h!==`none`;!p&&C&&S.push(...vt(s,g,h,x));let w=[s,...S],T=yield jt(t,_),E=[],D=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&E.push(T[v]),f){let e=ut(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!==ct(t):!1;if(!n||D.every(e=>ct(e.placement)===y?e.overflows[0]>0:!0))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=ct(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{}})()}}},Pt=new Set([`left`,`top`]);function Ft(e,t){return It.apply(this,arguments)}function It(){return It=wt(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=rt(n),s=it(n),c=ct(n)===`y`,l=Pt.has(o)?-1:1,u=a&&c?-1:1,d=nt(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}}),It.apply(this,arguments)}let Lt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return wt(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield Ft(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})}})()}}},Rt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return wt(function*(){let{x:n,y:r,placement:i}=t,a=nt(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=Et(a,Ot),u={x:n,y:r},d=yield jt(t,l),f=ct(rt(i)),p=at(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=tt(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=tt(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}}})})()}}},zt=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}=nt(e,t),u={x:n,y:r},d=ct(i),f=at(d),p=u[f],m=u[d],h=nt(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=Pt.has(rt(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 Bt(){return typeof window<`u`}function Vt(e){return Ut(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ht(e){var t;return(t=(Ut(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ut(e){return Bt()?e instanceof Node||e instanceof W(e).Node:!1}function Wt(e){return Bt()?e instanceof Element||e instanceof W(e).Element:!1}function Gt(e){return Bt()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Kt(e){return!Bt()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}let qt=new Set([`inline`,`contents`]);function Jt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=cn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qt.has(i)}let Yt=new Set([`table`,`td`,`th`]);function Xt(e){return Yt.has(Vt(e))}let Zt=[`:popover-open`,`:modal`];function Qt(e){return Zt.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let $t=[`transform`,`translate`,`scale`,`rotate`,`perspective`],en=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],tn=[`paint`,`layout`,`strict`,`content`];function nn(e){let t=an(),n=Wt(e)?cn(e):e;return $t.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)||en.some(e=>(n.willChange||``).includes(e))||tn.some(e=>(n.contain||``).includes(e))}function rn(e){let t=un(e);for(;Gt(t)&&!sn(t);){if(nn(t))return t;if(Qt(t))return null;t=un(t)}return null}function an(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}let on=new Set([`html`,`body`,`#document`]);function sn(e){return on.has(Vt(e))}function cn(e){return W(e).getComputedStyle(e)}function ln(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function un(e){if(Vt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Kt(e)&&e.host||Ht(e);return Kt(t)?t.host:t}function dn(e){let t=un(e);return sn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gt(t)&&Jt(t)?t:dn(t)}function fn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=dn(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=W(i);if(a){let e=pn(o);return t.concat(o,o.visualViewport||[],Jt(i)?i:[],e&&n?fn(e):[])}return t.concat(i,fn(i,[],n))}function pn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mn(e){let t=cn(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Gt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Xe(n)!==a||Xe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function hn(e){return Wt(e)?e:e.contextElement}function gn(e){let t=hn(e);if(!Gt(t))return Qe(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=mn(t),o=(a?Xe(n.width):n.width)/r,s=(a?Xe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let _n=Qe(0);function vn(e){let t=W(e);return!an()||!t.visualViewport?_n:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function yn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function bn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=hn(e),o=Qe(1);t&&(r?Wt(r)&&(o=gn(r)):o=gn(e));let s=yn(a,n,r)?vn(a):Qe(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&&Wt(r)?W(r):r,n=e,i=pn(n);for(;i&&r&&t!==n;){let e=gn(i),t=i.getBoundingClientRect(),r=cn(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=pn(n)}}return St({width:u,height:d,x:c,y:l})}function xn(e,t){let n=ln(e).scrollLeft;return t?t.left+n:bn(Ht(e)).left+n}function Sn(e,t){let n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-xn(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Cn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ht(r),s=t?Qt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Qe(1),u=Qe(0),d=Gt(r);if((d||!d&&!a)&&((Vt(r)!==`body`||Jt(o))&&(c=ln(r)),Gt(r))){let e=bn(r);l=gn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Sn(o,c):Qe(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 wn(e){return Array.from(e.getClientRects())}function Tn(e){let t=Ht(e),n=ln(e),r=e.ownerDocument.body,i=Ye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+xn(e),s=-n.scrollTop;return cn(r).direction===`rtl`&&(o+=Ye(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function En(e,t){let n=W(e),r=Ht(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=an();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=xn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}let Dn=new Set([`absolute`,`fixed`]);function On(e,t){let n=bn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Gt(e)?gn(e):Qe(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 kn(e,t,n){let r;if(t===`viewport`)r=En(e,n);else if(t===`document`)r=Tn(Ht(e));else if(Wt(t))r=On(t,n);else{let n=vn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return St(r)}function An(e,t){let n=un(e);return n===t||!Wt(n)||sn(n)?!1:cn(n).position===`fixed`||An(n,t)}function jn(e,t){let n=t.get(e);if(n)return n;let r=fn(e,[],!1).filter(e=>Wt(e)&&Vt(e)!==`body`),i=null,a=cn(e).position===`fixed`,o=a?un(e):e;for(;Wt(o)&&!sn(o);){let t=cn(o),n=nn(o);!n&&t.position===`fixed`&&(i=null);let s=a?!n&&!i:!n&&t.position===`static`&&!!i&&Dn.has(i.position)||Jt(o)&&!n&&An(e,o);s?r=r.filter(e=>e!==o):i=t,o=un(o)}return t.set(e,r),r}function Mn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=n===`clippingAncestors`?Qt(t)?[]:jn(t,this._c):[].concat(n),o=[...a,r],s=o[0],c=o.reduce((e,n)=>{let r=kn(t,n,i);return e.top=Ye(r.top,e.top),e.right=Je(r.right,e.right),e.bottom=Je(r.bottom,e.bottom),e.left=Ye(r.left,e.left),e},kn(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nn(e){let{width:t,height:n}=mn(e);return{width:t,height:n}}function Pn(e,t,n){let r=Gt(t),i=Ht(t),a=n===`fixed`,o=bn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Qe(0);function l(){c.x=xn(i)}if(r||!r&&!a)if((Vt(t)!==`body`||Jt(i))&&(s=ln(t)),r){let e=bn(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?Sn(i,s):Qe(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 Fn(e){return cn(e).position===`static`}function In(e,t){if(!Gt(e)||cn(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ht(e)===n&&(n=n.ownerDocument.body),n}function Ln(e,t){let n=W(e);if(Qt(e))return n;if(!Gt(e)){let t=un(e);for(;t&&!sn(t);){if(Wt(t)&&!Fn(t))return t;t=un(t)}return n}let r=In(e,t);for(;r&&Xt(r)&&Fn(r);)r=In(r,t);return r&&sn(r)&&Fn(r)&&!nn(r)?n:r||rn(e)||n}let Rn=function(){var e=wt(function*(e){let t=this.getOffsetParent||Ln,n=this.getDimensions,r=yield n(e.floating);return{reference:Pn(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 zn(e){return cn(e).direction===`rtl`}let Bn={convertOffsetParentRelativeRectToViewportRelativeRect:Cn,getDocumentElement:Ht,getClippingRect:Mn,getOffsetParent:Ln,getElementRects:Rn,getClientRects:wn,getDimensions:Nn,getScale:gn,isElement:Wt,isRTL:zn};function Vn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hn(e,t){let n=null,r,i=Ht(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=Ze(d),h=Ze(i.clientWidth-(u+f)),g=Ze(i.clientHeight-(d+p)),_=Ze(u),v=-m+`px `+-h+`px `+-g+`px `+-_+`px`,y={rootMargin:v,threshold:Ye(0,Je(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&&!Vn(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 Un(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=hn(e),u=i||a?[...l?fn(l):[],...fn(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Hn(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?bn(e):null;c&&g();function g(){let t=bn(e);h&&!Vn(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 Wn=Lt,Gn=Rt,Kn=Nt,qn=zt,Jn=(e,t,n)=>{let r=new Map,i=U({platform:Bn},n),a=U(U({},i.platform),{},{_c:r});return At(e,t,U(U({},i),{},{platform:a}))};function Yn(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(function(){n()},t)}var Xn=4,Zn;function Qn(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`));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(),Jn(e,v,{placement:c,middleware:[Kn(),Gn({limiter:qn()}),Wn(Xn)]}).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),_===Zn&&!Zn.hasChildNodes()&&document.body.removeChild(Zn)),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}_===Zn&&!Zn.parentElement&&document.body.appendChild(Zn),_.appendChild(v),v.removeEventListener(`transitionend`,C),v.classList.remove(`hidden`),x=Un(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}Yn(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 $n(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 er(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 tr=8;function nr(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-tr,c=!0):t<0&&(t=tr,c=!0),n+i>s?(n=s-i-tr,l=!0):n<0&&(n=tr,l=!0),{left:t,top:n,leftLimited:c,topLimited:l}}function rr(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 ir(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function ar(){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 or(e){return{y:e.scrollTop,x:e.scrollLeft}}function sr(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.target,r=n===void 0?document.body:n,i=document.createElement(`div`);Object.assign(i.style,{visibility:`hidden`,width:`100px`,height:`100%`,overflow:`auto`,position:`absolute`,top:`-9999px`}),r.appendChild(i);var a=i.offsetWidth;i.style.overflow=`scroll`;var o=document.createElement(`div`);o.style.width=`100%`,i.appendChild(o);var s=o.offsetWidth;return(e=i.parentNode)==null||e.removeChild(i),a-s}function cr(e){var t=e.replaceAll(RegExp(`([A-Z])`,`g`),` $1`).trim();return t.split(` `).join(`-`).toLowerCase()}function lr(e){return e.replaceAll(RegExp(`-(\\w)`,`g`),function(e,t){return t.toUpperCase()})}function ur(e){var t={};if(!e.style.cssText)return t;var n=e.style.cssText,r=n.split(`;`).filter(function(e){return e.trim()}),i=x(r),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.indexOf(`:`);if(s!==-1){var c=o.slice(0,s).trim(),l=o.slice(s+1).trim();t[c]=l}}}catch(e){i.e(e)}finally{i.f()}return t}function dr(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[lr(o)]=s}}}return t}function fr(e){return Object.entries(e).map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${cr(n)}: ${r};`}).join(` `)}var G=function(){return Math.random().toString(36).slice(2)};function pr(e,t){var n;return function(){var r=this,i=[...arguments];n&&clearTimeout(n),n=setTimeout(function(){e.apply(r,i)},t)}}var mr=t.default.import(`parchment`),hr=t.default.import(`blots/container`),gr=t.default.import(`blots/block`),_r=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:`setFormatValue`,value:function(e,t){if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var n=e;this.statics.allowDataAttrs.has(e)&&(n=`data-${e}`),t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n);var r=this.statics.allowDataAttrsChangeHandler[e];r&&Oe(this[r])&&this[r](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===mr.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 mr.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}}])}(hr);S(K,`tagName`,void 0),S(K,`blotName`,R.container),S(K,`scope`,mr.Scope.BLOCK_BLOT),S(K,`allowedChildren`,[gr,_r,hr]),S(K,`requiredContainer`,void 0),S(K,`defaultChild`,void 0),S(K,`allowAttrs`,new Set([])),S(K,`allowDataAttrs`,new Set([])),S(K,`allowDataAttrsChangeHandler`,{});var vr=function(e){return Ne(e)?e:1};function yr(e,t){return Object.keys(e).every(function(n){return JSON.stringify(e[n])===JSON.stringify(t[n])})}var br=t.default.import(`parchment`),xr=t.default.import(`blots/block`),Sr=t.default.import(`blots/block/embed`),Cr=t.default.import(`blots/container`),wr=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 br.ParentBlot)if(n.statics.blotName===R.tableCellInner){var r=null;try{r=H(this,R.tableCellInner);var i=r.formats(),a=n.formats();if(yr(i,a))return r}catch(e){}if(r)r.insertBefore(n,this),n.appendChild(this),r.children.length===0&&r.remove();else{for(var o=this,s=o;o.parent!==this.scroll&&o.parent instanceof Cr;)s=o,o=o.parent;o===this.scroll&&(o=s);var c=this.offset(o),l=this.length(),u=o.isolate(c,l);u&&u.parent&&u.parent.insertBefore(n,u.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===R.tableCellInner&&this.parent.statics.blotName===e&&!n){if(this.prev&&this.prev instanceof Sr)return;try{var r=H(this,R.tableCellInner);r.unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}}else I(t,`format`,this,3)([e,n])}}])}(xr),Tr=t.default.import(`blots/block/embed`),Er=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=Dr(this);return n[R.tableCellInner]&&e.insert(`
|
|
5
|
+
`,S({},R.tableCellInner,n[R.tableCellInner])),e}},{key:`length`,value:function(){var e=Dr(this);return e[R.tableCellInner]?I(t,`length`,this,3)([])+1:I(t,`length`,this,3)([])}},{key:`formatAt`,value:function(e,t,n,r){if(n===R.tableCellInner)try{var i=H(this,R.tableCellInner),a=this.scroll.create(R.tableCellInner,r);i.insertBefore(a,this),a.appendChild(this),i.length()===0&&i.remove()}catch(e){}else this.format(n,r)}}])}(Tr);function Dr(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:Dr(e.parent,t,n)}var q=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:`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!==R.tableMain){var r=this.tableId;this.wrap(R.tableMain,{tableId:r})}I(t,`optimize`,this,3)([e])}},{key:`convertBody`,value:function(e){var t=this.descendants(J),n=x(t),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.wrapTag=e}}catch(e){n.e(e)}finally{n.f()}}},{key:`getRows`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`tr`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e,n}}])}(K);S(q,`blotName`,R.tableBody),S(q,`tagName`,`tbody`);var Or=t.default.import(`blots/block`),kr=t.default.import(`blots/block/embed`),J=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,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r){if(!this.statics.isAllowStyle(e))return}else I(t,`setFormatValue`,this,3)([e,n]);this.parent&&this.parent.statics.blotName===R.tableCell&&this.parent.setFormatValue(e,n),this.clearCache()}},{key:`clearCache`,value:function(){var e=this.descendants(Or,0),t=x(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;r.cache={}}}catch(e){t.e(e)}finally{t.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:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`},set:function(e){this.setFormatValue(`wrap-tag`,e)}},{key:`getColumnIndex`,value:function(){var e=H(this,R.tableMain);return e.getColIds().indexOf(this.colId)}},{key:`getTableBody`,value:function(){for(var e=this.parent;e&&!(e instanceof q)&&e!==this.scroll;)e=e.parent;return e===this.scroll?null:e}},{key:`getTableRow`,value:function(){try{return H(this,R.tableRow)}catch(e){return null}}},{key:`setStyleByString`,value:function(e){for(var t=dr(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:`convertTableCell`,value:function(){this.parent.statics.blotName===R.tableCell&&(this.parent.convertTableCell(),this.clearCache())}},{key:`formatAt`,value:function(e,n,r,i){if(this.children.length===0){var a=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(a),n+=a.length()}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]);var c=r==null?this.scroll.create(`text`,n):this.scroll.create(n,r);c instanceof kr&&o&&o.length()<=1&&o.remove()}},{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 kr){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!==R.tableCell;if(i&&(this.wrap(R.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=yr(a,i);if(o){var s=this.split(n?n.offset():0);return this.parent.insertBefore(r,s)}else{var c=he(this,[R.tableRow,R.tableCell]),l=F(c,2),u=l[0],d=l[1],f=d;if(n){var p=n.offset(),m=this.length();if(p!==0&&p<m){var h=this.split(p),g=h.wrap(R.tableCell,a);u.insertBefore(g,d.next),f=g}}if(this.tableId!==r.tableId){var _=H(this,R.tableWrapper),v=this.offset(_),y=_.split(v);return _.parent.insertBefore(r,y)}if(this.rowId!==r.rowId){var b=u,x=n;if(x){var S=x.offset(u);b=u.split(S)}var C=this.scroll.create(R.tableRow,i),w=this.scroll.create(R.tableCell,i);return w.appendChild(r),C.appendChild(w),u.parent.insertBefore(C,b)}return u.insertBefore(r.wrap(R.tableCell,i),f)}}else if(e.statics.blotName===R.tableCol){try{var T=H(this,R.tableBody),E=this.offset(T),D=T.split(E);T.parent.insertBefore(e,D),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=lr(e),n=x(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(lr(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=e.tag,u=l===void 0?`td`:l,d=e.wrapTag,f=d===void 0?`tbody`:d,p=I(t,`create`,this,2)([]);p.dataset.tableId=n,p.dataset.rowId=r,p.dataset.colId=i,p.dataset.rowspan=String(vr(a)),p.dataset.colspan=String(vr(o)),p.dataset.tag=u,p.dataset.wrapTag=f,s&&(p.dataset.style=s);try{c&&(p.dataset.emptyRow=JSON.stringify(c))}catch(e){}return p}},{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=t.tag,u=l===void 0?`td`:l,d=t.wrapTag,f=d===void 0?`tbody`:d,p={tableId:String(n),rowId:String(r),colId:String(i),rowspan:Number(vr(a)),colspan:Number(vr(o)),tag:u,wrapTag:f};s&&(p.style=s);try{c&&(p.emptyRow=JSON.parse(c))}catch(e){}return p}}])}(K);S(J,`blotName`,R.tableCellInner),S(J,`tagName`,`div`),S(J,`className`,`ql-table-cell-inner`),S(J,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`rowspan`,`colspan`,`empty-row`,`wrap-tag`])),S(J,`defaultChild`,Or),S(J,`allowStyle`,new Set([`background-color`,`border`,`height`]));var Ar=t.default.import(`parchment`),jr=t.default.import(`blots/scroll`),Mr=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/${R.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/${R.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[R.tableCellInner])n=R.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,Ar.Scope.BLOCK&Ar.Scope.BLOT)!=null;l?n=s:r[s]=c}n===R.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 J&&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}}])}(jr),Nr=`<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
|
|
8
8
|
fill="none"\r
|
|
@@ -13,11 +13,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
13
13
|
d="M7 3v18m3-15L7 3L4 6m16 12l-3 3l-3-3m3 3V3"\r
|
|
14
14
|
/>\r
|
|
15
15
|
</svg>\r
|
|
16
|
-
`,Sr=t.default.import(`parchment`),Cr=t.default.import(`blots/inline`),wr=t.default.import(`blots/text`),Tr=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.attachUI(i.createUI()),i.domNode.addEventListener(`mouseenter`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`flex`)}),i.domNode.addEventListener(`mouseleave`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`none`)}),i.uiNode.style.display=`none`,i}return T(t,e),b(t,[{key:`createUI`,value:function(){var e=this,t=document.createElement(`i`);return t.classList.add(`ql-table-caption--switch`),t.innerHTML=xr,t.addEventListener(`click`,function(){e.scroll.isEnabled()&&(e.side=e.side===`top`?`bottom`:`top`)}),t}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`side`,get:function(){return this.domNode.style.captionSide===`bottom`?`bottom`:`top`},set:function(e){this.domNode.style.captionSide=e===`bottom`?`bottom`:`top`}},{key:`format`,value:function(e,n){var r=this.scroll.query(e,Sr.Scope.BLOCK_BLOT);(!r||e===this.statics.blotName)&&I(t,`format`,this,3)([e,n])}},{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!==R.tableMain){var r=this.tableId;this.wrap(R.tableMain,{tableId:r})}this.children.length===0?this.remove():(I(t,`optimize`,this,3)([e]),this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()))}}],[{key:`create`,value:function(e){var n=e.tableId,r=I(t,`create`,this,2)([]);return r.dataset.tableId=n,e.side===`bottom`&&(r.style.captionSide=`bottom`),r}},{key:`formats`,value:function(e){var t=e.dataset.tableId,n={tableId:String(t),side:e.style.captionSide===`bottom`?`bottom`:`top`};return n}}])}(fr);S(Tr,`blotName`,R.tableCaption),S(Tr,`tagName`,`caption`),S(Tr,`className`,`ql-table-caption`),S(Tr,`allowedChildren`,[Cr,wr]);var Y=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:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`}},{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,R.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===R.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(R.tableCell,t),l=this.scroll.create(R.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(J),s=F(o,1),c=s[0];if(r.colspan!==1&&e===i-r.colspan){var l=H(this,R.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(J),a=F(i,1),o=a[0];if(o&&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:`wrapParentTag`,value:function(){var e={thead:R.tableHead,tbody:R.tableBody,tfoot:R.tableFoot},t=this.parent;if(t!==null&&t.statics.blotName!==e[this.wrapTag])if(Object.values(e).includes(t.statics.blotName)){var n=this.offset(this.parent),r=this.parent.split(n);r&&r.length()<=0&&r.remove();var i=this.parent.splitAfter(this);i&&i.length()<=0&&i.remove(),this.parent.replaceWith(e[this.wrapTag],this.tableId)}else this.wrap(e[this.wrapTag],this.tableId)}},{key:`optimize`,value:function(e){this.wrapParentTag(),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=e.tableId,r=e.rowId,i=e.wrapTag,a=i===void 0?`tbody`:i,o=I(t,`create`,this,2)([]);return o.dataset.tableId=n,o.dataset.rowId=r,o.dataset.wrapTag=a,o}}])}(K);S(Y,`blotName`,R.tableRow),S(Y,`tagName`,`tr`),S(Y,`className`,`ql-table-row`),S(Y,`allowDataAttrs`,new Set([`table-id`,`row-id`,`wrap-tag`])),S(Y,`allowDataAttrsChangeHandler`,{"wrap-tag":`wrapParentTag`});var X=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`isChildHeadTableCellInner`,value:function(){var e=this.children.head;return e&&e.statics.blotName===R.tableCellInner}},{key:`setFormatValue`,value:function(e,t){if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var n=e;this.statics.allowDataAttrs.has(e)&&(n=`data-${e}`),t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n)}else this.statics.isAllowStyle(e)&&(Object.assign(this.domNode.style,S({},e,t)),e.startsWith(`border`)&&this.setStyleBoder(e,t));var r=this.children.head;this.isChildHeadTableCellInner()&&this.domNode.style.cssText&&this.domNode.style.cssText!==r.domNode.dataset.style&&(r.domNode.dataset.style=this.domNode.style.cssText),this.parent&&this.parent.statics.blotName===R.tableRow&&this.parent.setFormatValue(e,t)}},{key:`setStyleBoder`,value:function(e,t){var n=t||null,r=![`left`,`right`,`top`,`bottom`].some(function(t){return e.includes(t)})&&e.startsWith(`border-`);if(r){var i=this.getNearByCell(`left`).map(function(e){return e.descendant(J,0)[0]}).filter(Boolean),a=x(i),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;s.setFormatValue(e.replace(`border-`,`border-right-`),n,!0)}}catch(e){a.e(e)}finally{a.f()}var c=this.getNearByCell(`top`).map(function(e){return e.descendant(J,0)[0]}).filter(Boolean),l=x(c),u;try{for(l.s();!(u=l.n()).done;){var d=u.value;d.setFormatValue(e.replace(`border-`,`border-bottom-`),n,!0)}}catch(e){l.e(e)}finally{l.f()}}}},{key:`getNearByCell`,value:function(e){var t=[];try{var n=H(this,R.tableMain);t.push.apply(t,L(n.getColIds()))}catch(e){console.error(`Cell is not in table! ${e}`)}if(t.length===0)return[];if(e===`left`){for(var r=new Set,i=this.parent,a=0;a<this.rowspan&&i instanceof Y;a++){for(var o=i.children.iterator(),s=null;s=o();){var c=t.indexOf(s.colId)+s.colspan;this.colId===t[c]&&r.add(s)}i=i.next}return Array.from(r)}else if(e===`top`){if(!(this.parent instanceof Y)||!this.parent.prev)return[];for(var l=new Set,u=this.getColumnIndex(),d=u+this.colspan,f=new Set(t.filter(function(e,t){return t>=u&&t<d})),p=1,m=this.parent.prev;m;){for(var h=!1,g=m.children.iterator(),_=null,v=0;_=g();)f.has(_.colId)&&_.rowspan>=p&&(l.add(_),f.delete(_.colId)),v+=_.colspan,_.rowspan>=p&&(h=!0);if(!h&&v===t.length)break;m=m.prev,p+=1}return Array.from(l)}return[]}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`rowspan`,get:function(){return Number(this.domNode.getAttribute(`rowspan`))}},{key:`colspan`,get:function(){return Number(this.domNode.getAttribute(`colspan`))}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}}},{key:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`}},{key:`getColumnIndex`,value:function(){var e=H(this,R.tableMain);return e.getColIds().indexOf(this.colId)}},{key:`getCellInner`,value:function(){return this.children.head}},{key:`convertTableCell`,value:function(){var e=this.statics.formats(this.domNode),t=e.tag===`td`?`th`:`td`,n=this.children.head;this.isChildHeadTableCellInner()&&n.domNode.dataset.tag!==t&&(n.domNode.dataset.tag=t),this.replaceWith(R.tableCell,M(M({},e),{},{tag:t}))}},{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(e){var n=this.tableId,r=this.rowId,i=this.wrapTag;if(this.parent!==null&&this.parent.statics.blotName!==R.tableRow&&this.wrap(R.tableRow,{tableId:n,rowId:r,wrapTag:i}),this.parent.statics.blotName===R.tableRow&&this.parent.wrapTag!==i&&this.parent.setFormatValue(`wrap-tag`,this.wrapTag),this.emptyRow.length>0){var a=x(this.emptyRow),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;this.parent.parent.insertBefore(this.scroll.create(R.tableRow,{tableId:n,rowId:s,wrapTag:i}),this.parent.next)}}catch(e){a.e(e)}finally{a.f()}}I(t,`optimize`,this,3)([e])}}],[{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 t,n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=e.tag,u=l===void 0?`td`:l,d=e.wrapTag,f=d===void 0?`tbody`:d,p=document.createElement(u);(t=p.classList).add.apply(t,L(Pe(this.className))),p.dataset.tableId=n,p.dataset.rowId=r,p.dataset.colId=i,p.dataset.wrapTag=f,p.setAttribute(`rowspan`,String(sr(a))),p.setAttribute(`colspan`,String(sr(o))),s&&(p.style.cssText=s);try{c&&(p.dataset.emptyRow=JSON.stringify(c))}catch(e){}return p}},{key:`formats`,value:function(e){var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.emptyRow,o=t.wrapTag,s=o===void 0?`tbody`:o,c=Number(e.getAttribute(`rowspan`)),l=Number(e.getAttribute(`colspan`)),u={tableId:n,rowId:r,colId:i,rowspan:sr(c),colspan:sr(l),tag:e.tagName.toLowerCase(),wrapTag:s},d=$n(e),f=Object.entries(d).filter(function(e){var t=F(e,2),n=t[1];return![`initial`,`inherit`].includes(n)});f.length>0&&(u.style=f.map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${n}: ${r}`}).join(`;`));try{a&&(u.emptyRow=JSON.parse(a))}catch(e){}return u}}])}(K);S(X,`blotName`,R.tableCell),S(X,`tagName`,`td`),S(X,`className`,`ql-table-cell`),S(X,`allowAttrs`,new Set([`rowspan`,`colspan`])),S(X,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`empty-row`,`wrap-tag`])),S(X,`allowStyle`,new Set([`background-color`,`border`,`height`]));var Er=t.default.import(`blots/block/embed`),Dr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`width`,get:function(){var e=this.domNode.getAttribute(`width`);if(!e){if(e=this.domNode.getBoundingClientRect().width,this.full){var t=this.domNode.closest(`table`);return t?e/100*t.getBoundingClientRect().width:z[this.full?`colMinWidthPre`:`colMinWidthPx`]}return e}return Number.parseFloat(String(e))},set:function(e){var t=Number.parseFloat(String(e));Number.isNaN(t)&&(t=z[this.full?`colMinWidthPre`:`colMinWidthPx`]),this.domNode.setAttribute(`width`,this.statics.validWidth(t,!!this.full))}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`checkMerge`,value:function(){var e=this.next,t=this.tableId,n=this.colId;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===t&&e.colId===n}},{key:`optimize`,value:function(e){var n=this.parent;if(n!=null&&n.statics.blotName!==R.tableColgroup){var r=this.statics.value(this.domNode);this.wrap(R.tableColgroup,r)}var i=H(this,R.tableColgroup);i.align=this.align,this.next!=null&&this.checkMerge()&&this.next.remove(),I(t,`optimize`,this,3)([e]);try{var a=H(this,R.tableColgroup),o=!0;a.children.forEach(function(e){o&&(o=e.full)}),a.full=o}catch(e){}}},{key:`insertAt`,value:function(e,n,r){if(r!=null){I(t,`insertAt`,this,3)([e,n,r]);return}try{var i=n.split(`
|
|
17
|
-
`),a=i.pop(),o=H(this,R.tableColgroup),s=o.next,c=this.scroll,l=o.split(this.offset(o));if(s){var u=s.descendants(J);if(u.length>0){var d=u[0],f=J.formats(d.domNode),p=this.scroll.create(R.tableCellInner,f),m=p.wrap(R.tableCell,f),h=m.wrap(R.tableRow,f),g=h.wrap(R.tableBody,f.tableId);o.parent.insertBefore(g,l),c=p}}var _=x(i),v;try{for(_.s();!(v=_.n()).done;){var y=v.value,b=this.scroll.create(`block`);b.insertAt(0,y),c.appendChild(b)}}catch(e){_.e(e)}finally{_.f()}if(a){var S=this.scroll.create(`block`);S.appendChild(this.scroll.create(`text`,a)),c.appendChild(S)}}catch(e){console.warn(`TableCol not in TableColgroup`)}}}],[{key:`validWidth`,value:function(e,t){var n=Number.parseFloat(String(e));return Number.isNaN(n)&&(n=z[t?`colMinWidthPre`:`colMinWidthPx`]),`${n}${t?`%`:`px`}`}},{key:`create`,value:function(e){var n=e.width,r=e.tableId,i=e.colId,a=e.full,o=e.align,s=I(t,`create`,this,2)([]);return s.setAttribute(`width`,this.validWidth(n,!!a)),a&&(s.dataset.full=String(a)),o&&o!==`left`&&(s.dataset.align=o),s.dataset.tableId=r,s.dataset.colId=i,s}},{key:`value`,value:function(e){var t=e.dataset,n=t.tableId,r=t.colId,i=e.getAttribute(`width`)||String(z.colDefaultWidth),a=e.dataset.align,o=Object.hasOwn(e.dataset,`full`),s={tableId:String(n),colId:String(r),full:o,width:Number.parseFloat(i)};return a&&(s.align=a),s}}])}(Er);S(Dr,`blotName`,R.tableCol),S(Dr,`tagName`,`col`);var Z=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n]),S(i,`scroll`,void 0),i.scroll=e,i.updateAlign(),i}return T(t,e),b(t,[{key:`colWidthFillTable`,value:function(){if(this.full){Object.assign(this.domNode.style,{width:null});return}var e=this.getCols();if(e){var t=e.reduce(function(e,t){return t.width+e},0);if(!(t===0||Number.isNaN(t)))return this.domNode.style.width=`${t}px`,t}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.colWidthFillTable()}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`),this.updateAlign()}},{key:`setFull`,value:function(){if(!this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.width/t*100;i.full=!0,i.width=a}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`cancelFull`,value:function(){if(this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.full=!1,i.width=Math.max(i.width/100*t,z.colMinWidthPx)}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`updateAlign`,value:function(){var e=this.align,t={marginLeft:null,marginRight:null};switch(e){case`center`:t.marginLeft=`auto`,t.marginRight=`auto`;break;case``:case`left`:t.marginRight=`auto`;break;case`right`:t.marginLeft=`auto`;break;default:break}Object.assign(this.domNode.style,t)}},{key:`getBodys`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`thead, tbody, tfoot`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRows`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`tr`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRowIds`,value:function(){return this.getRows().map(function(e){return e.rowId})}},{key:`getCols`,value:function(){return this.descendants(Dr)}},{key:`getColIds`,value:function(){return this.getCols().map(function(e){return e.colId})}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.domNode.dataset.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;n!==null&&n.statics.blotName!==R.tableWrapper&&this.wrap(R.tableWrapper,this.tableId),I(t,`optimize`,this,3)([e]),this.mergeRow()}},{key:`mergeRow`,value:function(){if(this.parent){var e=this.getRows(),t={},n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t[i.rowId]||(t[i.rowId]=[]),t[i.rowId].push(i)}}catch(e){n.e(e)}finally{n.f()}for(var a=0,o=Object.values(t);a<o.length;a++)for(var s=o[a],c=1;c<s.length;c++){var l=s[c];l.moveChildren(s[0]),l.remove()}}}},{key:`checkEmptyCol`,value:function(e){if(e){var t=this.getRows().length,n=this.getCols(),r=this.descendants(J),i=x(r),a;try{var o=function(){var e=a.value;if(e.colspan>1&&e.rowspan>=t){for(var r=n.findIndex(function(t){return t.colId===e.colId}),i=n[r],o=r+1;o<r+e.colspan;o++)n[o].remove(),i.width+=n[o].width;e.colspan=1}};for(i.s();!(a=i.n()).done;)o()}catch(e){i.e(e)}finally{i.f()}}}},{key:`checkEmptyRow`,value:function(e){for(var t=this,n=this.getRows(),r=new Set(n.map(function(e){return e.rowId})),i=function(){var i=n[a];if(e){if(i.children.length===0){for(var o=function(e){var t=n[c];t.foreachCellInner(function(t){if(t.rowspan>e){--t.rowspan;var n=new Set(t.emptyRow);n.delete(i.rowId),t.emptyRow=Array.from(n)}})},s=1,c=a-1;c>=0;c--,s++)o(s);i.remove()}}else{if(i.children.length===0&&i.prev){for(var l=i.prev;l&&l.children.length===0;)l=l.prev;l.foreachCellInner(function(e){var t=new Set(e.emptyRow);t.has(i.rowId)||(e.emptyRow=[i.rowId].concat(L(t)))})}i.foreachCellInner(function(e){var n=x(e.emptyRow),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;r.has(o)||i.parent.insertBefore(t.scroll.create(R.tableRow,{tableId:t.tableId,rowId:o}),i.next)}}catch(e){n.e(e)}finally{n.f()}})}},a=n.length-1;a>=0;a--)i()}},{key:`sortMergeChildren`,value:function(){var e=S(S(S(S(S({},R.tableCaption,[]),R.tableColgroup,[]),R.tableHead,[]),R.tableBody,[]),R.tableFoot,[]);this.children.forEach(function(t){e[t.statics.blotName]&&e[t.statics.blotName].push(t)});for(var t=0,n=Object.values(e);t<n.length;t++)for(var r=n[t],i=1;i<r.length;i++)r[i].moveChildren(r[0]);var a=e[R.tableCaption][0],o=e[R.tableColgroup][0],s=e[R.tableHead][0],c=e[R.tableBody][0],l=e[R.tableFoot][0],u=a&&this.children.head!==a,d=o&&a&&a.next!==o,f=o&&!a&&this.children.head!==o,p=s&&!c&&!l&&this.children.tail!==s,m=c&&s&&c.prev!==s,h=c&&!l&&this.children.tail!==c,g=c&&l&&c.next!==l,_=l&&this.children.tail!==l;if(u||d||f||p||m||h||g||_){var v=this.clone();a&&v.appendChild(a),o&&v.appendChild(o),s&&v.appendChild(s),c&&v.appendChild(c),l&&v.appendChild(l),this.children.forEach(function(e){return e.remove()}),v.moveChildren(this)}}},{key:`insertRow`,value:function(e){var t=this.getColIds(),n=this.descendants(Y),r=new Set(t),i=0,a=x(n),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(i===e)break;s.foreachCellInner(function(n){if(i+n.rowspan>e&&(n.rowspan+=1,r.delete(n.colId),n.colspan!==1))for(var a=t.indexOf(n.colId),o=0;o<n.colspan-1;o++)r.delete(t[a+o+1])}),i+=1}}catch(e){a.e(e)}finally{a.f()}var c=this.tableId,l=G(),u=this.scroll.create(R.tableRow,{tableId:c,rowId:l}),d=x(r),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=this.scroll.create(`break`),h=m.wrap(`block`),g=h.wrap(R.tableCellInner,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1}),_=g.wrap(R.tableCell,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1});u.appendChild(_)}}catch(e){d.e(e)}finally{d.f()}var v=n[e]||null;v?v.parent.insertBefore(u,v):n[n.length-1].parent.appendChild(u)}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]),r=e.tableId,i=e.full,a=e.align;return n.dataset.tableId=r,a===`right`||a===`center`?n.dataset.align=a:n.removeAttribute(`date-align`),i&&(n.dataset.full=String(i)),n.setAttribute(`cellpadding`,`0`),n.setAttribute(`cellspacing`,`0`),n}}])}(K);S(Z,`blotName`,R.tableMain),S(Z,`tagName`,`table`),S(Z,`className`,`ql-table`);var Or=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:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.parent&&this.parent instanceof Z&&(this.parent.full=e)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`findCol`,value:function(e){for(var t=this.children.iterator(),n=0,r;(r=t())&&n!==e;)n++;return r}},{key:`insertColByIndex`,value:function(e,t){var n=this.parent;if(!(n instanceof Z))throw TypeError(`TableColgroupFormat should be child of TableFormat`);var r=this.findCol(e),i=this.scroll.create(R.tableCol,t);if(n.full){for(var a=this.children.iterator(),o;o=a();)if(o.width-i.width>=z.colMinWidthPre){o.width-=i.width;break}}this.insertBefore(i,r)}},{key:`removeColByIndex`,value:function(e){var t=this.parent;if(!(t instanceof Z))throw TypeError(`TableColgroupFormat should be child of TableMainFormat`);var n=this.findCol(e);n&&(t.full&&(n.next?n.next.width+=n.width:n.prev&&(n.prev.width+=n.width)),n.remove(),t.colWidthFillTable())}},{key:`checkMerge`,value:function(){var e=this.next,t=this.parent;return t instanceof Z&&!t.full&&t.colWidthFillTable(),e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent,r=this.tableId,i=this.full,a=this.align;n!=null&&n.statics.blotName!==R.tableMain&&this.wrap(R.tableMain,{tableId:r,full:i,align:a});var o=H(this,R.tableMain);o.align=a,I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,e.full&&(n.dataset.full=String(e.full)),e.align&&e.align!==`left`&&(n.dataset.align=e.align),n.setAttribute(`contenteditable`,`false`),n}}])}(K);S(Or,`blotName`,R.tableColgroup),S(Or,`tagName`,`colgroup`);var kr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t)}(q);S(kr,`blotName`,R.tableFoot),S(kr,`tagName`,`tfoot`);var Ar=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t)}(q);S(Ar,`blotName`,R.tableHead),S(Ar,`tagName`,`thead`);var jr=t.default.import(`parchment`),Mr=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`scroll`,void 0),S(a,`insertLineAround`,function(){(!a.prev||!a.isBlockLine(a.prev))&&a.parent.insertBefore(a.scroll.create(`block`),a),(!a.next||!a.isBlockLine(a.next))&&a.parent.insertBefore(a.scroll.create(`block`),a.next)}),a.scroll=e,a.scroll.emitter.on(t.default.events.TEXT_CHANGE,a.insertLineAround),a}return T(n,e),b(n,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`deleteAt`,value:function(e,t){I(n,`deleteAt`,this,3)([e,t]);var r=this.descendants(q),i=this.descendants(Or);(r.length===0||i.length===0)&&this.remove()}},{key:`remove`,value:function(){I(n,`remove`,this,3)([]),this.scroll.emitter.off(t.default.events.TEXT_CHANGE,this.insertLineAround)}},{key:`isBlockLine`,value:function(e){return e instanceof jr.BlockBlot||new Set([`list-container`,`code-block-container`]).has(e.statics.blotName)}}],[{key:`create`,value:function(e){var t=I(n,`create`,this,2)([]);return t.dataset.tableId=e,t.addEventListener(`dragstart`,function(e){e.preventDefault(),e.stopPropagation()},!0),t.addEventListener(`drop`,function(e){e.preventDefault()}),t.addEventListener(`dragover`,function(e){e.preventDefault(),e.dataTransfer.dropEffect=`none`}),t.setAttribute(`contenteditable`,`false`),t}}])}(K);S(Mr,`blotName`,R.tableWrapper),S(Mr,`tagName`,`div`),S(Mr,`className`,`ql-table-wrapper`);function Nr(e){for(var t=new Set([R.tableHead,R.tableBody,R.tableFoot]),n=e.children.iterator(),r=null,i={};r=n();)t.has(r.statics.blotName)&&(i[r.statics.blotName]=r);if(Object.values(i).length<=0)return{rect:null,head:null,body:null,foot:null};var a=Object.values(i).reduce(function(e,t){var n=t.domNode.getBoundingClientRect();return M(M({},e),{},{top:Math.min(e.top,n.top),bottom:Math.max(e.bottom,n.bottom),left:Math.min(e.left,n.left),right:Math.max(e.right,n.right)})},{top:1/0,bottom:0,left:1/0,right:0,width:0,height:0,x:1/0,y:1/0});return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,{rect:a,head:i[R.tableHead]||null,body:i[R.tableBody]||null,foot:i[R.tableFoot]||null}}var Pr=function(){function e(t,n){v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`table`,void 0),this.tableModule=t,this.quill=n,this.quill.root.addEventListener(`mousedown`,this.tableSelectHandler.bind(this))}return b(e,[{key:`tableSelectHandler`,value:function(e){var t=e.composedPath();if(!(e.button!==0||!t||t.length<=0)){var n=t.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`});this.setSelectionTable(n)}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.hide(),this.table=e,this.table&&this.show(),this.update())}},{key:`hide`,value:function(){}},{key:`show`,value:function(){}},{key:`update`,value:function(){}}])}(),Fr=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`tableBlot`,void 0),S(a,`tableWrapperBlot`,void 0),S(a,`alignBox`,void 0),S(a,`cleanup`,void 0),S(a,`bem`,V(`align`)),S(a,`resizeObserver`,void 0),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r,a.alignBox=a.buildTools(),a.hide(),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{key:`buildTools`,value:function(){for(var e=this.tableModule.addContainer(this.bem.b()),n=t.default.import(`ui/icons`),r={left:n.align[``],center:n.align.center,right:n.align.right},i=0,a=Object.entries(r);i<a.length;i++){var o=F(a[i],2),s=o[0],c=o[1],l=document.createElement(`span`);l.dataset.align=s,l.classList.add(this.bem.be(`item`)),l.innerHTML=`<i class="icon">${c}</i>`,l.addEventListener(`click`,this.handleAlignItemClick.bind(this)),e.appendChild(l)}return e}},{key:`handleAlignItemClick`,value:function(e){var t=e.currentTarget;if(t){var n=t.dataset.align;n&&this.tableBlot&&this.setTableAlign(this.tableBlot,n)}}},{key:`setTableAlign`,value:function(e,t){var n=e.getCols(),r=x(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a.align=t}}catch(e){r.e(e)}finally{r.f()}}},{key:`show`,value:function(){var e=this;!this.table||!this.alignBox||(this.tableBlot=t.default.find(this.table),this.tableWrapperBlot=this.tableBlot.parent,this.alignBox.classList.remove(this.bem.is(`hidden`)),this.resizeObserver=Kn(function(){return e.update()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.table),this.cleanup&&this.cleanup(),this.cleanup=Mn(this.tableWrapperBlot.domNode,this.alignBox,function(){return e.update()}))}},{key:`hide`,value:function(){this.tableBlot=void 0,this.tableWrapperBlot=void 0,this.alignBox&&this.alignBox.classList.add(this.bem.is(`hidden`)),this.cleanup&&(this.cleanup(),this.cleanup=void 0)}},{key:`update`,value:function(){var e=this;if(!(!this.alignBox||!this.tableBlot||!this.tableWrapperBlot)){if(!this.table||this.tableBlot.full||this.tableBlot.domNode.offsetWidth>=this.quill.root.offsetWidth){this.hide();return}Ln(this.tableWrapperBlot.domNode,this.alignBox,{placement:`top`,middleware:[Fn(),Pn({limiter:In()}),Nn(16)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.alignBox.style,{left:`${n}px`,top:`${r}px`})})}}},{key:`destroy`,value:function(){this.hide(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.alignBox&&(this.alignBox.remove(),this.alignBox=null)}}])}(Pr);S(Fr,`moduleName`,`table-align`);var Ir=[`style`],Lr=[`attributes`],Rr=[`attributes`],zr=[`background`],Br=t.default.import(`delta`),Vr=t.default.import(`modules/clipboard`);function Hr(e){var t=Number.parseFloat(e.getAttribute(`width`)||String(z.colDefaultWidth));if(Number.isNaN(t)){var n=e.style.width;t=n?Number.parseFloat(n):e.offsetWidth}return t}function Ur(e,t){for(var n=Array(t).fill(z.colDefaultWidth),r=Array.from(e.querySelectorAll(`tr`)),i=0,a=r;i<a.length;i++){var o=a[i],s=Array.from(o.querySelectorAll(`td`)),c=x(s.entries()),l;try{for(c.s();!(l=c.n()).done;){var u=F(l.value,2),d=u[0],f=u[1];if(d<t){var p=Hr(f);n[d]=p||n[d]}else break}}catch(e){c.e(e)}finally{c.f()}}return n}var Wr=function(e){function t(e,n){var r;return v(this,t),r=_(this,t,[e,n]),S(r,`quill`,void 0),S(r,`tableId`,G()),S(r,`rowId`,G()),S(r,`colIds`,[]),S(r,`rowspanCount`,[]),S(r,`cellCount`,0),S(r,`colCount`,0),r.quill=e,r.addMatcher(`table`,r.matchTable.bind(r)),r.addMatcher(`thead`,r.matchThead.bind(r)),r.addMatcher(`tbody`,r.matchTbody.bind(r)),r.addMatcher(`tfoot`,r.matchTfoot.bind(r)),r.addMatcher(`colgroup`,r.matchColgroup.bind(r)),r.addMatcher(`col`,r.matchCol.bind(r)),r.addMatcher(`tr`,r.matchTr.bind(r)),r.addMatcher(`td`,r.matchTd.bind(r)),r.addMatcher(`th`,r.matchTd.bind(r)),r.addMatcher(`caption`,r.matchCaption.bind(r)),r.addMatcher(Node.ELEMENT_NODE,r.matchTdAttributor.bind(r)),r}return T(t,e),b(t,[{key:`getStyleBackgroundColor`,value:function(e,t){var n=e.style.backgroundColor;if(n){var r=x(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner],c=s.style,l=N(s,Ir),u=er(c||``);u.backgroundColor||(u.backgroundColor=n,o.attributes[R.tableCellInner]=M(M({},l),{},{style:tr(u)}))}}}catch(e){r.e(e)}finally{r.f()}}}},{key:`matchTable`,value:function(e,t){var n=this;if(t.ops.length===0)return t;for(var r=[],i=[],a=-1,o=0;o<t.ops.length;o++){var s=t.ops[o],c=s.attributes,l=s.insert;if(!Me(l)&&(!c||!c[R.tableCellInner]&&!c[R.tableCaption])){t.ops.splice(o,1),--o;continue}var u=c||{},d=R.tableCell,f=u.table,p=u[d],m=N(u,[`table`,d].map(ae)),h=Me(l)&&l[R.tableCol];h?i.push({insert:l}):r.push({attributes:m,insert:l}),!(m!=null&&m[R.tableCellInner])&&!(m!=null&&m[R.tableCaption])&&!h&&Ae(l)&&l.trim().length>0&&(a=o)}var g=Ur(e,this.colIds.length),_=g.reduce(function(e,t,r){return i[r]?e.push(i[r]):e.push({insert:S({},R.tableCol,{tableId:n.tableId,colId:n.colIds[r],width:t,full:!1})}),e},[]);r.splice.apply(r,[a+1,0].concat(L(_)));var v=new Br(r);return this.getStyleBackgroundColor(e,v),this.tableId=G(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,v}},{key:`matchTbody`,value:function(e,t){this.getStyleBackgroundColor(e,t);for(var n=[],r=t.ops.length-1;r>=0;r--){var i,a=t.ops[r];if(!((i=a.attributes)!=null&&i[R.tableCellInner]))n=[],n.push(G());else if(a.attributes){if(a.attributes[R.tableCellInner].rowspan===1)n=[];else if(n.length>0){var o;a.attributes[R.tableCellInner].emptyRow||(a.attributes[R.tableCellInner].emptyRow=[]),(o=a.attributes[R.tableCellInner].emptyRow).push.apply(o,L(n))}}}return this.rowspanCount=[],t}},{key:`matchThead`,value:function(e,t){var n=this.matchTbody(e,t),r=x(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(a.attributes&&a.attributes[R.tableCellInner]){var o=a.attributes[R.tableCellInner];o.wrapTag=`thead`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchTfoot`,value:function(e,t){var n=this.matchTbody(e,t),r=x(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(a.attributes&&a.attributes[R.tableCellInner]){var o=a.attributes[R.tableCellInner];o.wrapTag=`tfoot`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchColgroup`,value:function(e,t){for(var n=[],r=0;r<t.ops.length;r++){var i=t.ops[r];i&&Me(i.insert)&&i.insert[R.tableCol]&&n.push(i)}return new Br(n)}},{key:`matchCol`,value:function(e,t){var n=Number(e.getAttribute(`span`)||1);Number.isNaN(n)&&(n=1);for(var r=new Br,i=0;i<n;i++)this.colIds[this.colCount]=G(),r.insert(S({},R.tableCol,Object.assign(Dr.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]}))),this.colCount+=1;return r}},{key:`matchTr`,value:function(e,t){this.rowId=G(),this.cellCount=0;var n=x(this.rowspanCount.entries()),r;try{for(n.s();!(r=n.n()).done;){var i=F(r.value,2),a=i[0],o=i[1];o.rowspan>0&&--o.rowspan,o.rowspan<=0&&(this.rowspanCount[a]={rowspan:0,colspan:0})}}catch(e){n.e(e)}finally{n.f()}return this.getStyleBackgroundColor(e,t),t.ops.length===0?new Br([{insert:`
|
|
18
|
-
`}]):t}},{key:`matchTd`,value:function(e,t){var n=e,r=X.formats(n);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(var i=this.cellCount;i>=0;i--)this.colIds[i]||(this.colIds[i]=G()),this.rowspanCount[i]||(this.rowspanCount[i]={rowspan:0,colspan:0});for(var a=this.cellCount;a<this.rowspanCount.length;a++){var o=this.rowspanCount[a],s=o.rowspan,c=o.colspan;if(s===0)break;this.cellCount+=c}r.rowspan>1&&(this.rowspanCount[this.cellCount]={rowspan:r.rowspan,colspan:r.colspan});var l=this.colIds[this.cellCount];this.cellCount+=r.colspan;var u=Object.assign(r,{tableId:this.tableId,rowId:this.rowId,colId:l});n.style.border===`none`&&(u.style=u.style.replaceAll(RegExp(`border-(top|right|bottom|left)-style:none;?`,`g`),``));var d=[],f=x(t.ops),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.attributes,g=h===void 0?{}:h,_=N(m,
|
|
16
|
+
`,Pr=t.default.import(`parchment`),Fr=t.default.import(`blots/inline`),Ir=t.default.import(`blots/text`),Lr=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.attachUI(i.createUI()),i.domNode.addEventListener(`mouseenter`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`flex`)}),i.domNode.addEventListener(`mouseleave`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`none`)}),i.uiNode.style.display=`none`,i}return T(t,e),b(t,[{key:`createUI`,value:function(){var e=this,t=document.createElement(`i`);return t.classList.add(`ql-table-caption--switch`),t.innerHTML=Nr,t.addEventListener(`click`,function(){e.scroll.isEnabled()&&(e.side=e.side===`top`?`bottom`:`top`)}),t}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`side`,get:function(){return this.domNode.style.captionSide===`bottom`?`bottom`:`top`},set:function(e){this.domNode.style.captionSide=e===`bottom`?`bottom`:`top`}},{key:`format`,value:function(e,n){var r=this.scroll.query(e,Pr.Scope.BLOCK_BLOT);(!r||e===this.statics.blotName)&&I(t,`format`,this,3)([e,n])}},{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!==R.tableMain){var r=this.tableId;this.wrap(R.tableMain,{tableId:r})}this.children.length===0?this.remove():(I(t,`optimize`,this,3)([e]),this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()))}}],[{key:`create`,value:function(e){var n=e.tableId,r=I(t,`create`,this,2)([]);return r.dataset.tableId=n,e.side===`bottom`&&(r.style.captionSide=`bottom`),r}},{key:`formats`,value:function(e){var t=e.dataset.tableId,n={tableId:String(t),side:e.style.captionSide===`bottom`?`bottom`:`top`};return n}}])}(wr);S(Lr,`blotName`,R.tableCaption),S(Lr,`tagName`,`caption`),S(Lr,`className`,`ql-table-caption`),S(Lr,`allowedChildren`,[Fr,Ir]);var Y=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:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`}},{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,R.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===R.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(R.tableCell,t),l=this.scroll.create(R.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(J),s=F(o,1),c=s[0];if(r.colspan!==1&&e===i-r.colspan){var l=H(this,R.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(J),a=F(i,1),o=a[0];if(o&&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:`wrapParentTag`,value:function(){var e={thead:R.tableHead,tbody:R.tableBody,tfoot:R.tableFoot},t=this.parent;if(t!==null&&t.statics.blotName!==e[this.wrapTag])if(Object.values(e).includes(t.statics.blotName)){var n=this.offset(this.parent),r=this.parent.split(n);r&&r.length()<=0&&r.remove();var i=this.parent.splitAfter(this);i&&i.length()<=0&&i.remove(),this.parent.replaceWith(e[this.wrapTag],this.tableId)}else this.wrap(e[this.wrapTag],this.tableId)}},{key:`optimize`,value:function(e){this.wrapParentTag(),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=e.tableId,r=e.rowId,i=e.wrapTag,a=i===void 0?`tbody`:i,o=I(t,`create`,this,2)([]);return o.dataset.tableId=n,o.dataset.rowId=r,o.dataset.wrapTag=a,o}}])}(K);S(Y,`blotName`,R.tableRow),S(Y,`tagName`,`tr`),S(Y,`className`,`ql-table-row`),S(Y,`allowDataAttrs`,new Set([`table-id`,`row-id`,`wrap-tag`])),S(Y,`allowDataAttrsChangeHandler`,{"wrap-tag":`wrapParentTag`});var X=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`isChildHeadTableCellInner`,value:function(){var e=this.children.head;return e&&e.statics.blotName===R.tableCellInner}},{key:`setFormatValue`,value:function(e,t){if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var n=e;this.statics.allowDataAttrs.has(e)&&(n=`data-${e}`),t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n)}else this.statics.isAllowStyle(e)&&(Object.assign(this.domNode.style,S({},e,t)),e.startsWith(`border`)&&this.setStyleBoder(e,t));var r=this.children.head;this.isChildHeadTableCellInner()&&this.domNode.style.cssText&&this.domNode.style.cssText!==r.domNode.dataset.style&&(r.domNode.dataset.style=this.domNode.style.cssText),this.parent&&this.parent.statics.blotName===R.tableRow&&this.parent.setFormatValue(e,t)}},{key:`setStyleBoder`,value:function(e,t){var n=t||null,r=![`left`,`right`,`top`,`bottom`].some(function(t){return e.includes(t)})&&e.startsWith(`border-`);if(r){var i=this.getNearByCell(`left`).map(function(e){return e.descendant(J,0)[0]}).filter(Boolean),a=x(i),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;s.setFormatValue(e.replace(`border-`,`border-right-`),n,!0)}}catch(e){a.e(e)}finally{a.f()}var c=this.getNearByCell(`top`).map(function(e){return e.descendant(J,0)[0]}).filter(Boolean),l=x(c),u;try{for(l.s();!(u=l.n()).done;){var d=u.value;d.setFormatValue(e.replace(`border-`,`border-bottom-`),n,!0)}}catch(e){l.e(e)}finally{l.f()}}}},{key:`getNearByCell`,value:function(e){var t=[];try{var n=H(this,R.tableMain);t.push.apply(t,L(n.getColIds()))}catch(e){console.error(`Cell is not in table! ${e}`)}if(t.length===0)return[];if(e===`left`){for(var r=new Set,i=this.parent,a=0;a<this.rowspan&&i instanceof Y;a++){for(var o=i.children.iterator(),s=null;s=o();){var c=t.indexOf(s.colId)+s.colspan;this.colId===t[c]&&r.add(s)}i=i.next}return Array.from(r)}else if(e===`top`){if(!(this.parent instanceof Y)||!this.parent.prev)return[];for(var l=new Set,u=this.getColumnIndex(),d=u+this.colspan,f=new Set(t.filter(function(e,t){return t>=u&&t<d})),p=1,m=this.parent.prev;m;){for(var h=!1,g=m.children.iterator(),_=null,v=0;_=g();)f.has(_.colId)&&_.rowspan>=p&&(l.add(_),f.delete(_.colId)),v+=_.colspan,_.rowspan>=p&&(h=!0);if(!h&&v===t.length)break;m=m.prev,p+=1}return Array.from(l)}return[]}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`rowspan`,get:function(){return Number(this.domNode.getAttribute(`rowspan`))}},{key:`colspan`,get:function(){return Number(this.domNode.getAttribute(`colspan`))}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}}},{key:`wrapTag`,get:function(){return this.domNode.dataset.wrapTag||`tbody`}},{key:`getColumnIndex`,value:function(){var e=H(this,R.tableMain);return e.getColIds().indexOf(this.colId)}},{key:`getCellInner`,value:function(){return this.children.head}},{key:`convertTableCell`,value:function(){var e=this.statics.formats(this.domNode),t=e.tag===`td`?`th`:`td`,n=this.children.head;this.isChildHeadTableCellInner()&&n.domNode.dataset.tag!==t&&(n.domNode.dataset.tag=t),this.replaceWith(R.tableCell,M(M({},e),{},{tag:t}))}},{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(e){var n=this.tableId,r=this.rowId,i=this.wrapTag;if(this.parent!==null&&this.parent.statics.blotName!==R.tableRow&&this.wrap(R.tableRow,{tableId:n,rowId:r,wrapTag:i}),this.parent.statics.blotName===R.tableRow&&this.parent.wrapTag!==i&&this.parent.setFormatValue(`wrap-tag`,this.wrapTag),this.emptyRow.length>0){var a=x(this.emptyRow),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;this.parent.parent.insertBefore(this.scroll.create(R.tableRow,{tableId:n,rowId:s,wrapTag:i}),this.parent.next)}}catch(e){a.e(e)}finally{a.f()}}I(t,`optimize`,this,3)([e])}}],[{key:`isAllowStyle`,value:function(e){var t=lr(e),n=x(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(lr(i)))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:`create`,value:function(e){var t,n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=e.tag,u=l===void 0?`td`:l,d=e.wrapTag,f=d===void 0?`tbody`:d,p=document.createElement(u);(t=p.classList).add.apply(t,L(Pe(this.className))),p.dataset.tableId=n,p.dataset.rowId=r,p.dataset.colId=i,p.dataset.wrapTag=f,p.setAttribute(`rowspan`,String(vr(a))),p.setAttribute(`colspan`,String(vr(o))),s&&(p.style.cssText=s);try{c&&(p.dataset.emptyRow=JSON.stringify(c))}catch(e){}return p}},{key:`formats`,value:function(e){var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.emptyRow,o=t.wrapTag,s=o===void 0?`tbody`:o,c=Number(e.getAttribute(`rowspan`)),l=Number(e.getAttribute(`colspan`)),u={tableId:n,rowId:r,colId:i,rowspan:vr(c),colspan:vr(l),tag:e.tagName.toLowerCase(),wrapTag:s},d=ur(e),f=Object.entries(d).filter(function(e){var t=F(e,2),n=t[1];return![`initial`,`inherit`].includes(n)});f.length>0&&(u.style=f.map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${n}: ${r}`}).join(`;`));try{a&&(u.emptyRow=JSON.parse(a))}catch(e){}return u}}])}(K);S(X,`blotName`,R.tableCell),S(X,`tagName`,`td`),S(X,`className`,`ql-table-cell`),S(X,`allowAttrs`,new Set([`rowspan`,`colspan`])),S(X,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`empty-row`,`wrap-tag`])),S(X,`allowStyle`,new Set([`background-color`,`border`,`height`]));var Rr=t.default.import(`blots/block/embed`),zr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`width`,get:function(){var e=this.domNode.getAttribute(`width`);if(!e){if(e=this.domNode.getBoundingClientRect().width,this.full){var t=this.domNode.closest(`table`);return t?e/100*t.getBoundingClientRect().width:z[this.full?`colMinWidthPre`:`colMinWidthPx`]}return e}return Number.parseFloat(String(e))},set:function(e){var t=Number.parseFloat(String(e));Number.isNaN(t)&&(t=z[this.full?`colMinWidthPre`:`colMinWidthPx`]),this.domNode.setAttribute(`width`,this.statics.validWidth(t,!!this.full))}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`checkMerge`,value:function(){var e=this.next,t=this.tableId,n=this.colId;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===t&&e.colId===n}},{key:`optimize`,value:function(e){var n=this.parent;if(n!=null&&n.statics.blotName!==R.tableColgroup){var r=this.statics.value(this.domNode);this.wrap(R.tableColgroup,r)}var i=H(this,R.tableColgroup);i.align=this.align,this.next!=null&&this.checkMerge()&&this.next.remove(),I(t,`optimize`,this,3)([e]);try{var a=H(this,R.tableColgroup),o=!0;a.children.forEach(function(e){o&&(o=e.full)}),a.full=o}catch(e){}}},{key:`insertAt`,value:function(e,n,r){var i=this;if(r!=null){if(n===this.statics.blotName&&r.tableId!==this.tableId)try{var a=H(this,R.tableWrapper),o=a.split(this.offset(a)),s=this.scroll.create(n,r);o.parent.insertBefore(s,o)}catch(e){console.warn(`TableCol not in TableColgroup`)}else I(t,`insertAt`,this,3)([e,n,r]);return}try{var c=H(this,R.tableWrapper),l=c.split(this.offset(c)),u=n.split(`
|
|
17
|
+
`),d=u.pop(),f=u.map(function(e){var t=i.scroll.create(`block`);return t.insertAt(0,e),t}),p=x(f),m;try{for(p.s();!(m=p.n()).done;){var h=m.value;l.parent.insertBefore(h,l)}}catch(e){p.e(e)}finally{p.f()}d&&l.parent.insertBefore(this.scroll.create(`text`,d),l)}catch(e){console.warn(`TableCol not in TableColgroup`)}}}],[{key:`validWidth`,value:function(e,t){var n=Number.parseFloat(String(e));return Number.isNaN(n)&&(n=z[t?`colMinWidthPre`:`colMinWidthPx`]),`${n}${t?`%`:`px`}`}},{key:`create`,value:function(e){var n=e.width,r=e.tableId,i=e.colId,a=e.full,o=e.align,s=I(t,`create`,this,2)([]);return s.setAttribute(`width`,this.validWidth(n,!!a)),a&&(s.dataset.full=String(a)),o&&o!==`left`&&(s.dataset.align=o),s.dataset.tableId=r,s.dataset.colId=i,s}},{key:`value`,value:function(e){var t=e.dataset,n=t.tableId,r=t.colId,i=e.getAttribute(`width`)||String(z.colDefaultWidth),a=e.dataset.align,o=Object.hasOwn(e.dataset,`full`),s={tableId:String(n),colId:String(r),full:o,width:Number.parseFloat(i)};return a&&(s.align=a),s}}])}(Rr);S(zr,`blotName`,R.tableCol),S(zr,`tagName`,`col`);var Z=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n]),S(i,`scroll`,void 0),i.scroll=e,i.updateAlign(),i}return T(t,e),b(t,[{key:`colWidthFillTable`,value:function(){if(this.full){Object.assign(this.domNode.style,{width:null});return}var e=this.getCols();if(e){var t=e.reduce(function(e,t){return t.width+e},0);if(!(t===0||Number.isNaN(t)))return this.domNode.style.width=`${t}px`,t}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.colWidthFillTable()}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`),this.updateAlign()}},{key:`setFull`,value:function(){if(!this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.width/t*100;i.full=!0,i.width=a}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`cancelFull`,value:function(){if(this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.full=!1,i.width=Math.max(i.width/100*t,z.colMinWidthPx)}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`updateAlign`,value:function(){var e=this.align,t={marginLeft:null,marginRight:null};switch(e){case`center`:t.marginLeft=`auto`,t.marginRight=`auto`;break;case``:case`left`:t.marginRight=`auto`;break;case`right`:t.marginLeft=`auto`;break;default:break}Object.assign(this.domNode.style,t)}},{key:`getBodys`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`thead, tbody, tfoot`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRows`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`tr`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRowIds`,value:function(){return this.getRows().map(function(e){return e.rowId})}},{key:`getCols`,value:function(){return this.descendants(zr)}},{key:`getColIds`,value:function(){return this.getCols().map(function(e){return e.colId})}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.domNode.dataset.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;n!==null&&n.statics.blotName!==R.tableWrapper&&this.wrap(R.tableWrapper,this.tableId),I(t,`optimize`,this,3)([e]),this.mergeRow()}},{key:`mergeRow`,value:function(){if(this.parent){var e=this.getRows(),t={},n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t[i.rowId]||(t[i.rowId]=[]),t[i.rowId].push(i)}}catch(e){n.e(e)}finally{n.f()}for(var a=0,o=Object.values(t);a<o.length;a++)for(var s=o[a],c=1;c<s.length;c++){var l=s[c];l.moveChildren(s[0]),l.remove()}}}},{key:`checkEmptyCol`,value:function(e){if(e){var t=this.getRows().length,n=this.getCols(),r=this.descendants(J),i=x(r),a;try{var o=function(){var e=a.value;if(e.colspan>1&&e.rowspan>=t){for(var r=n.findIndex(function(t){return t.colId===e.colId}),i=n[r],o=r+1;o<r+e.colspan;o++)n[o].remove(),i.width+=n[o].width;e.colspan=1}};for(i.s();!(a=i.n()).done;)o()}catch(e){i.e(e)}finally{i.f()}}}},{key:`checkEmptyRow`,value:function(e){for(var t=this,n=this.getRows(),r=new Set(n.map(function(e){return e.rowId})),i=function(){var i=n[a];if(e){if(i.children.length===0){for(var o=function(e){var t=n[c];t.foreachCellInner(function(t){if(t.rowspan>e){--t.rowspan;var n=new Set(t.emptyRow);n.delete(i.rowId),t.emptyRow=Array.from(n)}})},s=1,c=a-1;c>=0;c--,s++)o(s);i.remove()}}else{if(i.children.length===0&&i.prev){for(var l=i.prev;l&&l.children.length===0;)l=l.prev;l.foreachCellInner(function(e){var t=new Set(e.emptyRow);t.has(i.rowId)||(e.emptyRow=[i.rowId].concat(L(t)))})}i.foreachCellInner(function(e){var n=x(e.emptyRow),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;r.has(o)||i.parent.insertBefore(t.scroll.create(R.tableRow,{tableId:t.tableId,rowId:o}),i.next)}}catch(e){n.e(e)}finally{n.f()}})}},a=n.length-1;a>=0;a--)i()}},{key:`sortMergeChildren`,value:function(){var e=S(S(S(S(S({},R.tableCaption,[]),R.tableColgroup,[]),R.tableHead,[]),R.tableBody,[]),R.tableFoot,[]);this.children.forEach(function(t){e[t.statics.blotName]&&e[t.statics.blotName].push(t)});for(var t=0,n=Object.values(e);t<n.length;t++)for(var r=n[t],i=1;i<r.length;i++)r[i].moveChildren(r[0]);var a=e[R.tableCaption][0],o=e[R.tableColgroup][0],s=e[R.tableHead][0],c=e[R.tableBody][0],l=e[R.tableFoot][0],u=a&&this.children.head!==a,d=o&&a&&a.next!==o,f=o&&!a&&this.children.head!==o,p=s&&!c&&!l&&this.children.tail!==s,m=c&&s&&c.prev!==s,h=c&&!l&&this.children.tail!==c,g=c&&l&&c.next!==l,_=l&&this.children.tail!==l;if(u||d||f||p||m||h||g||_){var v=this.clone();a&&v.appendChild(a),o&&v.appendChild(o),s&&v.appendChild(s),c&&v.appendChild(c),l&&v.appendChild(l),this.children.forEach(function(e){return e.remove()}),v.moveChildren(this)}}},{key:`insertRow`,value:function(e){var t=this.getColIds(),n=this.descendants(Y),r=new Set(t),i=0,a=x(n),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(i===e)break;s.foreachCellInner(function(n){if(i+n.rowspan>e&&(n.rowspan+=1,r.delete(n.colId),n.colspan!==1))for(var a=t.indexOf(n.colId),o=0;o<n.colspan-1;o++)r.delete(t[a+o+1])}),i+=1}}catch(e){a.e(e)}finally{a.f()}var c=this.tableId,l=G(),u=this.scroll.create(R.tableRow,{tableId:c,rowId:l}),d=x(r),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=this.scroll.create(`break`),h=m.wrap(`block`),g=h.wrap(R.tableCellInner,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1}),_=g.wrap(R.tableCell,{tableId:c,rowId:l,colId:p,rowspan:1,colspan:1});u.appendChild(_)}}catch(e){d.e(e)}finally{d.f()}var v=n[e]||null;v?v.parent.insertBefore(u,v):n[n.length-1].parent.appendChild(u)}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]),r=e.tableId,i=e.full,a=e.align;return n.dataset.tableId=r,a===`right`||a===`center`?n.dataset.align=a:n.removeAttribute(`date-align`),i&&(n.dataset.full=String(i)),n.setAttribute(`cellpadding`,`0`),n.setAttribute(`cellspacing`,`0`),n}}])}(K);S(Z,`blotName`,R.tableMain),S(Z,`tagName`,`table`),S(Z,`className`,`ql-table`);var Br=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:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.parent&&this.parent instanceof Z&&(this.parent.full=e)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`findCol`,value:function(e){for(var t=this.children.iterator(),n=0,r;(r=t())&&n!==e;)n++;return r}},{key:`insertColByIndex`,value:function(e,t){var n=this.parent;if(!(n instanceof Z))throw TypeError(`TableColgroupFormat should be child of TableFormat`);var r=this.findCol(e),i=this.scroll.create(R.tableCol,t);if(n.full){for(var a=this.children.iterator(),o;o=a();)if(o.width-i.width>=z.colMinWidthPre){o.width-=i.width;break}}this.insertBefore(i,r)}},{key:`removeColByIndex`,value:function(e){var t=this.parent;if(!(t instanceof Z))throw TypeError(`TableColgroupFormat should be child of TableMainFormat`);var n=this.findCol(e);n&&(t.full&&(n.next?n.next.width+=n.width:n.prev&&(n.prev.width+=n.width)),n.remove(),t.colWidthFillTable())}},{key:`checkMerge`,value:function(){var e=this.next,t=this.parent;return t instanceof Z&&!t.full&&t.colWidthFillTable(),e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent,r=this.tableId,i=this.full,a=this.align;n!=null&&n.statics.blotName!==R.tableMain&&this.wrap(R.tableMain,{tableId:r,full:i,align:a});var o=H(this,R.tableMain);o.align=a,I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,e.full&&(n.dataset.full=String(e.full)),e.align&&e.align!==`left`&&(n.dataset.align=e.align),n.setAttribute(`contenteditable`,`false`),n}}])}(K);S(Br,`blotName`,R.tableColgroup),S(Br,`tagName`,`colgroup`);var Vr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t)}(q);S(Vr,`blotName`,R.tableFoot),S(Vr,`tagName`,`tfoot`);var Hr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t)}(q);S(Hr,`blotName`,R.tableHead),S(Hr,`tagName`,`thead`);var Ur=t.default.import(`parchment`),Wr=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`scroll`,void 0),S(a,`insertLineAround`,function(){(!a.prev||!a.isBlockLine(a.prev))&&a.parent.insertBefore(a.scroll.create(`block`),a),(!a.next||!a.isBlockLine(a.next))&&a.parent.insertBefore(a.scroll.create(`block`),a.next)}),a.scroll=e,a.scroll.emitter.on(t.default.events.TEXT_CHANGE,a.insertLineAround),a}return T(n,e),b(n,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{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){if(this.length()===0){this.remove();return}I(n,`optimize`,this,3)([e])}},{key:`deleteAt`,value:function(e,t){I(n,`deleteAt`,this,3)([e,t]);var r=this.descendants(q),i=this.descendants(Br);r.length===0&&i.length===0&&this.remove()}},{key:`remove`,value:function(){I(n,`remove`,this,3)([]),this.scroll.emitter.off(t.default.events.TEXT_CHANGE,this.insertLineAround)}},{key:`isBlockLine`,value:function(e){return e instanceof Ur.BlockBlot||new Set([`list-container`,`code-block-container`]).has(e.statics.blotName)}}],[{key:`create`,value:function(e){var t=I(n,`create`,this,2)([]);return t.dataset.tableId=e,t.addEventListener(`dragstart`,function(e){e.preventDefault(),e.stopPropagation()},!0),t.addEventListener(`drop`,function(e){e.preventDefault()}),t.addEventListener(`dragover`,function(e){e.preventDefault(),e.dataTransfer.dropEffect=`none`}),t.setAttribute(`contenteditable`,`false`),t}}])}(K);S(Wr,`blotName`,R.tableWrapper),S(Wr,`tagName`,`div`),S(Wr,`className`,`ql-table-wrapper`);function Gr(e){for(var t=new Set([R.tableHead,R.tableBody,R.tableFoot]),n=e.children.iterator(),r=null,i={};r=n();)t.has(r.statics.blotName)&&(i[r.statics.blotName]=r);if(Object.values(i).length<=0)return{rect:null,head:null,body:null,foot:null};var a=Object.values(i).reduce(function(e,t){var n=t.domNode.getBoundingClientRect();return M(M({},e),{},{top:Math.min(e.top,n.top),bottom:Math.max(e.bottom,n.bottom),left:Math.min(e.left,n.left),right:Math.max(e.right,n.right)})},{top:1/0,bottom:0,left:1/0,right:0,width:0,height:0,x:1/0,y:1/0});return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,{rect:a,head:i[R.tableHead]||null,body:i[R.tableBody]||null,foot:i[R.tableFoot]||null}}var Kr=function(){function e(t,n){v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`table`,void 0),this.tableModule=t,this.quill=n,this.quill.root.addEventListener(`mousedown`,this.tableSelectHandler.bind(this))}return b(e,[{key:`tableSelectHandler`,value:function(e){var t=e.composedPath();if(!(e.button!==0||!t||t.length<=0)){var n=t.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`});this.setSelectionTable(n)}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.hide(),this.table=e,this.table&&this.show(),this.update())}},{key:`hide`,value:function(){}},{key:`show`,value:function(){}},{key:`update`,value:function(){}}])}(),qr=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`tableBlot`,void 0),S(a,`tableWrapperBlot`,void 0),S(a,`alignBox`,void 0),S(a,`cleanup`,void 0),S(a,`bem`,V(`align`)),S(a,`resizeObserver`,void 0),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r,a.alignBox=a.buildTools(),a.hide(),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{key:`buildTools`,value:function(){for(var e=this.tableModule.addContainer(this.bem.b()),n=t.default.import(`ui/icons`),r={left:n.align[``],center:n.align.center,right:n.align.right},i=0,a=Object.entries(r);i<a.length;i++){var o=F(a[i],2),s=o[0],c=o[1],l=document.createElement(`span`);l.dataset.align=s,l.classList.add(this.bem.be(`item`)),l.innerHTML=`<i class="icon">${c}</i>`,l.addEventListener(`click`,this.handleAlignItemClick.bind(this)),e.appendChild(l)}return e}},{key:`handleAlignItemClick`,value:function(e){var t=e.currentTarget;if(t){var n=t.dataset.align;n&&this.tableBlot&&this.setTableAlign(this.tableBlot,n)}}},{key:`setTableAlign`,value:function(e,t){var n=e.getCols(),r=x(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a.align=t}}catch(e){r.e(e)}finally{r.f()}}},{key:`show`,value:function(){var e=this;!this.table||!this.alignBox||(this.tableBlot=t.default.find(this.table),this.tableWrapperBlot=this.tableBlot.parent,this.alignBox.classList.remove(this.bem.is(`hidden`)),this.resizeObserver=rr(function(){return e.update()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.table),this.cleanup&&this.cleanup(),this.cleanup=Un(this.tableWrapperBlot.domNode,this.alignBox,function(){return e.update()}))}},{key:`hide`,value:function(){this.tableBlot=void 0,this.tableWrapperBlot=void 0,this.alignBox&&this.alignBox.classList.add(this.bem.is(`hidden`)),this.cleanup&&(this.cleanup(),this.cleanup=void 0)}},{key:`update`,value:function(){var e=this;if(!(!this.alignBox||!this.tableBlot||!this.tableWrapperBlot)){if(!this.table||this.tableBlot.full||this.tableBlot.domNode.offsetWidth>=this.quill.root.offsetWidth){this.hide();return}Jn(this.tableWrapperBlot.domNode,this.alignBox,{placement:`top`,middleware:[Kn(),Gn({limiter:qn()}),Wn(16)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.alignBox.style,{left:`${n}px`,top:`${r}px`})})}}},{key:`destroy`,value:function(){this.hide(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.alignBox&&(this.alignBox.remove(),this.alignBox=null)}}])}(Kr);S(qr,`moduleName`,`table-align`);var Jr=[`style`],Yr=[`attributes`],Xr=[`attributes`],Zr=[`background`],Qr=t.default.import(`delta`),$r=t.default.import(`modules/clipboard`);function ei(e){var t=Number.parseFloat(e.getAttribute(`width`)||String(z.colDefaultWidth));if(Number.isNaN(t)){var n=e.style.width;t=n?Number.parseFloat(n):e.offsetWidth}return t}function ti(e,t){for(var n=Array(t).fill(z.colDefaultWidth),r=Array.from(e.querySelectorAll(`tr`)),i=0,a=r;i<a.length;i++){var o=a[i],s=Array.from(o.querySelectorAll(`td`)),c=x(s.entries()),l;try{for(c.s();!(l=c.n()).done;){var u=F(l.value,2),d=u[0],f=u[1];if(d<t){var p=ei(f);n[d]=p||n[d]}else break}}catch(e){c.e(e)}finally{c.f()}}return n}var ni=function(e){function t(e,n){var r;return v(this,t),r=_(this,t,[e,n]),S(r,`quill`,void 0),S(r,`tableId`,G()),S(r,`rowId`,G()),S(r,`colIds`,[]),S(r,`rowspanCount`,[]),S(r,`cellCount`,0),S(r,`colCount`,0),r.quill=e,r.addMatcher(`table`,r.matchTable.bind(r)),r.addMatcher(`thead`,r.matchThead.bind(r)),r.addMatcher(`tbody`,r.matchTbody.bind(r)),r.addMatcher(`tfoot`,r.matchTfoot.bind(r)),r.addMatcher(`colgroup`,r.matchColgroup.bind(r)),r.addMatcher(`col`,r.matchCol.bind(r)),r.addMatcher(`tr`,r.matchTr.bind(r)),r.addMatcher(`td`,r.matchTd.bind(r)),r.addMatcher(`th`,r.matchTd.bind(r)),r.addMatcher(`caption`,r.matchCaption.bind(r)),r.addMatcher(Node.ELEMENT_NODE,r.matchTdAttributor.bind(r)),r}return T(t,e),b(t,[{key:`getStyleBackgroundColor`,value:function(e,t){var n=e.style.backgroundColor;if(n){var r=x(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[R.tableCellInner]){var s=o.attributes[R.tableCellInner],c=s.style,l=N(s,Jr),u=dr(c||``);u.backgroundColor||(u.backgroundColor=n,o.attributes[R.tableCellInner]=M(M({},l),{},{style:fr(u)}))}}}catch(e){r.e(e)}finally{r.f()}}}},{key:`matchTable`,value:function(e,t){var n=this;if(t.ops.length===0)return t;for(var r=[],i=[],a=-1,o=0;o<t.ops.length;o++){var s=t.ops[o],c=s.attributes,l=s.insert;if(!Me(l)&&(!c||!c[R.tableCellInner]&&!c[R.tableCaption])){t.ops.splice(o,1),--o;continue}var u=c||{},d=R.tableCell;u.table,u[d];var f=N(u,[`table`,d].map(ae)),p=Me(l)&&l[R.tableCol];p?i.push({insert:l}):r.push({attributes:f,insert:l}),!(f!=null&&f[R.tableCellInner])&&!(f!=null&&f[R.tableCaption])&&!p&&Ae(l)&&l.trim().length>0&&(a=o)}var m=ti(e,this.colIds.length),h=m.reduce(function(e,t,r){return i[r]?e.push(i[r]):e.push({insert:S({},R.tableCol,{tableId:n.tableId,colId:n.colIds[r],width:t,full:!1})}),e},[]);r.splice.apply(r,[a+1,0].concat(L(h)));var g=new Qr(r);return this.getStyleBackgroundColor(e,g),this.tableId=G(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,g}},{key:`matchTbody`,value:function(e,t){this.getStyleBackgroundColor(e,t);for(var n=[],r=t.ops.length-1;r>=0;r--){var i,a=t.ops[r];if(!((i=a.attributes)!=null&&i[R.tableCellInner]))n=[],n.push(G());else if(a.attributes){if(a.attributes[R.tableCellInner].rowspan===1)n=[];else if(n.length>0){var o;a.attributes[R.tableCellInner].emptyRow||(a.attributes[R.tableCellInner].emptyRow=[]),(o=a.attributes[R.tableCellInner].emptyRow).push.apply(o,L(n))}}}return this.rowspanCount=[],t}},{key:`matchThead`,value:function(e,t){var n=this.matchTbody(e,t),r=x(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(a.attributes&&a.attributes[R.tableCellInner]){var o=a.attributes[R.tableCellInner];o.wrapTag=`thead`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchTfoot`,value:function(e,t){var n=this.matchTbody(e,t),r=x(n.ops),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(a.attributes&&a.attributes[R.tableCellInner]){var o=a.attributes[R.tableCellInner];o.wrapTag=`tfoot`}}}catch(e){r.e(e)}finally{r.f()}return n}},{key:`matchColgroup`,value:function(e,t){for(var n=[],r=0;r<t.ops.length;r++){var i=t.ops[r];i&&Me(i.insert)&&i.insert[R.tableCol]&&n.push(i)}return new Qr(n)}},{key:`matchCol`,value:function(e,t){var n=Number(e.getAttribute(`span`)||1);Number.isNaN(n)&&(n=1);for(var r=new Qr,i=0;i<n;i++)this.colIds[this.colCount]=G(),r.insert(S({},R.tableCol,Object.assign(zr.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]}))),this.colCount+=1;return r}},{key:`matchTr`,value:function(e,t){this.rowId=G(),this.cellCount=0;var n=x(this.rowspanCount.entries()),r;try{for(n.s();!(r=n.n()).done;){var i=F(r.value,2),a=i[0],o=i[1];o.rowspan>0&&--o.rowspan,o.rowspan<=0&&(this.rowspanCount[a]={rowspan:0,colspan:0})}}catch(e){n.e(e)}finally{n.f()}return this.getStyleBackgroundColor(e,t),t.ops.length===0?new Qr([{insert:`
|
|
18
|
+
`}]):t}},{key:`matchTd`,value:function(e,t){var n=e,r=X.formats(n);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(var i=this.cellCount;i>=0;i--)this.colIds[i]||(this.colIds[i]=G()),this.rowspanCount[i]||(this.rowspanCount[i]={rowspan:0,colspan:0});for(var a=this.cellCount;a<this.rowspanCount.length;a++){var o=this.rowspanCount[a],s=o.rowspan,c=o.colspan;if(s===0)break;this.cellCount+=c}r.rowspan>1&&(this.rowspanCount[this.cellCount]={rowspan:r.rowspan,colspan:r.colspan});var l=this.colIds[this.cellCount];this.cellCount+=r.colspan;var u=Object.assign(r,{tableId:this.tableId,rowId:this.rowId,colId:l});n.style.border===`none`&&(u.style=u.style.replaceAll(RegExp(`border-(top|right|bottom|left)-style:none;?`,`g`),``));var d=[],f=x(t.ops),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.attributes,g=h===void 0?{}:h,_=N(m,Yr),v=R.tableCell;g[v];var y=N(g,[v].map(ae));d.push(M(M({},_),{},{attributes:M(M({},y),{},S({},R.tableCellInner,u))}))}}catch(e){f.e(e)}finally{f.f()}return(d.length<=0||!Ae(d[d.length-1].insert)||!d[d.length-1].insert.endsWith(`
|
|
19
19
|
`))&&d.push({insert:`
|
|
20
|
-
`,attributes:S({},R.tableCellInner,u)}),new
|
|
20
|
+
`,attributes:S({},R.tableCellInner,u)}),new Qr(d)}},{key:`matchTdAttributor`,value:function(e,t){var n=e;if(n.tagName.toLocaleLowerCase()===`td`){var r=[],i=x(t.ops),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.attributes,c=N(o,Xr),l=s==null?void 0:s[R.tableCellInner];if(s&&l&&l.style){var u=s.background,d=N(s,Zr),f=document.createElement(`div`);f.style.background=u;var p=document.createElement(`div`);if(p.style.cssText=l.style,f.style.background===p.style.backgroundColor){r.push(M(M({},c),{},{attributes:M({},d)}));continue}}r.push(o)}}catch(e){i.e(e)}finally{i.f()}return new Qr(r)}return t}},{key:`convert`,value:function(e){var n=e.html,r=e.text,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=I(t,`convert`,this,3)([{html:n,text:r},i]);if(i[R.tableCellInner]){var o=x(a.ops),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;if(Me(c.insert)&&c.insert[R.tableCol]){c.insert=``;continue}c.attributes||(c.attributes={}),c.attributes[R.tableCellInner]=i[R.tableCellInner]}}catch(e){o.e(e)}finally{o.f()}}return a}},{key:`matchCaption`,value:function(e,t){for(var n=0;n<t.ops.length;n++){var r=t.ops[n],i=r.attributes;i&&i[R.tableCaption]&&(i[R.tableCaption].tableId=this.tableId,r.attributes=i)}return t}}])}($r),ri=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
21
21
|
<!-- Icon from Tabler Icons by Paweł Kuna - https://github.com/tabler/tabler-icons/blob/master/LICENSE -->
|
|
22
22
|
<path
|
|
23
23
|
fill="none"
|
|
@@ -28,7 +28,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
28
28
|
d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6m-10 6H3m18 0h-7m-8-3l-3 3l3 3m12-6l3 3l-3 3"
|
|
29
29
|
/>
|
|
30
30
|
</svg>
|
|
31
|
-
`,
|
|
31
|
+
`,ii=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
32
32
|
<path
|
|
33
33
|
fill="none"
|
|
34
34
|
stroke="currentColor"
|
|
@@ -38,7 +38,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
38
38
|
d="m4 8l4-4m6 0L4 14m0 6L20 4m0 6L10 20m10-4l-4 4"
|
|
39
39
|
/>
|
|
40
40
|
</svg>
|
|
41
|
-
`,
|
|
41
|
+
`,ai=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
42
42
|
<path
|
|
43
43
|
fill="none"
|
|
44
44
|
stroke="currentColor"
|
|
@@ -48,14 +48,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
48
48
|
d="m12.01 16l-.01.011M12.01 12l-.01.011M12.01 8l-.01.011M8.01 12l-.01.011M16.01 12l-.01.011M21 3.6v16.8a.6.6 0 0 1-.6.6H3.6a.6.6 0 0 1-.6-.6V3.6a.6.6 0 0 1 .6-.6h16.8a.6.6 0 0 1 .6.6"
|
|
49
49
|
/>
|
|
50
50
|
</svg>
|
|
51
|
-
`,
|
|
51
|
+
`,oi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">\r
|
|
52
52
|
<!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE -->\r
|
|
53
53
|
<path\r
|
|
54
54
|
fill="currentColor"\r
|
|
55
55
|
d="M11 21V9H3V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm2-2h6v-4h-6zm0-6h6V9h-6zM5 7h14V5H5zM3 22v-2h2.55q-1.2-.575-1.937-1.7t-.738-2.55q0-1.975 1.388-3.363T7.625 11v2q-1.125 0-1.937.8t-.813 1.95q0 .975.6 1.725t1.525.95V16h2v6z"\r
|
|
56
56
|
/>\r
|
|
57
57
|
</svg>\r
|
|
58
|
-
`,
|
|
58
|
+
`,si=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256">
|
|
59
59
|
<g fill="currentColor">
|
|
60
60
|
<path d="M216 40v128h-48V88H88V40Z" opacity=".2" />
|
|
61
61
|
<path
|
|
@@ -63,80 +63,80 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
63
63
|
/>
|
|
64
64
|
</g>
|
|
65
65
|
</svg>
|
|
66
|
-
`,
|
|
66
|
+
`,ci=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
|
|
67
67
|
<path
|
|
68
68
|
fill="currentColor"
|
|
69
69
|
d="m19.05 13.733l-1-1.733l-10.122 5.846l-.997-.576a3 3 0 0 0 .667-.769A3 3 0 1 0 3.5 17.599L5.928 19L3.5 20.402a3.034 3.034 0 1 0 3.44.323l.988-.57L14.59 24l1-1.73L9.928 19zM4.034 15.26a1 1 0 1 1 .466.607a1 1 0 0 1-.466-.607M5 22a1 1 0 1 1-.865 1.5A1 1 0 0 1 5 22m12 4h4v2h-4zm-7 0h4v2h-4z"
|
|
70
70
|
/>
|
|
71
71
|
<path fill="currentColor" d="M28 28h-4v-2h4V4H7v4H5V4a2 2 0 0 1 2-2h21a2 2 0 0 1 2 2v22a2 2 0 0 1-2 2" />
|
|
72
72
|
</svg>
|
|
73
|
-
`,
|
|
73
|
+
`,li=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
74
74
|
<path
|
|
75
75
|
fill="currentColor"
|
|
76
76
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm11.94 5.5h2v-4h2v4h2l-3 3z"
|
|
77
77
|
/>
|
|
78
78
|
</svg>
|
|
79
|
-
`,
|
|
79
|
+
`,ui=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
80
80
|
<path
|
|
81
81
|
fill="currentColor"
|
|
82
82
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm14.44 2v2h4v2h-4v2l-3-3z"
|
|
83
83
|
/>
|
|
84
84
|
</svg>
|
|
85
|
-
|
|
85
|
+
`,di=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
86
86
|
<path
|
|
87
87
|
fill="currentColor"
|
|
88
88
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm15.44 8v-2h-4v-2h4v-2l3 3z"
|
|
89
89
|
/>
|
|
90
90
|
</svg>
|
|
91
|
-
`,
|
|
91
|
+
`,fi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
92
92
|
<path
|
|
93
93
|
fill="currentColor"
|
|
94
94
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm17.94 4.5h-2v4h-2v-4h-2l3-3z"
|
|
95
95
|
/>
|
|
96
96
|
</svg>
|
|
97
|
-
`,
|
|
97
|
+
`,pi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
98
98
|
<path
|
|
99
99
|
fill="currentColor"
|
|
100
100
|
d="M5 10H3V4h8v2H5zm14 8h-6v2h8v-6h-2zM5 18v-4H3v6h8v-2zM21 4h-8v2h6v4h2zM8 13v2l3-3l-3-3v2H3v2zm8-2V9l-3 3l3 3v-2h5v-2z"
|
|
101
101
|
/>
|
|
102
102
|
</svg>
|
|
103
|
-
`,
|
|
103
|
+
`,mi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
104
104
|
<path
|
|
105
105
|
fill="currentColor"
|
|
106
106
|
d="M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4zm0 6v4h7v-4zM4 4v4h7V4zm13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59z"
|
|
107
107
|
/>
|
|
108
108
|
</svg>
|
|
109
|
-
`,
|
|
109
|
+
`,hi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
110
110
|
<path
|
|
111
111
|
fill="currentColor"
|
|
112
112
|
d="M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41zM22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2zM4 9h4V6H4zm6 0h4V6h-4zm6 0h4V6h-4z"
|
|
113
113
|
/>
|
|
114
114
|
</svg>
|
|
115
|
-
`,
|
|
115
|
+
`,gi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
116
116
|
<path
|
|
117
117
|
fill="currentColor"
|
|
118
118
|
d="m15.46 15.88l1.42-1.42L19 16.59l2.12-2.13l1.42 1.42L20.41 18l2.13 2.12l-1.42 1.42L19 19.41l-2.12 2.13l-1.42-1.42L17.59 18zM4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4z"
|
|
119
119
|
/>
|
|
120
120
|
</svg>
|
|
121
|
-
`,
|
|
121
|
+
`,_i=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
122
122
|
<path
|
|
123
123
|
fill="currentColor"
|
|
124
124
|
d="M19 14h2v6H3v-6h2v4h14zM3 4v6h2V6h14v4h2V4zm8 7v2H8v2l-3-3l3-3v2zm5 0V9l3 3l-3 3v-2h-3v-2z"
|
|
125
125
|
/>
|
|
126
126
|
</svg>
|
|
127
|
-
`,
|
|
127
|
+
`,vi=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
128
128
|
<!-- Icon from TDesign Icons by TDesign - https://github.com/Tencent/tdesign-icons/blob/main/LICENSE -->
|
|
129
129
|
<path fill="currentColor" d="M21 10v12h-2V12H5v10H3V10zm0-8v6H3V2zm-2 2H5v2h14z" />
|
|
130
130
|
</svg>
|
|
131
|
-
`,si=`color-selector`,Q={Break:{name:`break`},CopyCell:{name:`CopyCell`,tip:`Copy cell`,icon:Yr,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])}},CutCell:{name:`CutCell`,tip:`Cut cell`,icon:Xr,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])}},InsertTop:{name:`InsertTop`,icon:ei,tip:`Insert row above`,handle:function(e,t){e.appendRow(t,!1)}},InsertRight:{name:`InsertRight`,icon:$r,tip:`Insert column right`,handle:function(e,t){e.appendCol(t,!0)}},InsertBottom:{name:`InsertBottom`,icon:Zr,tip:`Insert row below`,handle:function(e,t){e.appendRow(t,!0)}},InsertLeft:{name:`InsertLeft`,icon:Qr,tip:`Insert column Left`,handle:function(e,t){e.appendCol(t,!1)}},MergeCell:{name:`MergeCell`,icon:ti,tip:`Merge Cell`,handle:function(e,t){e.mergeCells(t)}},SplitCell:{name:`SplitCell`,icon:ai,tip:`Split Cell`,handle:function(e,t){e.splitCell(t)}},DeleteRow:{name:`DeleteRow`,icon:ri,tip:`Delete Row`,handle:function(e,t){e.removeRow(t)}},DeleteColumn:{name:`DeleteColumn`,icon:ni,tip:`Delete Column`,handle:function(e,t){e.removeCol(t)}},DeleteTable:{name:`DeleteTable`,icon:ii,tip:`Delete table`,handle:function(e,t){e.deleteTable(t)}},BackgroundColor:{name:`BackgroundColor`,icon:Kr,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:qr,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:Gr,tip:`Switch table width`,handle:function(){if(this.table){var e=t.default.find(this.table);e&&(e.full?e.cancelFull():e.setFull())}}},InsertCaption:{name:`InsertCaption`,icon:oi,tip:`Insert table caption`,handle:function(){if(this.table){var e=t.default.find(this.table);if(e){var n=this.quill.scroll.create(`text`,`Table Caption`).wrap(R.tableCaption,{tableId:e.tableId});e.insertBefore(n,e.children.head)}}}},ToggleTdBetweenTh:{name:`ToggleTdBetweenTh`,icon:Jr,tip:`Toggle td between th`,handle:function(e,t){var n=x(t),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.convertTableCell()}}catch(e){n.e(e)}finally{n.f()}}}},ci=10,li=V(`color-map`),$={selectWrapper:li.b(),used:li.bm(`used`),item:li.be(`item`),btn:li.be(`btn`),map:li.be(`content`),mapRow:li.be(`content-row`)},ui=function(e){function n(e,r,i){var a;v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`usedColors`,new Set),S(a,`options`,void 0),S(a,`menu`,null),S(a,`isMenuDisplay`,!1),S(a,`isColorPicking`,!1),S(a,`tooltipItem`,[]),S(a,`activeTooltip`,null),S(a,`bem`,V(`menu`)),S(a,`colorItemClass`,`color-${G()}`),S(a,`colorChooseTooltipOption`,{direction:`top`}),S(a,`updateUsedColor`,nr(function(e){if(e){if(a.usedColors.add(e),a.usedColors.size>ci){var t=Array.from(a.usedColors).slice(-1*ci);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*ci),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)),S(a,`hideWhenSelectionDragStart`,function(){a.hide()}),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&a.isMenuDisplay&&a.update()}),a.tableModule=e,a.quill=r,a.options=a.resolveOptions(i);try{var o=localStorage.getItem(a.options.localstorageKey)||`[]`,s=JSON.parse(o);ke(s)||(s=[]),s.slice(-1*ci).map(function(e){return a.usedColors.add(e)})}catch(e){}return a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a.quill.on(B.TABLE_SELECTION_DRAG_START,a.hideWhenSelectionDragStart),a}return T(n,e),b(n,[{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(si)}else Oe(o)&&d.addEventListener(`click`,function(t){e.quill.focus(),o.call(e,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.call(n,n.tableModule,n.getSelectedTds(),`transparent`)});var _=document.createElement(`div`);_.classList.add($.btn,`clear`),_.textContent=this.tableModule.options.texts.clear,_.addEventListener(`click`,function(){r.call(n,n.tableModule,n.getSelectedTds(),null)});var v=document.createElement(`div`);v.classList.add($.btn,`custom`),v.textContent=this.tableModule.options.texts.custom;var y=Ie({onChange:function(e){r.call(n,n.tableModule,n.getSelectedTds(),e),n.updateUsedColor(e)}}),b=Vn(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=Vn(e,M({type:`click`,content:a,onOpen:function(){var e=n.tableModule.getModule(`table-selection`);return n.isMenuDisplay&&e&&e.hideDisplay(),n.setActiveTooltip(k),!1},onClose:function(){var e=n.tableModule.getModule(`table-selection`);n.isMenuDisplay&&e&&(e.updateWithSelectedTds(),e.showDisplay());var t=a.contains(y);return t&&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=this.tableModule.getModule(`table-selection`);return(e==null?void 0:e.selectedTds)||[]}},{key:`createTipText`,value:function(e,t){var n=Vn(e,{msg:t});n&&this.tooltipItem.push(n)}},{key:`show`,value:function(){this.table&&(this.menu&&this.hide(),this.menu=this.buildTools())}},{key:`update`,value:function(){this.table&&!this.quill.root.contains(this.table)&&this.setSelectionTable(void 0)}},{key:`hide`,value:function(){this.menu&&(this.menu.remove(),this.menu=null);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.quill.off(B.TABLE_SELECTION_DRAG_START,this.hideWhenSelectionDragStart),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.tooltipItem=[],this.hide()}}])}(Pr);S(ui,`moduleName`,`table-menu`);var di=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,`tableSelectioChange`,function(e){e.selectedTds.length<=0&&i.hide()}),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`)}),a=i.tableModule.getModule(`table-selection`);r&&a!=null&&(t=a.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.quill.on(B.TABLE_SELECTION_CHANGE,i.tableSelectioChange),i.quill.on(B.TABLE_SELECTION_DISPLAY_CHANGE,i.tableSelectioChange),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(si),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){I(t,`update`,this,3)([]);var n=this.tableModule.getModule(`table-selection`);if(!this.table||!this.isMenuDisplay||!this.menu){this.hide();return}if(!(!e||!(n!=null&&n.isDisplaySelection))){var r={display:`flex`,left:0,top:0},i=e.x,a=e.y;r.left=i,r.top=a,Object.assign(this.menu.style,M(M({},r),{},{left:`${r.left+window.scrollX}px`,top:`${r.top+window.scrollY}px`}));var o=this.menu.getBoundingClientRect(),s=Gn(o),c=s.left,l=s.top;Object.assign(this.menu.style,{left:`${c+window.scrollX}px`,top:`${l+window.scrollY}px`})}}},{key:`destroy`,value:function(){this.quill.root.removeEventListener(`contextmenu`,this.listenContextmenu),I(t,`destroy`,this,3)([]),this.quill.off(B.TABLE_SELECTION_CHANGE,this.tableSelectioChange),this.quill.off(B.TABLE_SELECTION_DISPLAY_CHANGE,this.tableSelectioChange)}}])}(ui),fi=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,`tableSelectionDragStart`,function(){i.hide()}),S(i,`tableSelectionDragEnd`,function(e){e.selectedTds.length>0&&i.show()}),S(i,`tableSelectioChange`,function(e,t){t.length<=0&&i.hide()}),S(i,`tableSelectionDisplayChange`,function(e){e.dragging||i.update()}),i.tableModule=e,i.quill=n,i.quill.on(B.TABLE_SELECTION_DRAG_START,i.tableSelectionDragStart),i.quill.on(B.TABLE_SELECTION_DRAG_END,i.tableSelectionDragEnd),i.quill.on(B.TABLE_SELECTION_CHANGE,i.tableSelectioChange),i.quill.on(B.TABLE_SELECTION_DISPLAY_CHANGE,i.tableSelectionDisplayChange),i}return T(t,e),b(t,[{key:`buildTools`,value:function(){var e=I(t,`buildTools`,this,3)([]);return this.tableModule.addContainer(e),e}},{key:`show`,value:function(){I(t,`show`,this,3)([]),this.update()}},{key:`update`,value:function(){var e=this;if(I(t,`update`,this,3)([]),!this.menu&&this.table){this.show();return}var n=this.getSelectedTds();if(!this.menu||!this.table||n.length===0){(this.menu||!this.table)&&(this.isMenuDisplay=!1,this.menu&&this.menu.classList.add(this.bem.is(`hidden`)),this.hide());return}this.isMenuDisplay=!0,this.menu.classList.remove(this.bem.is(`hidden`));var r=this.tableModule.getModule(`table-selection`);r!=null&&r.isDisplaySelection&&Ln(r.cellSelect,this.menu,{placement:`bottom`,middleware:[Fn(),Pn({limiter:In()}),Nn(20)]}).then(function(t){var n=t.x,r=t.y;e.menu&&Object.assign(e.menu.style,{left:`${n}px`,top:`${r}px`})})}},{key:`destroy`,value:function(){I(t,`destroy`,this,3)([]),this.quill.off(B.TABLE_SELECTION_DRAG_START,this.tableSelectionDragStart),this.quill.off(B.TABLE_SELECTION_DRAG_END,this.tableSelectionDragEnd)}}])}(ui),pi=function(e){return!e.full&&e.align===`right`},mi=function(e){function t(e,n){var r;return v(this,t),r=_(this,t,[e,n]),S(r,`tableModule`,void 0),S(r,`quill`,void 0),S(r,`colIndex`,-1),S(r,`tableBlot`,void 0),S(r,`dragging`,!1),S(r,`dragColBreak`,null),S(r,`handleColMouseUpFunc`,r.handleColMouseUp.bind(r)),S(r,`handleColMouseMoveFunc`,r.handleColMouseMove.bind(r)),S(r,`handleColMouseDownFunc`,r.handleColMouseDown.bind(r)),S(r,`rowIndex`,-1),S(r,`dragRowBreak`,null),S(r,`handleRowMouseUpFunc`,r.handleRowMouseUp.bind(r)),S(r,`handleRowMouseMoveFunc`,r.handleRowMouseMove.bind(r)),S(r,`handleRowMouseDownFunc`,r.handleRowMouseDown.bind(r)),S(r,`dragBEM`,V(`drag-line`)),r.tableModule=e,r.quill=n,r}return T(t,e),b(t,[{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=Fe({content:i}),c=Fe({type:`confirm`,content:r});o.appendChild(s),o.appendChild(c),t.appendChild(a),t.appendChild(o);var l=Re({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.tableBlot||this.colIndex===-1)){e.next=2;break}return e.abrupt(`return`);case 2:if(t=this.tableBlot.getCols(),n=Number.parseInt(this.dragColBreak.dataset.w||`0`),r=this.tableBlot.full,i=!1,a=[],r?(o=this.tableBlot.domNode.getBoundingClientRect().width,s=n/o*100,c=t[this.colIndex].width,s<c?(s=Math.max(z.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-z.colMinWidthPre,s),i=!0,a.push({index:this.colIndex,width:s},{index:this.colIndex+1,width:u-s}))):(this.tableBlot.domNode.style.width=`${Number.parseFloat(this.tableBlot.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.tableBlot.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.tableBlot.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:r?Math.round(j/100*d):Math.round(j),pre:Math.round(j)},r)}catch(e){D.e(e)}finally{D.f()}case 47:this.quill.emitter.emit(B.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.tableBlot)return null;var t=this.tableBlot.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.tableBlot||this.colIndex===-1)){var t=this.tableBlot.getCols(),n=this.getColumnRect(this.colIndex),r=this.tableBlot.domNode.getBoundingClientRect(),i=e.clientX;if(this.tableBlot.full){var a=z.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 pi(this.tableBlot)?n.right-i<z.colMinWidthPx&&(i=n.right-z.colMinWidthPx):i-n.left<z.colMinWidthPx&&(i=n.left+z.colMinWidthPx);var c=i-n.left;return pi(this.tableBlot)&&(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.tableBlot)){var t=Nr(this.tableBlot),n=t.rect;if(n){var r=this.tableBlot.getCols();if(this.colIndex=this.findCurrentColIndex(e),this.colIndex!==-1){var i=r[this.colIndex].width,a=this.tableBlot.full?i/100*n.width:i;document.addEventListener(`mouseup`,this.handleColMouseUpFunc),document.addEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!0;var o=document.createElement(`div`);o.classList.add(this.dragBEM.b(),this.dragBEM.is(`col`)),o.dataset.w=String(a);var s={top:n.y,left:e.clientX,height:n.height};Object.assign(o.style,{top:`${s.top}px`,left:`${s.left}px`,height:`${s.height}px`});var c=document.body;return c.appendChild(o),this.dragColBreak&&c.removeChild(this.dragColBreak),this.dragColBreak=o,s}}}}},{key:`findCurrentRowIndex`,value:function(e){return-1}},{key:`rowHeightChange`,value:function(e,t){}},{key:`handleRowMouseUp`,value:function(){if(!(!this.tableBlot||!this.dragRowBreak||this.rowIndex===-1)){var e=Number.parseInt(this.dragRowBreak.dataset.h||`0`),t=this.tableBlot.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(B.AFTER_TABLE_RESIZE)}}},{key:`handleRowMouseMove`,value:function(e){if(!(!this.tableBlot||!this.dragRowBreak||this.rowIndex===-1)){e.preventDefault();var t=this.tableBlot.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect(),r=e.clientY;return r-n.y<z.rowMinHeightPx&&(r=n.y+z.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.tableBlot&&(this.rowIndex=this.findCurrentRowIndex(e),this.rowIndex!==-1))){this.dragging=!0,document.addEventListener(`mouseup`,this.handleRowMouseUpFunc),document.addEventListener(`mousemove`,this.handleRowMouseMoveFunc);var t=this.tableBlot.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect().height,r=this.tableBlot.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(){}}])}(Pr);S(mi,`moduleName`,`table-resize`);var hi=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`root`,void 0),S(a,`tableWrapperBlot`,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(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),S(a,`handleColMouseDownFunc`,function(e){var t=this.handleColMouseDown(e);if(t&&this.dragColBreak&&this.tableBlot){var n=_e(this.tableBlot,Tr),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.quill=r,a.root=a.tableModule.addContainer(a.bem.b()),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{key:`setSelectionTable`,value:function(e){if(this.table!==e){if(this.hide(),this.table=e,this.table){var n=t.default.find(this.table);n&&(this.tableBlot=n,this.tableWrapperBlot=this.tableBlot.parent),this.show()}this.update()}}},{key:`handleResizerHeader`,value:function(e,t,n){if(this.table){var r=n.clientX,i=n.clientY,a=this.table.getBoundingClientRect();n.shiftKey||(this.lastHeaderSelect=null);var o=[{x:e?a.left:r,y:e?i:a.top},{x:e?a.right:r,y:e?i:a.bottom}];if(this.lastHeaderSelect){var s,c;if(this.lastHeaderSelect.isX){var l=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),u=l[this.lastHeaderSelect.index].getBoundingClientRect();s=Math.min(u.left,a.left),c=u.top+u.height/2}else{var d=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),f=d[this.lastHeaderSelect.index].getBoundingClientRect();s=f.left+f.width/2,c=Math.min(f.top,a.top)}this.lastHeaderSelect.isX===e?e?(o[0].y=Math.min(o[0].y,c),o[1].y=Math.max(o[1].y,c)):(o[0].x=Math.min(o[0].x,s),o[1].x=Math.max(o[1].x,s)):(o[1]={x:Math.max(o[0].x,s),y:Math.max(o[0].y,c)},o[0]={x:Math.min(o[0].x,s),y:Math.min(o[0].y,c)})}else this.lastHeaderSelect={isX:e,index:t};var p=this.tableModule.getModule(`table-selection`);p&&(p.table=this.table,p.setSelectedTds(p.computeSelectedTds.apply(p,o)),p.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`)));qn.call(this,this.tableWrapperBlot.domNode,function(){e.colHeadWrapper.scrollLeft=e.tableWrapperBlot.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`)));qn.call(this,this.tableWrapperBlot.domNode,function(){e.rowHeadWrapper.scrollTop=e.tableWrapperBlot.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=this;if(!(!this.tableBlot||!this.tableWrapperBlot)){var t=Nr(this.tableBlot),n=t.rect;if(n){this.root.innerHTML=``,this.tableCols=this.tableBlot.getCols(),this.tableRows=this.tableBlot.getRows();var r=this.tableWrapperBlot.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect();if(Object.assign(this.root.style,{top:`${Math.max(n.y,r.y)-i.y}px`,left:`${Math.max(n.x,r.x)-i.x}px`}),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(){var t=e.tableModule.getModule(`table-selection`);t&&e.tableBlot&&(t.setSelectedTds(e.tableBlot.descendants(J)),t.show(),t.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">
|
|
131
|
+
`,yi=`color-selector`,Q={Break:{name:`break`},CopyCell:{name:`CopyCell`,tip:`Copy cell`,icon:si,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])}},CutCell:{name:`CutCell`,tip:`Cut cell`,icon:ci,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])}},InsertTop:{name:`InsertTop`,icon:fi,tip:`Insert row above`,handle:function(e,t){e.appendRow(t,!1)}},InsertRight:{name:`InsertRight`,icon:di,tip:`Insert column right`,handle:function(e,t){e.appendCol(t,!0)}},InsertBottom:{name:`InsertBottom`,icon:li,tip:`Insert row below`,handle:function(e,t){e.appendRow(t,!0)}},InsertLeft:{name:`InsertLeft`,icon:ui,tip:`Insert column Left`,handle:function(e,t){e.appendCol(t,!1)}},MergeCell:{name:`MergeCell`,icon:pi,tip:`Merge Cell`,handle:function(e,t){e.mergeCells(t)}},SplitCell:{name:`SplitCell`,icon:_i,tip:`Split Cell`,handle:function(e,t){e.splitCell(t)}},DeleteRow:{name:`DeleteRow`,icon:hi,tip:`Delete Row`,handle:function(e,t){e.removeRow(t)}},DeleteColumn:{name:`DeleteColumn`,icon:mi,tip:`Delete Column`,handle:function(e,t){e.removeCol(t)}},DeleteTable:{name:`DeleteTable`,icon:gi,tip:`Delete table`,handle:function(e,t){e.deleteTable(t)}},BackgroundColor:{name:`BackgroundColor`,icon:ii,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:ai,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:ri,tip:`Switch table width`,handle:function(){if(this.table){var e=t.default.find(this.table);e&&(e.full?e.cancelFull():e.setFull())}}},InsertCaption:{name:`InsertCaption`,icon:vi,tip:`Insert table caption`,handle:function(){if(this.table){var e=t.default.find(this.table);if(e){var n=this.quill.scroll.create(`text`,`Table Caption`).wrap(R.tableCaption,{tableId:e.tableId});e.insertBefore(n,e.children.head)}}}},ToggleTdBetweenTh:{name:`ToggleTdBetweenTh`,icon:oi,tip:`Toggle td between th`,handle:function(e,t){var n=x(t),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.convertTableCell()}}catch(e){n.e(e)}finally{n.f()}}}},bi=10,xi=V(`color-map`),$={selectWrapper:xi.b(),used:xi.bm(`used`),item:xi.be(`item`),btn:xi.be(`btn`),map:xi.be(`content`),mapRow:xi.be(`content-row`)},Si=function(e){function n(e,r,i){var a;v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`usedColors`,new Set),S(a,`options`,void 0),S(a,`menu`,null),S(a,`isMenuDisplay`,!1),S(a,`isColorPicking`,!1),S(a,`tooltipItem`,[]),S(a,`activeTooltip`,null),S(a,`bem`,V(`menu`)),S(a,`colorItemClass`,`color-${G()}`),S(a,`colorChooseTooltipOption`,{direction:`top`}),S(a,`updateUsedColor`,pr(function(e){if(e){if(a.usedColors.add(e),a.usedColors.size>bi){var t=Array.from(a.usedColors).slice(-1*bi);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*bi),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)),S(a,`hideWhenSelectionDragStart`,function(){a.hide()}),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&a.isMenuDisplay&&a.update()}),a.tableModule=e,a.quill=r,a.options=a.resolveOptions(i);try{var o=localStorage.getItem(a.options.localstorageKey)||`[]`,s=JSON.parse(o);ke(s)||(s=[]),s.slice(-1*bi).map(function(e){return a.usedColors.add(e)})}catch(e){}return a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a.quill.on(B.TABLE_SELECTION_DRAG_START,a.hideWhenSelectionDragStart),a}return T(n,e),b(n,[{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(yi)}else Oe(o)&&d.addEventListener(`click`,function(t){e.quill.focus(),o.call(e,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.call(n,n.tableModule,n.getSelectedTds(),`transparent`)});var _=document.createElement(`div`);_.classList.add($.btn,`clear`),_.textContent=this.tableModule.options.texts.clear,_.addEventListener(`click`,function(){r.call(n,n.tableModule,n.getSelectedTds(),null)});var v=document.createElement(`div`);v.classList.add($.btn,`custom`),v.textContent=this.tableModule.options.texts.custom;var y=Ie({onChange:function(e){r.call(n,n.tableModule,n.getSelectedTds(),e),n.updateUsedColor(e)}}),b=Qn(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=Qn(e,M({type:`click`,content:a,onOpen:function(){var e=n.tableModule.getModule(`table-selection`);return n.isMenuDisplay&&e&&e.hideDisplay(),n.setActiveTooltip(k),!1},onClose:function(){var e=n.tableModule.getModule(`table-selection`);n.isMenuDisplay&&e&&(e.updateWithSelectedTds(),e.showDisplay());var t=a.contains(y);return t&&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=this.tableModule.getModule(`table-selection`);return(e==null?void 0:e.selectedTds)||[]}},{key:`createTipText`,value:function(e,t){var n=Qn(e,{msg:t});n&&this.tooltipItem.push(n)}},{key:`show`,value:function(){this.table&&(this.menu&&this.hide(),this.menu=this.buildTools())}},{key:`update`,value:function(){this.table&&!this.quill.root.contains(this.table)&&this.setSelectionTable(void 0)}},{key:`hide`,value:function(){this.menu&&(this.menu.remove(),this.menu=null);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.quill.off(B.TABLE_SELECTION_DRAG_START,this.hideWhenSelectionDragStart),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.tooltipItem=[],this.hide()}}])}(Kr);S(Si,`moduleName`,`table-menu`);var Ci=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,`tableSelectioChange`,function(e){e.selectedTds.length<=0&&i.hide()}),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`)}),a=i.tableModule.getModule(`table-selection`);r&&a!=null&&(t=a.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.quill.on(B.TABLE_SELECTION_CHANGE,i.tableSelectioChange),i.quill.on(B.TABLE_SELECTION_DISPLAY_CHANGE,i.tableSelectioChange),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(yi),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){I(t,`update`,this,3)([]);var n=this.tableModule.getModule(`table-selection`);if(!this.table||!this.isMenuDisplay||!this.menu){this.hide();return}if(!(!e||!(n!=null&&n.isDisplaySelection))){var r={display:`flex`,left:0,top:0},i=e.x,a=e.y;r.left=i,r.top=a,Object.assign(this.menu.style,M(M({},r),{},{left:`${r.left+window.scrollX}px`,top:`${r.top+window.scrollY}px`}));var o=this.menu.getBoundingClientRect(),s=nr(o),c=s.left,l=s.top;Object.assign(this.menu.style,{left:`${c+window.scrollX}px`,top:`${l+window.scrollY}px`})}}},{key:`destroy`,value:function(){this.quill.root.removeEventListener(`contextmenu`,this.listenContextmenu),I(t,`destroy`,this,3)([]),this.quill.off(B.TABLE_SELECTION_CHANGE,this.tableSelectioChange),this.quill.off(B.TABLE_SELECTION_DISPLAY_CHANGE,this.tableSelectioChange)}}])}(Si),wi=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,`tableSelectionDragStart`,function(){i.hide()}),S(i,`tableSelectionDragEnd`,function(e){e.selectedTds.length>0&&i.show()}),S(i,`tableSelectioChange`,function(e,t){t.length<=0&&i.hide()}),S(i,`tableSelectionDisplayChange`,function(e){e.dragging||i.update()}),i.tableModule=e,i.quill=n,i.quill.on(B.TABLE_SELECTION_DRAG_START,i.tableSelectionDragStart),i.quill.on(B.TABLE_SELECTION_DRAG_END,i.tableSelectionDragEnd),i.quill.on(B.TABLE_SELECTION_CHANGE,i.tableSelectioChange),i.quill.on(B.TABLE_SELECTION_DISPLAY_CHANGE,i.tableSelectionDisplayChange),i}return T(t,e),b(t,[{key:`buildTools`,value:function(){var e=I(t,`buildTools`,this,3)([]);return this.tableModule.addContainer(e),e}},{key:`show`,value:function(){I(t,`show`,this,3)([]),this.update()}},{key:`update`,value:function(){var e=this;if(I(t,`update`,this,3)([]),!this.menu&&this.table){this.show();return}var n=this.getSelectedTds();if(!this.menu||!this.table||n.length===0){(this.menu||!this.table)&&(this.isMenuDisplay=!1,this.menu&&this.menu.classList.add(this.bem.is(`hidden`)),this.hide());return}this.isMenuDisplay=!0,this.menu.classList.remove(this.bem.is(`hidden`));var r=this.tableModule.getModule(`table-selection`);r!=null&&r.isDisplaySelection&&Jn(r.cellSelect,this.menu,{placement:`bottom`,middleware:[Kn(),Gn({limiter:qn()}),Wn(20)]}).then(function(t){var n=t.x,r=t.y;e.menu&&Object.assign(e.menu.style,{left:`${n}px`,top:`${r}px`})})}},{key:`destroy`,value:function(){I(t,`destroy`,this,3)([]),this.quill.off(B.TABLE_SELECTION_DRAG_START,this.tableSelectionDragStart),this.quill.off(B.TABLE_SELECTION_DRAG_END,this.tableSelectionDragEnd)}}])}(Si),Ti=function(e){return!e.full&&e.align===`right`},Ei=function(e){function t(e,n){var r;return v(this,t),r=_(this,t,[e,n]),S(r,`tableModule`,void 0),S(r,`quill`,void 0),S(r,`colIndex`,-1),S(r,`tableBlot`,void 0),S(r,`dragging`,!1),S(r,`dragColBreak`,null),S(r,`handleColMouseUpFunc`,r.handleColMouseUp.bind(r)),S(r,`handleColMouseMoveFunc`,r.handleColMouseMove.bind(r)),S(r,`handleColMouseDownFunc`,r.handleColMouseDown.bind(r)),S(r,`rowIndex`,-1),S(r,`dragRowBreak`,null),S(r,`handleRowMouseUpFunc`,r.handleRowMouseUp.bind(r)),S(r,`handleRowMouseMoveFunc`,r.handleRowMouseMove.bind(r)),S(r,`handleRowMouseDownFunc`,r.handleRowMouseDown.bind(r)),S(r,`dragBEM`,V(`drag-line`)),r.tableModule=e,r.quill=n,r}return T(t,e),b(t,[{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=Fe({content:i}),c=Fe({type:`confirm`,content:r});o.appendChild(s),o.appendChild(c),t.appendChild(a),t.appendChild(o);var l=Re({child:t}),u=l.close;s.addEventListener(`click`,function(){e(!1),u()}),c.addEventListener(`click`,function(){e(!0),u()})}));case 1: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,M;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!this.dragColBreak||!this.tableBlot||this.colIndex===-1)){e.next=1;break}return e.abrupt(`return`);case 1:if(t=this.tableBlot.getCols(),n=Number.parseInt(this.dragColBreak.dataset.w||`0`),r=this.tableBlot.full,i=!1,a=[],r?(o=this.tableBlot.domNode.getBoundingClientRect().width,s=n/o*100,c=t[this.colIndex].width,s<c?(s=Math.max(z.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-z.colMinWidthPre,s),i=!0,a.push({index:this.colIndex,width:s},{index:this.colIndex+1,width:u-s}))):(this.tableBlot.domNode.style.width=`${Number.parseFloat(this.tableBlot.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=13;break}if(d=this.tableBlot.domNode.getBoundingClientRect().width,!r){e.next=12;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=2,m.s();case 3:if((h=m.n()).done){e.next=6;break}if(g=F(h.value,2),_=g[0],v=g[1],!p.has(_)){e.next=4;break}return e.abrupt(`continue`,5);case 4:f+=v.width;case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,M=e.catch(2),m.e(M);case 8:return e.prev=8,m.f(),e.finish(8);case 9:if(!(f>100)){e.next=12;break}return e.next=10,this.createConfirmDialog({message:this.tableModule.options.texts.perWidthInsufficient,confirm:this.tableModule.options.texts.confirmText,cancel:this.tableModule.options.texts.cancelText});case 10:if(e.sent){e.next=11;break}return e.abrupt(`return`);case 11:this.tableBlot.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 12: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:r?Math.round(j/100*d):Math.round(j),pre:Math.round(j)},r)}catch(e){D.e(e)}finally{D.f()}case 13:this.quill.emitter.emit(B.AFTER_TABLE_RESIZE);case 14:case`end`:return e.stop()}},e,this,[[2,7,8,9]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`getColumnRect`,value:function(e){if(!this.tableBlot)return null;var t=this.tableBlot.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.tableBlot||this.colIndex===-1)){var t=this.tableBlot.getCols(),n=this.getColumnRect(this.colIndex),r=this.tableBlot.domNode.getBoundingClientRect(),i=e.clientX;if(this.tableBlot.full){var a=z.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 Ti(this.tableBlot)?n.right-i<z.colMinWidthPx&&(i=n.right-z.colMinWidthPx):i-n.left<z.colMinWidthPx&&(i=n.left+z.colMinWidthPx);var c=i-n.left;return Ti(this.tableBlot)&&(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.tableBlot)){var t=Gr(this.tableBlot),n=t.rect;if(n){var r=this.tableBlot.getCols();if(this.colIndex=this.findCurrentColIndex(e),this.colIndex!==-1){var i=r[this.colIndex].width,a=this.tableBlot.full?i/100*n.width:i;document.addEventListener(`mouseup`,this.handleColMouseUpFunc),document.addEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!0;var o=document.createElement(`div`);o.classList.add(this.dragBEM.b(),this.dragBEM.is(`col`)),o.dataset.w=String(a);var s={top:n.y,left:e.clientX,height:n.height};Object.assign(o.style,{top:`${s.top}px`,left:`${s.left}px`,height:`${s.height}px`});var c=document.body;return c.appendChild(o),this.dragColBreak&&c.removeChild(this.dragColBreak),this.dragColBreak=o,s}}}}},{key:`findCurrentRowIndex`,value:function(e){return-1}},{key:`rowHeightChange`,value:function(e,t){}},{key:`handleRowMouseUp`,value:function(){if(!(!this.tableBlot||!this.dragRowBreak||this.rowIndex===-1)){var e=Number.parseInt(this.dragRowBreak.dataset.h||`0`),t=this.tableBlot.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(B.AFTER_TABLE_RESIZE)}}},{key:`handleRowMouseMove`,value:function(e){if(!(!this.tableBlot||!this.dragRowBreak||this.rowIndex===-1)){e.preventDefault();var t=this.tableBlot.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect(),r=e.clientY;return r-n.y<z.rowMinHeightPx&&(r=n.y+z.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.tableBlot&&(this.rowIndex=this.findCurrentRowIndex(e),this.rowIndex!==-1))){this.dragging=!0,document.addEventListener(`mouseup`,this.handleRowMouseUpFunc),document.addEventListener(`mousemove`,this.handleRowMouseMoveFunc);var t=this.tableBlot.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect().height,r=this.tableBlot.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(){}}])}(Kr);S(Ei,`moduleName`,`table-resize`);var Di=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`root`,void 0),S(a,`tableWrapperBlot`,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(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),S(a,`handleColMouseDownFunc`,function(e){var t=this.handleColMouseDown(e);if(t&&this.dragColBreak&&this.tableBlot){var n=_e(this.tableBlot,Lr),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.quill=r,a.root=a.tableModule.addContainer(a.bem.b()),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{key:`setSelectionTable`,value:function(e){if(this.table!==e){if(this.hide(),this.table=e,this.table){var n=t.default.find(this.table);n&&(this.tableBlot=n,this.tableWrapperBlot=this.tableBlot.parent),this.show()}this.update()}}},{key:`handleResizerHeader`,value:function(e,t,n){if(this.table){var r=n.clientX,i=n.clientY,a=this.table.getBoundingClientRect();n.shiftKey||(this.lastHeaderSelect=null);var o=[{x:e?a.left:r,y:e?i:a.top},{x:e?a.right:r,y:e?i:a.bottom}];if(this.lastHeaderSelect){var s,c;if(this.lastHeaderSelect.isX){var l=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),u=l[this.lastHeaderSelect.index].getBoundingClientRect();s=Math.min(u.left,a.left),c=u.top+u.height/2}else{var d=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),f=d[this.lastHeaderSelect.index].getBoundingClientRect();s=f.left+f.width/2,c=Math.min(f.top,a.top)}this.lastHeaderSelect.isX===e?e?(o[0].y=Math.min(o[0].y,c),o[1].y=Math.max(o[1].y,c)):(o[0].x=Math.min(o[0].x,s),o[1].x=Math.max(o[1].x,s)):(o[1]={x:Math.max(o[0].x,s),y:Math.max(o[0].y,c)},o[0]={x:Math.min(o[0].x,s),y:Math.min(o[0].y,c)})}else this.lastHeaderSelect={isX:e,index:t};var p=this.tableModule.getModule(`table-selection`);p&&(p.table=this.table,p.setSelectedTds(p.computeSelectedTds.apply(p,o)),p.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`)));ir.call(this,this.tableWrapperBlot.domNode,function(){e.colHeadWrapper.scrollLeft=e.tableWrapperBlot.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`)));ir.call(this,this.tableWrapperBlot.domNode,function(){e.rowHeadWrapper.scrollTop=e.tableWrapperBlot.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=this;if(!(!this.tableBlot||!this.tableWrapperBlot)){var t=Gr(this.tableBlot),n=t.rect;if(n){this.root.innerHTML=``,this.tableCols=this.tableBlot.getCols(),this.tableRows=this.tableBlot.getRows();var r=this.tableWrapperBlot.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect();if(Object.assign(this.root.style,{top:`${Math.max(n.y,r.y)-i.y}px`,left:`${Math.max(n.x,r.x)-i.x}px`}),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(){var t=e.tableModule.getModule(`table-selection`);t&&e.tableBlot&&(t.setSelectedTds(e.tableBlot.descendants(J)),t.show(),t.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">
|
|
132
132
|
<div class="${this.bem.be(`col-separator`)}" style="height: ${n.height+this.size-3}px"></div>
|
|
133
133
|
</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:`${r.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.tableWrapperBlot.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">
|
|
134
134
|
<div class="${this.bem.be(`row-separator`)}" style="width: ${n.width+this.size-3}px"></div>
|
|
135
|
-
</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:`${r.height}px`}),Object.assign(b.style,{height:`${n.height}px`}),b.innerHTML=p,y.appendChild(b),this.root.appendChild(y),y.scrollTop=this.tableWrapperBlot.domNode.scrollTop,this.rowHeadWrapper=y,this.bindRowEvents()}var S=_e(this.tableBlot,Tr),C=F(S,1),w=C[0],T=!w||!(w&&w.side===`top`);T?this.root.classList.remove(this.bem.is(`caption-bottom`)):this.root.classList.add(this.bem.is(`caption-bottom`));var E=-1*this.size,D=-1*this.size;pi(this.tableBlot)?(this.root.classList.add(this.bem.is(`align-right`)),E=Math.min(r.width,n.width),D=Math.min(r.width,n.width)):this.root.classList.remove(this.bem.is(`align-right`)),this.corner&&Object.assign(this.corner.style,{transform:`translateY(${-1*this.size}px) translateX(${E}px)`,top:`${T?0:n.height+this.size}px`}),this.rowHeadWrapper&&Object.assign(this.rowHeadWrapper.style,{transform:`translateX(${D}px)`,maxHeight:`${r.height}px`}),this.colHeadWrapper&&Object.assign(this.colHeadWrapper.style,{top:`${T?0:n.height+this.size}px`,maxWidth:`${r.width}px`})}}}},{key:`show`,value:function(){var e=this;!this.table||!this.tableBlot||!this.tableWrapperBlot||(this.root.classList.remove(this.bem.is(`hidden`)),this.resizeObserver=Kn(function(){return e.update()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.table),this.update(),qn.call(this,this.quill.root,function(){e.update()}))}},{key:`hide`,value:function(){this.root.classList.add(this.bem.is(`hidden`)),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0)}},{key:`destroy`,value:function(){this.hide(),Jn.call(this),this.quill.off(t.default.events.EDITOR_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()}}])}(mi),gi=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,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,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),S(a,`mousemoveHandler`,function(e){if(!a.dragging){var n=a.tableModule.getModule(`table-selection`);if(!(n!=null&&n.dragging)){var r=a.findTableCell(e);if(!r)return a.hide();var i=t.default.find(r);i&&a.currentTableCell!==r&&(a.show(),a.currentTableCell=r,a.tableCellBlot=i,a.tableBlot=H(i,R.tableMain),a.tableBlot.getCols().length>0&&a.updateColResizer(),a.updateRowResizer())}}}),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.quill=r,a.colResizer=a.tableModule.addContainer(a.bem.be(`col`)),a.rowResizer=a.tableModule.addContainer(a.bem.be(`row`)),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),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&&[`TD`,`TH`].includes(r.tagName))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.tableBlot||!this.tableCellBlot||!this.colResizer)){var e=this.tableCellBlot;this.colResizer.remove();var t=Nr(this.tableBlot),n=t.rect;if(n){this.colResizer=this.tableModule.addContainer(this.bem.be(`col`));var r=e.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect(),a=r.right-i.x;pi(this.tableBlot)&&(a=r.left-i.x),Object.assign(this.colResizer.style,{top:`${n.y-i.y}px`,left:`${a}px`,height:`${n.height}px`});var o=this.tableBlot.getCols();this.curColIndex=o.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.tableBlot||!this.tableCellBlot||!this.rowResizer)){var e=this.tableCellBlot;this.rowResizer.remove();var t=Nr(this.tableBlot),n=t.rect;if(n){this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`));var r=e.parent;if(r instanceof Y){var i=e.domNode.getBoundingClientRect(),a=this.quill.root.getBoundingClientRect();Object.assign(this.rowResizer.style,{top:`${i.bottom-a.y}px`,left:`${n.x-a.x}px`,width:`${n.width}px`});var o=this.tableBlot.getRows();this.curRowIndex=o.indexOf(r),this.rowResizer.addEventListener(`mousedown`,this.handleRowMouseDownFunc),this.rowResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}}}},{key:`show`,value:function(){!this.table||!this.rowResizer||!this.colResizer||(this.rowResizer.classList.remove(this.bem.is(`hidden`)),this.colResizer.classList.remove(this.bem.is(`hidden`)),this.table.addEventListener(`mousemove`,this.mousemoveHandler))}},{key:`hide`,value:function(){this.currentTableCell=void 0,!(!this.rowResizer||!this.colResizer)&&(this.rowResizer.classList.add(this.bem.is(`hidden`)),this.colResizer.classList.add(this.bem.is(`hidden`)),this.table&&this.table.removeEventListener(`mousemove`,this.mousemoveHandler))}},{key:`update`,value:function(){this.updateColResizer(),this.updateRowResizer()}},{key:`destroy`,value:function(){this.colResizer&&(this.colResizer.remove(),this.colResizer=void 0),this.rowResizer&&(this.rowResizer.remove(),this.rowResizer=void 0),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange)}}])}(mi),_i=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`scrollHandler`,[]),S(a,`tableMainBlot`,void 0),S(a,`tableWrapperBlot`,void 0),S(a,`bem`,V(`scale`)),S(a,`startX`,0),S(a,`startY`,0),S(a,`offset`,6),S(a,`options`,void 0),S(a,`root`,void 0),S(a,`block`,void 0),S(a,`resizeobserver`,new ResizeObserver(function(){return a.update()})),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r,a.options=a.resolveOptions(i),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{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.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=pi(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,z.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,z.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()})}}},{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=Nr(this.tableMainBlot),t=e.rect;if(t){var n=this.tableWrapperBlot.domNode.getBoundingClientRect(),r=this.quill.root.getBoundingClientRect(),i=this.tableWrapperBlot.domNode,a=i.scrollTop,o=i.scrollLeft,s=this.options.blockSize*2+this.offset,c=Math.min(t.width,n.width)+s,l=Math.min(t.height,n.height)+s;Object.assign(this.root.style,{width:`${c}px`,height:`${l}px`,left:`${Math.max(t.x,n.x)-r.x-this.options.blockSize}px`,top:`${Math.max(t.y,n.y)-r.y-this.options.blockSize}px`});var u={left:`${t.width+s-o}px`,top:`${l-a}px`};pi(this.tableMainBlot)?(this.root.classList.add(this.bem.is(`align-right`)),u.left=`${this.options.blockSize+-1*o}px`):this.root.classList.remove(this.bem.is(`align-right`)),Object.assign(this.block.style,u)}}}},{key:`show`,value:function(){var e=this;this.table&&(this.tableMainBlot=t.default.find(this.table),this.tableMainBlot&&!this.tableMainBlot.full&&(this.tableWrapperBlot=this.tableMainBlot.parent,this.resizeobserver.observe(this.tableMainBlot.domNode),qn.call(this,this.quill.root,function(){return e.update()}),qn.call(this,this.tableWrapperBlot.domNode,function(){return e.update()})),this.buildResizer())}},{key:`hide`,value:function(){this.tableMainBlot=void 0,this.tableWrapperBlot=void 0,this.root&&(this.root.remove(),this.root=void 0,this.block=void 0)}},{key:`destroy`,value:function(){this.hide(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.resizeobserver.disconnect(),Jn.call(this)}}])}(Pr),vi=function(){function e(n,r,i){var a=this;v(this,e),S(this,`quill`,void 0),S(this,`table`,void 0),S(this,`options`,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`,nr(function(){a.cursorLeave=!1,a.scrollbar.removeEventListener(`transitionend`,a.hideScrollbarTransitionend),a.scrollbar.style.display=a.size?`block`:`none`,requestAnimationFrame(function(){a.scrollbar.classList.remove(a.bem.is(`transparent`))})},200)),S(this,`hideScrollbar`,nr(function(){a.cursorLeave=!0,!a.cursorDown&&(a.scrollbar.removeEventListener(`transitionend`,a.hideScrollbarTransitionend),a.scrollbar.addEventListener(`transitionend`,a.hideScrollbarTransitionend,{once:!0}),a.scrollbar.classList.add(a.bem.is(`transparent`)))},200)),S(this,`hideScrollbarTransitionend`,function(){a.scrollbar.style.display=a.cursorDown&&a.size?`block`:`none`}),this.quill=n,this.table=r,this.options=i,this.tableMainBlot=t.default.find(this.table),this.container=r.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(){return a.update()}),this.ob.observe(r),this.scrollbar=this.createScrollbar(),this.setScrollbarPosition(),qn.call(this,this.quill.root,function(){return a.setScrollbarPosition()}),this.showScrollbar()}return b(e,[{key:`isVertical`,get:function(){return this.options.isVertical}},{key:`update`,value:function(){this.calculateSize(),this.setScrollbarPosition()}},{key:`setScrollbarPosition`,value:function(){var e=Nr(this.tableMainBlot),t=e.rect,n=e.head,r=e.body,i=e.foot,a=n||r||i;if(!(!a||!t)){var o=this.quill.root,s=o.scrollLeft,c=o.scrollTop,l=o.offsetLeft,u=o.offsetTop,d=this.container,f=d.offsetLeft,p=d.offsetTop,m=a.domNode,h=m.offsetLeft,g=m.offsetTop,_=this.container.getBoundingClientRect(),v=_.width,y=_.height,b=f+h-l,x=p+g-u;this.isVertical?b+=Math.min(v,t.width):x+=Math.min(y,t.height),this.tableMainBlot&&this.tableMainBlot.align!==`left`&&(b+=this.table.offsetLeft-f),Object.assign(this.scrollbar.style,S(S({},this.propertyMap.size,`${this.isVertical?Math.min(y,t.height):v}px`),`transform`,`translate(${b-s}px, ${x-c}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 qn.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(),Jn.call(this),this.table.removeEventListener(`mouseenter`,this.showScrollbar),this.table.removeEventListener(`mouseleave`,this.hideScrollbar)}}])}(),yi=function(e){function n(e,r,i){var a;v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`scrollbarContainer`,void 0),S(a,`scrollbar`,[]),S(a,`bem`,V(`scrollbar`)),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r;var o=V(`scrollbar`);return a.quill.container.classList.add(o.bm(`virtual`)),a.scrollbarContainer=a.tableModule.addContainer(a.bem.be(`container`)),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{key:`hide`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.destroy()}}catch(t){e.e(t)}finally{e.f()}this.scrollbar=[],this.scrollbarContainer.innerHTML=``}},{key:`show`,value:function(){if(this.table){this.scrollbar=[new vi(this.quill,this.table,{isVertical:!0}),new vi(this.quill,this.table,{isVertical:!1})];var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.scrollbarContainer.appendChild(n.scrollbar),n.showScrollbar()}}catch(t){e.e(t)}finally{e.f()}}}},{key:`update`,value:function(){if(this.table){this.scrollbar.length<=0&&this.show();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()}}else this.scrollbar.length>0&&this.hide()}},{key:`destroy`,value:function(){this.hide(),this.scrollbarContainer.remove(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}}])}(Pr);S(yi,`moduleName`,`table-scrollbar`);var bi=0,xi=function(e){function n(e,r){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return v(this,n),i=_(this,n,[e,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),S(i,`options`,void 0),S(i,`boundary`,null),S(i,`scrollRecordEls`,[]),S(i,`startScrollRecordPosition`,[]),S(i,`selectedTableScrollX`,0),S(i,`selectedTableScrollY`,0),S(i,`selectedEditorScrollX`,0),S(i,`selectedEditorScrollY`,0),S(i,`selectedTds`,[]),S(i,`cellSelectWrap`,void 0),S(i,`cellSelect`,void 0),S(i,`scrollHandler`,[]),S(i,`resizeObserver`,void 0),S(i,`isDisplaySelection`,!1),S(i,`bem`,V(`selection`)),S(i,`lastSelection`,{anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0}),S(i,`_dragging`,!1),S(i,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(i.table&&!i.quill.root.contains(i.table)?i.setSelectionTable(void 0):i.updateAfterEvent())}),S(i,`updateAfterEvent`,function(){for(var e=[],t=0;t<i.selectedTds.length;t++){var n=i.selectedTds[t];i.quill.root.contains(n.domNode)&&e.push(n)}i.selectedTds=e,i.updateWithSelectedTds()}),S(i,`removeCell`,function(e){var n=i.quill.getSelection(),r=document.activeElement;if(!(n||e.key!==`Backspace`&&e.key!==`Delete`||!i.quill.root.contains(r))){if(i.table){var a=t.default.find(i.table),o=a.descendants(J);if(i.selectedTds.length===o.length){a.remove();return}}var s=x(i.selectedTds),c;try{for(s.s();!(c=s.n()).done;){var l=c.value;l.deleteAt(0,l.length()-1)}}catch(e){s.e(e)}finally{s.f()}}}),S(i,`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[R.tableCellInner]&&!!c,u=c&&i.selectedTds.some(function(e){return e.domNode.contains(c.domNode)});if(l&&!u)try{var d=H(c,R.tableCellInner);i.setSelectedTds([d]),i.updateWithSelectedTds()}catch(e){}else l&&u||i.hide()}}),i.tableModule=e,i.quill=r,i.options=i.resolveOptions(a),i.scrollRecordEls=[i.quill.root,document.documentElement],i.cellSelectWrap=e.addContainer(i.bem.b()),i.cellSelect=i.helpLinesInitial(),i.resizeObserver=Kn(i.updateAfterEvent,{ignoreFirstBind:!0}),i.resizeObserver.observe(i.quill.root),i.quill.emitter.listenDOM(`selectionchange`,document,i.selectionChangeHandler.bind(i)),i.quill.on(B.AFTER_TABLE_RESIZE,i.updateAfterEvent),i.quill.on(t.default.events.SELECTION_CHANGE,i.quillSelectionChangeHandler),i.quill.on(t.default.events.EDITOR_CHANGE,i.updateWhenTextChange),i.hide(),i}return T(n,e),b(n,[{key:`dragging`,get:function(){return this._dragging},set:function(e){this._dragging!==e&&(this._dragging=e,this.quill.emitter.emit(e?B.TABLE_SELECTION_DRAG_START:B.TABLE_SELECTION_DRAG_END,this))}},{key:`setSelectedTds`,value:function(e){var t=new Set(this.selectedTds),n=this.selectedTds.length===e.length&&e.every(function(e){return t.has(e)});this.selectedTds=e,n||this.quill.emitter.emit(B.TABLE_SELECTION_CHANGE,this,this.selectedTds)}},{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`},e)}},{key:`selectionChangeHandler`,value:function(){var e=window.getSelection();if(e){var n=e.anchorNode,r=e.focusNode,i=e.anchorOffset,a=e.focusOffset;if(!(!n||!r)){var o=t.default.find(n),s=t.default.find(r);if(!(!o||!s||o.scroll!==this.quill.scroll||s.scroll!==this.quill.scroll)){var c=ge(o),l=ge(s),u=c.has(R.tableColgroup),d=l.has(R.tableColgroup);if(u||d){var f=n,p=i,m=r,h=a;if(u){var g=c.get(R.tableWrapper),_=g.descendants(J);_.length>0&&(f=_[0].domNode,p=0)}if(d){var v=l.get(R.tableWrapper),y=v.descendants(J);y.length>0&&(m=y[0].domNode,h=0)}this.setSelectionData(e,{anchorNode:f,anchorOffset:p,focusNode:m,focusOffset:h});return}var b=c.has(R.tableCellInner),x=l.has(R.tableCellInner),S=b&&x;if(S){var C=c.get(R.tableCellInner),w=l.get(R.tableCellInner);S&&(S=C!==w)}if(b&&x&&S||!b&&x||!x&&b){this.setSelectionData(e,this.lastSelection),this.selectedTds.length>0&&this.hide();return}this.lastSelection={anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:a}}}}}},{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=new Set(r.descendants(X).map(function(e,t){return e.index=t,e})),a=this.getScrollPositionDiff(),o=Nr(r),s=o.rect;if(!s)return[];for(var c=e.x+a.x,l=e.y+a.y,u={x:Math.max(s.left,Math.min(n.x,c)),y:Math.max(s.top,Math.min(n.y,l)),x1:Math.min(s.right,Math.max(n.x,c)),y1:Math.min(s.bottom,Math.max(n.y,l))},d=new Set,f=!0;f;){f=!1;var p=x(i),m;try{for(p.s();!(m=p.n()).done;){var h=m.value;h.__rect||(h.__rect=h.domNode.getBoundingClientRect());var g=h.__rect,_=g.x,v=g.y,y=g.right,b=g.bottom;if(Hn({x:Math.floor(u.x),y:Math.floor(u.y),x1:Math.floor(u.x1),y1:Math.floor(u.y1)},{x:Math.floor(_),y:Math.floor(v),x1:Math.floor(y),y1:Math.floor(b)},bi,d.size===0)){d.add(h),i.delete(h),u={x:Math.min(u.x,_),y:Math.min(u.y,v),x1:Math.max(u.x1,y),y1:Math.max(u.y1,b)},f=!0;break}}}catch(e){p.e(e)}finally{p.f()}}for(var S=0,C=[].concat(L(d),L(i));S<C.length;S++){var w=C[S];delete w.__rect}return this.boundary=Un(M(M({},u),{},{width:u.x1-u.x,height:u.y1-u.y}),this.quill.root),Array.from(d).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=Yn(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=Yn(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(Yn(n))}}catch(t){e.e(t)}finally{e.f()}}},{key:`clearRecordScrollPosition`,value:function(){this.startScrollRecordPosition=[]}},{key:`tableSelectHandler`,value:function(e){var t=this,n=e.button,r=e.target,i=e.clientX,a=e.clientY,o=r.closest(`table`),s=r.closest(`caption`);if(!(n!==0||!o||s)){this.setSelectionTable(o);var c=o.dataset.tableId,l={x:i,y:a};this.recordScrollPosition(),this.setSelectedTds(this.computeSelectedTds(l,l)),this.show();var u=function(e){t.dragging=!0;var n=e.button,r=e.target,i=e.clientX,a=e.clientY,o=r.closest(`.ql-table`),s=r.closest(`caption`);if(!(n!==0||s||!o||o.dataset.tableId!==c)){var u={x:i,y:a};t.setSelectedTds(t.computeSelectedTds(l,u)),t.selectedTds.length>1&&t.quill.blur(),t.update()}},d=function(){document.body.removeEventListener(`mousemove`,u,!1),document.body.removeEventListener(`mouseup`,d,!1),t.dragging=!1,t.clearRecordScrollPosition()};document.body.addEventListener(`mousemove`,u,!1),document.body.addEventListener(`mouseup`,d,!1)}}},{key:`updateWithSelectedTds`,value:function(){if(this.selectedTds.length<=0){this.hide();return}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.setSelectedTds(this.computeSelectedTds(e,t)),this.selectedTds.length>0?this.update():this.hide()}},{key:`update`,value:function(){if(!this.table){this.hide();return}if(!(this.selectedTds.length===0||!this.boundary)){var e=Yn(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.quill.emitter.emit(B.TABLE_SELECTION_DISPLAY_CHANGE,this)}}},{key:`getTableViewScroll`,value:function(){return this.table?Yn(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&&(Jn.call(this),this.showDisplay(),this.update(),this.quill.root.addEventListener(`keydown`,this.removeCell),qn.call(this,this.quill.root,function(){e.update()}),qn.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(){Jn.call(this),this.quill.root.removeEventListener(`keydown`,this.removeCell),this.hideDisplay(),this.boundary=null,this.setSelectedTds([]),this.setSelectionTable(void 0)}},{key:`destroy`,value:function(){this.resizeObserver.disconnect(),this.hide(),this.cellSelectWrap.remove(),Jn.call(this),this.quill.off(B.AFTER_TABLE_RESIZE,this.updateAfterEvent),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange),this.quill.off(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler)}}])}(Pr);S(xi,`moduleName`,`table-selection`);var Si=[`attributes`],Ci=[`style`],wi=[`emptyRow`],Ti=t.default.import(`parchment`),Ei=t.default.import(`delta`),Di=t.default.import(`ui/icons`),Oi=t.default.import(`blots/break`),ki=t.default.import(`blots/block`),Ai=t.default.import(`blots/block/embed`);function ji(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(R.tableCell,a),s=e.create(R.tableCellInner,a),c=e.create(`block`);return c.appendChild(e.create(`break`)),s.appendChild(c),o.appendChild(s),o}function Mi(e){fe.delete(R.tableCellInner),Object.assign(R,e.blotName||{}),Object.assign(z,e.tableUpSize||{}),Object.assign(B,e.tableUpEvent||{}),Object.assign(le,e.tableUpInternal||{}),Fi.moduleName=le.moduleName,Fi.toolName=R.tableWrapper,K.blotName=R.container,Tr.blotName=R.tableCaption,Mr.blotName=R.tableWrapper,Z.blotName=R.tableMain,Or.blotName=R.tableColgroup,Dr.blotName=R.tableCol,Ar.blotName=R.tableHead,q.blotName=R.tableBody,kr.blotName=R.tableFoot,Y.blotName=R.tableRow,X.blotName=R.tableCell,J.blotName=R.tableCellInner,fe.add(R.tableCellInner)}function Ni(e,n){return He({onSelect:function(r,i){e.insertTable(r,i,t.default.sources.USER),n&&n.close()},customBtn:e.options.customBtn,texts:e.options.texts})}function Pi(e){return{bindInHead:!1,key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[R.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,[R.tableWrapper,R.tableMain,R.tableRow,R.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(Tr,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 Fi=function(){function e(t,n){var r=this;v(this,e),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`toolBox`,void 0),S(this,`fixTableByLisenter`,nr(this.balanceTables,100)),S(this,`selector`,void 0),S(this,`resizeOb`,void 0),S(this,`modules`,{}),this.quill=t,this.options=this.resolveOptions(n||{}),this.toolBox=this.initialContainer();var i=this.quill.getModule(`toolbar`);if(i&&this.quill.theme.pickers){var a=(i.controls||[]).find(function(e){var t=F(e,1),n=t[0];return n===r.statics.toolName})||[],o=F(a,2),s=o[1];if(s&&s.tagName.toLocaleLowerCase()===`select`){var c=this.quill.theme.pickers.find(function(e){return e.select===s});c&&(c.label.innerHTML=this.options.icon,this.buildCustomSelect(this.options.customSelect,c),c.label.addEventListener(`mousedown`,function(){if(!(!r.selector||!c)){var e=r.selector.getBoundingClientRect(),t=Gn(e),n=t.leftLimited;if(n){var i=c.label.getBoundingClientRect();Object.assign(c.options.style,{transform:`translateX(calc(-100% + ${i.width}px))`})}else Object.assign(c.options.style,{transform:void 0})}}))}}for(var l=this.quill.getModule(`keyboard`),u=0,d=Object.values(e.keyboradHandler);u<d.length;u++){var f=d[u];f.bindInHead?l.bindings[f.key].unshift(f):l.addBinding(f.key,f)}this.initModules(),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:Di.table,autoMergeCell:!0,modules:[]},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:`initModules`,value:function(){var e=x(this.options.modules),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.modules[n.module.moduleName]=new n.module(this,this.quill,n.options)}}catch(t){e.e(t)}finally{e.f()}}},{key:`getModule`,value:function(e){return this.modules[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/${R.tableWrapper}`),s=new DOMParser,c=s.parseFromString(a,`text/html`),l=0,u=Array.from(c.querySelectorAll(`.${o.className} caption[contenteditable], .${o.className} .${X.className} > [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 Ti.EmbedBlot)){var o=this.getModule(le.moduleName),s=this.getSelection(!0),c=this.getFormat(s),l=o.getModule(`table-selection`);if(!c[R.tableCellInner]||s.length>0||o&&l&&l.selectedTds.length<=1)return r.call(this,e,n,i);if(o&&l&&l.selectedTds.length>0){var u=l.selectedTds,d=!1,f=[],p=x(u),m;try{for(p.s();!(m=p.n()).done;){var h=m.value,g=h.offset(this.scroll),_=h.length();f.push({index:g,length:_});var v=this.getFormat(g,_);v[e]!==n&&(d=!0)}}catch(e){p.e(e)}finally{p.f()}var y=d?n:!1,b=new Ei,C=x(f.entries()),w;try{for(C.s();!(w=C.n()).done;){var T=F(w.value,2),E=T[0],D=T[1],O=D.index,k=D.length,A=E===0?0:f[E-1].index+f[E-1].length;b.retain(O-A).retain(k,S({},e,y))}}catch(e){C.e(e)}finally{C.f()}var j=this.updateContents(b,i);return this.blur(),j}}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 Ei;s!=null&&(l=s.length()-c,u=s.delta().slice(c,c+l-1).insert(`
|
|
136
|
-
`));var d=e.quill.getContents(t,n+l),f=d.diff(new
|
|
135
|
+
</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:`${r.height}px`}),Object.assign(b.style,{height:`${n.height}px`}),b.innerHTML=p,y.appendChild(b),this.root.appendChild(y),y.scrollTop=this.tableWrapperBlot.domNode.scrollTop,this.rowHeadWrapper=y,this.bindRowEvents()}var S=_e(this.tableBlot,Lr),C=F(S,1),w=C[0],T=!w||!(w&&w.side===`top`);T?this.root.classList.remove(this.bem.is(`caption-bottom`)):this.root.classList.add(this.bem.is(`caption-bottom`));var E=-1*this.size,D=-1*this.size;Ti(this.tableBlot)?(this.root.classList.add(this.bem.is(`align-right`)),E=Math.min(r.width,n.width),D=Math.min(r.width,n.width)):this.root.classList.remove(this.bem.is(`align-right`)),this.corner&&Object.assign(this.corner.style,{transform:`translateY(${-1*this.size}px) translateX(${E}px)`,top:`${T?0:n.height+this.size}px`}),this.rowHeadWrapper&&Object.assign(this.rowHeadWrapper.style,{transform:`translateX(${D}px)`,maxHeight:`${r.height}px`}),this.colHeadWrapper&&Object.assign(this.colHeadWrapper.style,{top:`${T?0:n.height+this.size}px`,maxWidth:`${r.width}px`})}}}},{key:`show`,value:function(){var e=this;!this.table||!this.tableBlot||!this.tableWrapperBlot||(this.root.classList.remove(this.bem.is(`hidden`)),this.resizeObserver=rr(function(){return e.update()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.table),this.update(),ir.call(this,this.quill.root,function(){e.update()}))}},{key:`hide`,value:function(){this.root.classList.add(this.bem.is(`hidden`)),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0)}},{key:`destroy`,value:function(){this.hide(),ar.call(this),this.quill.off(t.default.events.EDITOR_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()}}])}(Ei),Oi=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,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,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),S(a,`mousemoveHandler`,function(e){if(!a.dragging){var n=a.tableModule.getModule(`table-selection`);if(!(n!=null&&n.dragging)){var r=a.findTableCell(e);if(!r)return a.hide();var i=t.default.find(r);i&&a.currentTableCell!==r&&(a.show(),a.currentTableCell=r,a.tableCellBlot=i,a.tableBlot=H(i,R.tableMain),a.tableBlot.getCols().length>0&&a.updateColResizer(),a.updateRowResizer())}}}),S(a,`handleColMouseUpFunc`,g(P().mark(function e(){return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,this.handleColMouseUp();case 1:this.updateColResizer();case 2:case`end`:return e.stop()}},e,this)})).bind(a)),S(a,`handleRowMouseUpFunc`,function(){this.handleRowMouseUp(),this.updateRowResizer()}.bind(a)),a.tableModule=e,a.quill=r,a.colResizer=a.tableModule.addContainer(a.bem.be(`col`)),a.rowResizer=a.tableModule.addContainer(a.bem.be(`row`)),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),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&&[`TD`,`TH`].includes(r.tagName))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.tableBlot||!this.tableCellBlot||!this.colResizer)){var e=this.tableCellBlot;this.colResizer.remove();var t=Gr(this.tableBlot),n=t.rect;if(n){this.colResizer=this.tableModule.addContainer(this.bem.be(`col`));var r=e.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect(),a=r.right-i.x;Ti(this.tableBlot)&&(a=r.left-i.x),Object.assign(this.colResizer.style,{top:`${n.y-i.y}px`,left:`${a}px`,height:`${n.height}px`});var o=this.tableBlot.getCols();this.curColIndex=o.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.tableBlot||!this.tableCellBlot||!this.rowResizer)){var e=this.tableCellBlot;this.rowResizer.remove();var t=Gr(this.tableBlot),n=t.rect;if(n){this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`));var r=e.parent;if(r instanceof Y){var i=e.domNode.getBoundingClientRect(),a=this.quill.root.getBoundingClientRect();Object.assign(this.rowResizer.style,{top:`${i.bottom-a.y}px`,left:`${n.x-a.x}px`,width:`${n.width}px`});var o=this.tableBlot.getRows();this.curRowIndex=o.indexOf(r),this.rowResizer.addEventListener(`mousedown`,this.handleRowMouseDownFunc),this.rowResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}}}},{key:`show`,value:function(){!this.table||!this.rowResizer||!this.colResizer||(this.rowResizer.classList.remove(this.bem.is(`hidden`)),this.colResizer.classList.remove(this.bem.is(`hidden`)),this.table.addEventListener(`mousemove`,this.mousemoveHandler))}},{key:`hide`,value:function(){this.currentTableCell=void 0,!(!this.rowResizer||!this.colResizer)&&(this.rowResizer.classList.add(this.bem.is(`hidden`)),this.colResizer.classList.add(this.bem.is(`hidden`)),this.table&&this.table.removeEventListener(`mousemove`,this.mousemoveHandler))}},{key:`update`,value:function(){this.updateColResizer(),this.updateRowResizer()}},{key:`destroy`,value:function(){this.colResizer&&(this.colResizer.remove(),this.colResizer=void 0),this.rowResizer&&(this.rowResizer.remove(),this.rowResizer=void 0),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange)}}])}(Ei),ki=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`scrollHandler`,[]),S(a,`tableMainBlot`,void 0),S(a,`tableWrapperBlot`,void 0),S(a,`bem`,V(`scale`)),S(a,`startX`,0),S(a,`startY`,0),S(a,`offset`,6),S(a,`options`,void 0),S(a,`root`,void 0),S(a,`block`,void 0),S(a,`resizeobserver`,new ResizeObserver(function(){return a.update()})),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r,a.options=a.resolveOptions(i),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{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.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=Ti(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,z.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,z.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()})}}},{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=Gr(this.tableMainBlot),t=e.rect;if(t){var n=this.tableWrapperBlot.domNode.getBoundingClientRect(),r=this.quill.root.getBoundingClientRect(),i=this.tableWrapperBlot.domNode,a=i.scrollTop,o=i.scrollLeft,s=this.options.blockSize*2+this.offset,c=Math.min(t.width,n.width)+s,l=Math.min(t.height,n.height)+s;Object.assign(this.root.style,{width:`${c}px`,height:`${l}px`,left:`${Math.max(t.x,n.x)-r.x-this.options.blockSize}px`,top:`${Math.max(t.y,n.y)-r.y-this.options.blockSize}px`});var u={left:`${t.width+s-o}px`,top:`${l-a}px`};Ti(this.tableMainBlot)?(this.root.classList.add(this.bem.is(`align-right`)),u.left=`${this.options.blockSize+-1*o}px`):this.root.classList.remove(this.bem.is(`align-right`)),Object.assign(this.block.style,u)}}}},{key:`show`,value:function(){var e=this;this.table&&(this.tableMainBlot=t.default.find(this.table),this.tableMainBlot&&!this.tableMainBlot.full&&(this.tableWrapperBlot=this.tableMainBlot.parent,this.resizeobserver.observe(this.tableMainBlot.domNode),ir.call(this,this.quill.root,function(){return e.update()}),ir.call(this,this.tableWrapperBlot.domNode,function(){return e.update()})),this.buildResizer())}},{key:`hide`,value:function(){this.tableMainBlot=void 0,this.tableWrapperBlot=void 0,this.root&&(this.root.remove(),this.root=void 0,this.block=void 0)}},{key:`destroy`,value:function(){this.hide(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.resizeobserver.disconnect(),ar.call(this)}}])}(Kr),Ai=function(){function e(n,r,i){var a=this;v(this,e),S(this,`quill`,void 0),S(this,`table`,void 0),S(this,`options`,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`,pr(function(){a.cursorLeave=!1,a.scrollbar.removeEventListener(`transitionend`,a.hideScrollbarTransitionend),a.scrollbar.style.display=a.size?`block`:`none`,requestAnimationFrame(function(){a.scrollbar.classList.remove(a.bem.is(`transparent`))})},200)),S(this,`hideScrollbar`,pr(function(){a.cursorLeave=!0,!a.cursorDown&&(a.scrollbar.removeEventListener(`transitionend`,a.hideScrollbarTransitionend),a.scrollbar.addEventListener(`transitionend`,a.hideScrollbarTransitionend,{once:!0}),a.scrollbar.classList.add(a.bem.is(`transparent`)))},200)),S(this,`hideScrollbarTransitionend`,function(){a.scrollbar.style.display=a.cursorDown&&a.size?`block`:`none`}),this.quill=n,this.table=r,this.options=i,this.tableMainBlot=t.default.find(this.table),this.container=r.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(){return a.update()}),this.ob.observe(r),this.scrollbar=this.createScrollbar(),this.setScrollbarPosition(),ir.call(this,this.quill.root,function(){return a.setScrollbarPosition()}),this.showScrollbar()}return b(e,[{key:`isVertical`,get:function(){return this.options.isVertical}},{key:`update`,value:function(){this.calculateSize(),this.setScrollbarPosition()}},{key:`setScrollbarPosition`,value:function(){var e=Gr(this.tableMainBlot),t=e.rect,n=e.head,r=e.body,i=e.foot,a=n||r||i;if(!(!a||!t)){var o=this.quill.root,s=o.scrollLeft,c=o.scrollTop,l=o.offsetLeft,u=o.offsetTop,d=this.container,f=d.offsetLeft,p=d.offsetTop,m=a.domNode,h=m.offsetLeft,g=m.offsetTop,_=this.container.getBoundingClientRect(),v=_.width,y=_.height,b=f+h-l,x=p+g-u;this.isVertical?b+=Math.min(v,t.width):x+=Math.min(y,t.height),this.tableMainBlot&&this.tableMainBlot.align!==`left`&&(b+=this.table.offsetLeft-f),Object.assign(this.scrollbar.style,S(S({},this.propertyMap.size,`${this.isVertical?Math.min(y,t.height):v}px`),`transform`,`translate(${b-s}px, ${x-c}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 ir.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(),ar.call(this),this.table.removeEventListener(`mouseenter`,this.showScrollbar),this.table.removeEventListener(`mouseleave`,this.hideScrollbar)}}])}(),ji=function(e){function n(e,r,i){var a;v(this,n),a=_(this,n,[e,r]),S(a,`tableModule`,void 0),S(a,`quill`,void 0),S(a,`scrollbarContainer`,void 0),S(a,`scrollbar`,[]),S(a,`bem`,V(`scrollbar`)),S(a,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(a.table&&!a.quill.root.contains(a.table)?a.setSelectionTable(void 0):a.update())}),a.tableModule=e,a.quill=r;var o=V(`scrollbar`);return a.quill.container.classList.add(o.bm(`virtual`)),a.scrollbarContainer=a.tableModule.addContainer(a.bem.be(`container`)),a.quill.on(t.default.events.EDITOR_CHANGE,a.updateWhenTextChange),a}return T(n,e),b(n,[{key:`hide`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.destroy()}}catch(t){e.e(t)}finally{e.f()}this.scrollbar=[],this.scrollbarContainer.innerHTML=``}},{key:`show`,value:function(){if(this.table){this.scrollbar=[new Ai(this.quill,this.table,{isVertical:!0}),new Ai(this.quill,this.table,{isVertical:!1})];var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.scrollbarContainer.appendChild(n.scrollbar),n.showScrollbar()}}catch(t){e.e(t)}finally{e.f()}}}},{key:`update`,value:function(){if(this.table){this.scrollbar.length<=0&&this.show();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()}}else this.scrollbar.length>0&&this.hide()}},{key:`destroy`,value:function(){this.hide(),this.scrollbarContainer.remove(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}}])}(Kr);S(ji,`moduleName`,`table-scrollbar`);var Mi=0,Ni=function(e){function n(e,r){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return v(this,n),i=_(this,n,[e,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),S(i,`options`,void 0),S(i,`boundary`,null),S(i,`scrollRecordEls`,[]),S(i,`startScrollRecordPosition`,[]),S(i,`selectedTableScrollX`,0),S(i,`selectedTableScrollY`,0),S(i,`selectedEditorScrollX`,0),S(i,`selectedEditorScrollY`,0),S(i,`selectedTds`,[]),S(i,`cellSelectWrap`,void 0),S(i,`cellSelect`,void 0),S(i,`scrollHandler`,[]),S(i,`resizeObserver`,void 0),S(i,`isDisplaySelection`,!1),S(i,`bem`,V(`selection`)),S(i,`lastSelection`,{anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0}),S(i,`_dragging`,!1),S(i,`updateWhenTextChange`,function(e){e===t.default.events.TEXT_CHANGE&&(i.table&&!i.quill.root.contains(i.table)?i.setSelectionTable(void 0):i.updateAfterEvent())}),S(i,`updateAfterEvent`,function(){for(var e=[],t=0;t<i.selectedTds.length;t++){var n=i.selectedTds[t];i.quill.root.contains(n.domNode)&&e.push(n)}i.selectedTds=e,i.updateWithSelectedTds()}),S(i,`removeCell`,function(e){var n=i.quill.getSelection(),r=document.activeElement;if(!(n||e.key!==`Backspace`&&e.key!==`Delete`||!i.quill.root.contains(r))){if(i.table){var a=t.default.find(i.table),o=a.descendants(J);if(i.selectedTds.length===o.length){a.remove();return}}var s=x(i.selectedTds),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=l.clone();u.appendChild(l.scroll.create(`block`)),l.parent.insertBefore(u,l),l.remove()}}catch(e){s.e(e)}finally{s.f()}}}),S(i,`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[R.tableCellInner]&&!!c,u=c&&i.selectedTds.some(function(e){return e.domNode.contains(c.domNode)});if(l&&!u)try{var d=H(c,R.tableCellInner);i.setSelectedTds([d]),i.updateWithSelectedTds()}catch(e){}else l&&u||i.hide()}}),i.tableModule=e,i.quill=r,i.options=i.resolveOptions(a),i.scrollRecordEls=[i.quill.root,document.documentElement],i.cellSelectWrap=e.addContainer(i.bem.b()),i.cellSelect=i.helpLinesInitial(),i.resizeObserver=rr(i.updateAfterEvent,{ignoreFirstBind:!0}),i.resizeObserver.observe(i.quill.root),i.quill.emitter.listenDOM(`selectionchange`,document,i.selectionChangeHandler.bind(i)),i.quill.on(B.AFTER_TABLE_RESIZE,i.updateAfterEvent),i.quill.on(t.default.events.SELECTION_CHANGE,i.quillSelectionChangeHandler),i.quill.on(t.default.events.EDITOR_CHANGE,i.updateWhenTextChange),i.hide(),i}return T(n,e),b(n,[{key:`dragging`,get:function(){return this._dragging},set:function(e){this._dragging!==e&&(this._dragging=e,this.quill.emitter.emit(e?B.TABLE_SELECTION_DRAG_START:B.TABLE_SELECTION_DRAG_END,this))}},{key:`setSelectedTds`,value:function(e){var t=new Set(this.selectedTds),n=this.selectedTds.length===e.length&&e.every(function(e){return t.has(e)});this.selectedTds=e,n||this.quill.emitter.emit(B.TABLE_SELECTION_CHANGE,this,this.selectedTds)}},{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`},e)}},{key:`selectionChangeHandler`,value:function(){var e=window.getSelection();if(e){var n=e.anchorNode,r=e.focusNode,i=e.anchorOffset,a=e.focusOffset;if(!(!n||!r)){var o=t.default.find(n),s=t.default.find(r);if(!(!o||!s||o.scroll!==this.quill.scroll||s.scroll!==this.quill.scroll)){var c=ge(o),l=ge(s),u=c.has(R.tableColgroup),d=l.has(R.tableColgroup);if(u||d){var f=n,p=i,m=r,h=a;if(u){var g=c.get(R.tableWrapper),_=g.descendants(J);_.length>0&&(f=_[0].domNode,p=0)}if(d){var v=l.get(R.tableWrapper),y=v.descendants(J);y.length>0&&(m=y[0].domNode,h=0)}this.setSelectionData(e,{anchorNode:f,anchorOffset:p,focusNode:m,focusOffset:h});return}var b=c.has(R.tableCellInner),x=l.has(R.tableCellInner),S=b&&x;if(S){var C=c.get(R.tableCellInner),w=l.get(R.tableCellInner);S&&(S=C!==w)}if(b&&x&&S||!b&&x||!x&&b){this.setSelectionData(e,this.lastSelection),this.selectedTds.length>0&&this.hide();return}this.lastSelection={anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:a}}}}}},{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=new Set(r.descendants(X).map(function(e,t){return e.index=t,e})),a=this.getScrollPositionDiff(),o=Gr(r),s=o.rect;if(!s)return[];for(var c=e.x+a.x,l=e.y+a.y,u={x:Math.max(s.left,Math.min(n.x,c)),y:Math.max(s.top,Math.min(n.y,l)),x1:Math.min(s.right,Math.max(n.x,c)),y1:Math.min(s.bottom,Math.max(n.y,l))},d=new Set,f=!0;f;){f=!1;var p=x(i),m;try{for(p.s();!(m=p.n()).done;){var h=m.value;h.__rect||(h.__rect=h.domNode.getBoundingClientRect());var g=h.__rect,_=g.x,v=g.y,y=g.right,b=g.bottom;if($n({x:Math.floor(u.x),y:Math.floor(u.y),x1:Math.floor(u.x1),y1:Math.floor(u.y1)},{x:Math.floor(_),y:Math.floor(v),x1:Math.floor(y),y1:Math.floor(b)},Mi,d.size===0)){d.add(h),i.delete(h),u={x:Math.min(u.x,_),y:Math.min(u.y,v),x1:Math.max(u.x1,y),y1:Math.max(u.y1,b)},f=!0;break}}}catch(e){p.e(e)}finally{p.f()}}for(var S=0,C=[].concat(L(d),L(i));S<C.length;S++){var w=C[S];delete w.__rect}return this.boundary=er(M(M({},u),{},{width:u.x1-u.x,height:u.y1-u.y}),this.quill.root),Array.from(d).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=or(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=or(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(or(n))}}catch(t){e.e(t)}finally{e.f()}}},{key:`clearRecordScrollPosition`,value:function(){this.startScrollRecordPosition=[]}},{key:`tableSelectHandler`,value:function(e){var t=this,n=e.button,r=e.target,i=e.clientX,a=e.clientY,o=r.closest(`table`),s=r.closest(`caption`);if(!(n!==0||!o||s)){this.setSelectionTable(o);var c=o.dataset.tableId,l={x:i,y:a};this.recordScrollPosition(),this.setSelectedTds(this.computeSelectedTds(l,l)),this.show();var u=function(e){t.dragging=!0;var n=e.button,r=e.target,i=e.clientX,a=e.clientY,o=r.closest(`.ql-table`),s=r.closest(`caption`);if(!(n!==0||s||!o||o.dataset.tableId!==c)){var u={x:i,y:a};t.setSelectedTds(t.computeSelectedTds(l,u)),t.selectedTds.length>1&&t.quill.blur(),t.update()}},d=function(){document.body.removeEventListener(`mousemove`,u,!1),document.body.removeEventListener(`mouseup`,d,!1),t.dragging=!1,t.clearRecordScrollPosition()};document.body.addEventListener(`mousemove`,u,!1),document.body.addEventListener(`mouseup`,d,!1)}}},{key:`updateWithSelectedTds`,value:function(){if(this.selectedTds.length<=0){this.hide();return}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.setSelectedTds(this.computeSelectedTds(e,t)),this.selectedTds.length>0?this.update():this.hide()}},{key:`update`,value:function(){if(!this.table){this.hide();return}if(!(this.selectedTds.length===0||!this.boundary)){var e=or(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.quill.emitter.emit(B.TABLE_SELECTION_DISPLAY_CHANGE,this)}}},{key:`getTableViewScroll`,value:function(){return this.table?or(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&&(ar.call(this),this.showDisplay(),this.update(),this.quill.root.addEventListener(`keydown`,this.removeCell),ir.call(this,this.quill.root,function(){e.update()}),ir.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(){ar.call(this),this.quill.root.removeEventListener(`keydown`,this.removeCell),this.hideDisplay(),this.boundary=null,this.setSelectedTds([]),this.setSelectionTable(void 0)}},{key:`destroy`,value:function(){this.resizeObserver.disconnect(),this.hide(),this.cellSelectWrap.remove(),ar.call(this),this.quill.off(B.AFTER_TABLE_RESIZE,this.updateAfterEvent),this.quill.off(t.default.events.EDITOR_CHANGE,this.updateWhenTextChange),this.quill.off(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler)}}])}(Kr);S(Ni,`moduleName`,`table-selection`);var Pi=[`attributes`],Fi=[`style`],Ii=[`emptyRow`],Li=t.default.import(`parchment`),Ri=t.default.import(`delta`),zi=t.default.import(`ui/icons`),Bi=t.default.import(`blots/break`),Vi=t.default.import(`blots/block`),Hi=t.default.import(`blots/block/embed`);function Ui(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(R.tableCell,a),s=e.create(R.tableCellInner,a),c=e.create(`block`);return c.appendChild(e.create(`break`)),s.appendChild(c),o.appendChild(s),o}function Wi(e){fe.delete(R.tableCellInner),Object.assign(R,e.blotName||{}),Object.assign(z,e.tableUpSize||{}),Object.assign(B,e.tableUpEvent||{}),Object.assign(le,e.tableUpInternal||{}),qi.moduleName=le.moduleName,qi.toolName=R.tableWrapper,K.blotName=R.container,Lr.blotName=R.tableCaption,Wr.blotName=R.tableWrapper,Z.blotName=R.tableMain,Br.blotName=R.tableColgroup,zr.blotName=R.tableCol,Hr.blotName=R.tableHead,q.blotName=R.tableBody,Vr.blotName=R.tableFoot,Y.blotName=R.tableRow,X.blotName=R.tableCell,J.blotName=R.tableCellInner,fe.add(R.tableCellInner)}function Gi(e,n){return He({onSelect:function(r,i){e.insertTable(r,i,t.default.sources.USER),n&&n.close()},customBtn:e.options.customBtn,texts:e.options.texts})}function Ki(e){return{bindInHead:!1,key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[R.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,[R.tableWrapper,R.tableMain,R.tableRow,R.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(Lr,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 qi=function(){function e(t,n){var r=this;v(this,e),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`toolBox`,void 0),S(this,`fixTableByLisenter`,pr(this.balanceTables,100)),S(this,`selector`,void 0),S(this,`resizeOb`,void 0),S(this,`modules`,{}),this.quill=t,this.options=this.resolveOptions(n||{}),this.toolBox=this.initialContainer();var i=this.quill.getModule(`toolbar`);if(i&&this.quill.theme.pickers){var a=(i.controls||[]).find(function(e){var t=F(e,1),n=t[0];return n===r.statics.toolName})||[],o=F(a,2),s=o[1];if(s&&s.tagName.toLocaleLowerCase()===`select`){var c=this.quill.theme.pickers.find(function(e){return e.select===s});c&&(c.label.innerHTML=this.options.icon,this.buildCustomSelect(this.options.customSelect,c),c.label.addEventListener(`mousedown`,function(){if(!(!r.selector||!c)){var e=r.selector.getBoundingClientRect(),t=nr(e),n=t.leftLimited;if(n){var i=c.label.getBoundingClientRect();Object.assign(c.options.style,{transform:`translateX(calc(-100% + ${i.width}px))`})}else Object.assign(c.options.style,{transform:void 0})}}))}}for(var l=this.quill.getModule(`keyboard`),u=0,d=Object.values(e.keyboradHandler);u<d.length;u++){var f=d[u];f.bindInHead?l.bindings[f.key].unshift(f):l.addBinding(f.key,f)}this.initModules(),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:zi.table,autoMergeCell:!0,modules:[]},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:`initModules`,value:function(){var e=x(this.options.modules),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.modules[n.module.moduleName]=new n.module(this,this.quill,n.options)}}catch(t){e.e(t)}finally{e.f()}}},{key:`getModule`,value:function(e){return this.modules[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/${R.tableWrapper}`),s=new DOMParser,c=s.parseFromString(a,`text/html`),l=0,u=Array.from(c.querySelectorAll(`.${o.className} caption[contenteditable], .${o.className} .${X.className} > [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 Li.EmbedBlot)){var o=this.getModule(le.moduleName),s=this.getSelection(!0),c=this.getFormat(s),l=o.getModule(`table-selection`);if(!c[R.tableCellInner]||s.length>0||o&&l&&l.selectedTds.length<=1)return r.call(this,e,n,i);if(o&&l&&l.selectedTds.length>0){var u=l.selectedTds,d=!1,f=[],p=x(u),m;try{for(p.s();!(m=p.n()).done;){var h=m.value,g=h.offset(this.scroll),_=h.length();f.push({index:g,length:_});var v=this.getFormat(g,_);v[e]!==n&&(d=!0)}}catch(e){p.e(e)}finally{p.f()}var y=d?n:!1,b=new Ri,C=x(f.entries()),w;try{for(C.s();!(w=C.n()).done;){var T=F(w.value,2),E=T[0],D=T[1],O=D.index,k=D.length,A=E===0?0:f[E-1].index+f[E-1].length;b.retain(O-A).retain(k,S({},e,y))}}catch(e){C.e(e)}finally{C.f()}var j=this.updateContents(b,i);return this.blur(),j}}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 Ri;s!=null&&(l=s.length()-c,u=s.delta().slice(c,c+l-1).insert(`
|
|
136
|
+
`));var d=e.quill.getContents(t,n+l),f=d.diff(new Ri().insert(i).concat(u)),p=0,m=f.ops.map(function(e){var t=e.attributes,n=N(e,Pi);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=R.tableCellInner;t[i];var a=N(t,[i].map(ae));if(r){var o=d.slice(p-1,p).ops[0];if(o&&o.attributes&&o.attributes[R.tableCellInner]){var s=o.attributes[R.tableCellInner],c=s.style,l=N(s,Fi),u=r(c);return u?M(M({},n),{},{attributes:M(M({},a),{},S({},R.tableCellInner,M({style:u},l)))}):M(M({},n),{},{attributes:M(M({},a),{},S({},R.tableCellInner,l))})}}return M(M({},n),{},{attributes:M({},a)})}return e});return new Ri(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[R.tableCellInner]){var c=s(i.index,i.length,!1),l=new Ri().retain(i.index).concat(c);this.quill.updateContents(l,t.default.sources.USER);return}}var u=r.getModule(`table-selection`);if(r&&u&&u.selectedTds.length>0&&u.table){var d=t.default.find(u.table);if(!d){console.warn(`TableMainFormat not found`);return}var f=u.selectedTds,p=new Set,m=[],h=x(f),g;try{for(h.s();!(g=h.n()).done;){var _=g.value;if(_.parent instanceof X){var v=x(_.parent.getNearByCell(`top`)),y;try{for(v.s();!(y=v.n()).done;){var b=y.value;p.has(b)||(p.add(b),m.push({td:b,cleanBorder:`bottom`}))}}catch(e){v.e(e)}finally{v.f()}var S=x(_.parent.getNearByCell(`left`)),C;try{for(S.s();!(C=S.n()).done;){var w=C.value;p.has(w)||(p.add(w),m.push({td:w,cleanBorder:`right`}))}}catch(e){S.e(e)}finally{S.f()}p.add(_.parent),m.push({td:_.parent,cleanBorder:!0})}}}catch(e){h.e(e)}finally{h.f()}var T=d.descendants(X),E=new Map(T.map(function(e,t){return[e,t]}));m.sort(function(e,t){return E.get(e.td)-E.get(t.td)});for(var D=new Ri,O=0,k=function(){var e=j[A],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=dr(e),n=Object.keys(t).filter(function(e){return!e.startsWith(lr(`border-${r}`))}).reduce(function(e,n){return e[n]=t[n],e},{});return fr(n)}),c=new Ri().retain(i-O).concat(o);D=D.concat(c),O=i+a},A=0,j=m;A<j.length;A++)k();this.quill.updateContents(D,t.default.sources.USER),f.length>1&&this.quill.blur();return}return o.call(this,e)}}}}},{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=1;break}return e.abrupt(`return`);case 1:return i=document.createElement(`div`),i.classList.add(`ql-custom-select`),e.next=2,t(this,n);case 2: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 3: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,R.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, th`));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 zr.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 ae=x(e),oe;try{for(ae.s();!(oe=ae.n()).done;){var se=oe.value;se.domNode.innerHTML=`<p><br></p>`}}catch(e){ae.e(e)}finally{ae.f()}}}return d.body.innerHTML}},{key:`insertTable`,value:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.default.sources.API;if(e>=30||n>=30)throw Error(`Both rows and columns must be less than 30.`);this.quill.focus();var i=this.quill.getSelection();if(i!=null){var a=this.quill.getLeaf(i.index),o=F(a,1),s=o[0];if(s){if(me(s))throw Error(`Not supported ${s.statics.blotName} insert into table.`);var c=G(),l=Array(n).fill(0).map(function(){return G()}),u=this.calculateTableCellBorderWidth(),d=getComputedStyle(this.quill.root),f=Number.parseInt(d.paddingLeft),p=Number.parseInt(d.paddingRight),m=this.quill.root.scrollHeight>this.quill.root.clientHeight?sr({target:this.quill.root}):0,h=Number.parseInt(d.width)-f-p-u-m,g=this.options.full?`${Math.max(1/n*100,z.colMinWidthPre)}%`:`${Math.max(Math.floor(h/n),z.colMinWidthPx)}px`,_=[{retain:i.index}],v=this.quill.getContents(i.index,1),y=this.quill.getLine(i.index),b=F(y,2),x=b[1];v.ops[0].insert!==`
|
|
137
137
|
`&&x!==0&&_.push({insert:`
|
|
138
138
|
`});for(var C=0;C<n;C++)_.push({insert:S({},R.tableCol,{width:g,tableId:c,colId:l[C],full:this.options.full})});for(var w=0;w<e;w++)for(var T=G(),E=0;E<n;E++)_.push({insert:`
|
|
139
|
-
`,attributes:S({},R.tableCellInner,{tableId:c,rowId:T,colId:l[E],rowspan:1,colspan:1})});this.quill.updateContents(new
|
|
139
|
+
`,attributes:S({},R.tableCellInner,{tableId:c,rowId:T,colId:l[E],rowspan:1,colspan:1})});this.quill.updateContents(new Ri(_),r),this.quill.setSelection(i.index+n,t.default.sources.SILENT),this.quill.focus()}}}},{key:`calculateTableCellBorderWidth`,value:function(){var e=`
|
|
140
140
|
<table class="${Z.className}">
|
|
141
141
|
<tbody>
|
|
142
142
|
<tr>
|
|
@@ -144,5 +144,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
144
144
|
</tr>
|
|
145
145
|
</tbody>
|
|
146
146
|
</table>
|
|
147
|
-
`,t=document.createElement(`div`);t.className=Mr.className,t.innerHTML=e,t.style.position=`absolute`,t.style.left=`-9999px`,t.style.top=`-9999px`,t.style.visibility=`hidden`,this.quill.root.appendChild(t);var n=window.getComputedStyle(t.querySelector(`td`)),r=Number.parseFloat(n.borderWidth)||0;return this.quill.root.removeChild(t),r}},{key:`fixUnusuaDeletelTable`,value:function(e){var t=e.getBodys(),n=e.getColIds(),r=e.tableId,i=x(t),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.getRows();if(s.length===0){o.remove();continue}if(n.length!==0){var c=Array(s.length).fill(0).map(function(){return Array(n.length).fill(!1)}),l=x(s.entries()),u;try{for(l.s();!(u=l.n()).done;){for(var d=F(u.value,2),f=d[0],p=d[1],m=0,h=0,g=c[f],_=p.descendants(X);h<n.length;){if(g[h]){h+=1;continue}var v=_[m];if(!v||v.colId!==n[h])p.insertBefore(ji(this.quill.scroll,{tableId:r,colId:n[h],rowId:p.rowId}),v);else{f+v.rowspan-1>=s.length&&(v.getCellInner().rowspan=s.length-f);var y=v.colspan,b=v.rowspan;if(y>1)for(var S=1;S<y;S++)g[h+S]=!0;if(b>1)for(var C=f+1;C<f+b;C++)for(var w=0;w<y;w++)c[C][h+w]=!0;m+=1}h+=1}if(m<_.length)for(var T=m;T<_.length;T++)_[T].remove()}}catch(e){l.e(e)}finally{l.f()}}}}catch(e){i.e(e)}finally{i.f()}}},{key:`balanceTables`,value:function(){var e=x(this.quill.scroll.descendants(Z)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.checkEmptyCol(this.options.autoMergeCell),n.checkEmptyRow(this.options.autoMergeCell),this.fixUnusuaDeletelTable(n)}}catch(t){e.e(t)}finally{e.f()}}},{key:`listenBalanceCells`,value:function(){var e=this;this.quill.on(t.default.events.SCROLL_OPTIMIZE,function(n){n.some(function(t){return[`TD`,`TR`,`TBODY`,`TABLE`].includes(t.target.tagName)?(e.fixTableByLisenter(),!0):!1});var r=x(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=a.target;if(o.tagName===`TABLE`){var s=t.default.find(o);if(s){s.sortMergeChildren();break}}}}catch(e){r.e(e)}finally{r.f()}})}},{key:`deleteTable`,value:function(e){if(e.length!==0){var t=H(e[0],R.tableMain);t&&t.remove()}}},{key:`appendRow`,value:function(e,t){if(!(e.length<=0)){var n=e[t?e.length-1:0],r=he(n,[R.tableMain,R.tableRow]),i=F(r,2),a=i[0],o=i[1],s=a.getRows(),c=s.indexOf(o),l=c+(t?n.rowspan:0);a.insertRow(l)}}},{key:`appendCol`,value:function(e,t){if(!(e.length<=0)){var n=e.reduce(function(e,n){var r=n.getColumnIndex();return(!t&&r<=e[1]||t&&r>=e[1])&&(e=[n,r]),e},[e[0],e[0].getColumnIndex()]),r=F(n,1),i=r[0],a=i.getColumnIndex()+(t?i.colspan:0),o=H(i,R.tableMain),s=o.tableId,c=G(),l=o.descendants(Or),u=F(l,1),d=u[0];d&&d.insertColByIndex(a,{tableId:s,colId:c,width:o.full?6:160,full:o.full});for(var f=o.getRows(),p=[],m=0,h=0,g=Object.values(f);h<g.length;h++){var _=g[h],v=p.shift()||0;if(m>0){--m;continue}var y=_.insertCell(a-v,{tableId:s,rowId:_.rowId,colId:c,rowspan:1,colspan:1});y.skipRowNum&&(m+=y.skipRowNum);var b=x(y.entries()),S;try{for(b.s();!(S=b.n()).done;){var C=F(S.value,2),w=C[0],T=C[1];p[w]=(p[w]||0)+T}}catch(e){b.e(e)}finally{b.f()}}}}},{key:`fixTableByRemove`,value:function(e){if(this.options.autoMergeCell){var t=e.getRows(),n=e.getCols(),r=n.reduce(function(e,t){return e[t.colId]=0,e},{}),i=L(t).reverse(),a=[],o=x(i.entries()),s;try{var c=function(){var e=F(s.value,2),n=e[0],i=e[1],o=t.length-n-1;i.children.length<=0?a.push(o):i.foreachCellInner(function(e){var t=a.reduce(function(t,n){return e.rowspan+o>n?t+1:t},0);e.rowspan-=t,r[e.colId]+=1})};for(o.s();!(s=o.n()).done;)c()}catch(e){o.e(e)}finally{o.f()}for(var l=0,u=0,d=Object.values(r);u<d.length;u++){var f=d[u];if(f===0)for(var p=[],m=0,h=0,g=Object.values(t);h<g.length;h++){var _=g[h],v=p.shift()||0,y=[];m>0?(y=_.getCellByColumIndex(l-v)[2],--m):(y=_.removeCell(l-v),y.skipRowNum&&(m+=y.skipRowNum));var b=x(y.entries()),S;try{for(b.s();!(S=b.n()).done;){var C=F(S.value,2),w=C[0],T=C[1];p[w]=(p[w]||0)+T}}catch(e){b.e(e)}finally{b.f()}}else l+=1}var E=x(n),D;try{for(E.s();!(D=E.n()).done;){var O=D.value;r[O.colId]===0&&(O.prev?O.prev.width+=O.width:O.next&&(O.next.width+=O.width),O.remove())}}catch(e){E.e(e)}finally{E.f()}}}},{key:`removeRow`,value:function(e){if(!(e.length<=0)){var t=e[0],n=H(t,R.tableMain),r=n.getRows(),i=r.length,a=-1,o=x(e),s;try{for(o.s();!(s=o.n()).done;){var c=s.value,l=H(c,R.tableRow),u=r.indexOf(l);u<i&&(i=u),u+c.rowspan>a&&(a=u+c.rowspan)}}catch(e){o.e(e)}finally{o.f()}for(var d={},f=function(e){var t=r[e];t.foreachCellInner(function(t){t.rowspan+e>a&&(d[t.colId]={rowspan:t.rowspan+e-a,colspan:t.colspan,colIndex:t.getColumnIndex()}),t.parent.remove()}),t.length()===0&&t.remove()},p=i;p<Math.min(r.length,a);p++)f(p);if(r[a])for(var m=r[a],h=n.tableId,g=0,_=Object.entries(d);g<_.length;g++){var v=F(_[g],2),y=v[0],b=v[1],S=b.colIndex,C=b.colspan,w=b.rowspan;m.insertCell(S,{tableId:h,rowId:m.rowId,colId:y,colspan:C,rowspan:w})}this.fixTableByRemove(n)}}},{key:`removeCol`,value:function(e){if(!(e.length<=0)){var t=e[0],n=H(t,R.tableMain),r={},i=x(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;r[o.rowId]||(r[o.rowId]=0),r[o.rowId]+=o.colspan}}catch(e){i.e(e)}finally{i.f()}for(var s=Math.max.apply(Math,L(Object.values(r))),c=t.getColumnIndex(),l=n.descendants(Y),u=0;u<s;u++)for(var d=[],f=0,p=0,m=Object.values(l);p<m.length;p++){var h=m[p],g=d.shift()||0;if(f>0){--f;continue}var _=h.removeCell(c-g);_.skipRowNum&&(f+=_.skipRowNum);var v=x(_.entries()),y;try{for(v.s();!(y=v.n()).done;){var b=F(y.value,2),S=b[0],C=b[1];d[S]=(d[S]||0)+C}}catch(e){v.e(e)}finally{v.f()}}var w=n.descendants(Or),T=F(w,1),E=T[0];if(E)for(var D=0;D<s;D++)E.removeColByIndex(c);this.fixTableByRemove(n)}}},{key:`mergeCells`,value:function(e){if(!(e.length<=1)){var n=e[0],r=n.getTableBody(),i=n.getTableRow();if(!(!r||!i)){for(var a=1;a<e.length;a++){var o=e[a],s=o.getTableBody();if(s&&s!==r){var c=o.getTableRow();c&&(i.parent.insertBefore(c,i.next),i=c)}}r.convertBody(n.wrapTag);var l=e.reduce(function(e,t,n){var r=t.colId;e[0][r]||(e[0][r]=0),e[0][r]+=t.rowspan;var i=t.rowId;return e[1][i]||(e[1][i]=0),e[1][i]+=t.colspan,n!==0&&(t.moveChildren(e[2]),t.parent.remove()),e},[{},{},n]),u=Math.max.apply(Math,L(Object.values(l[0]))),d=Math.max.apply(Math,L(Object.values(l[1]))),f=l[2];f.colspan=d,f.rowspan=u;var p=this.quill.getIndex(f);this.quill.setSelection({index:p,length:0},t.default.sources.SILENT);var m=H(f,R.tableMain);this.fixTableByRemove(m)}}}},{key:`splitCell`,value:function(e){if(e.length===1){var t=e[0];if(!(t.colspan===1&&t.rowspan===1)){var n=he(t,[R.tableMain,R.tableRow]),r=F(n,2),i=r[0],a=r[1],o=i.getRows(),s=i.tableId,c=t.getColumnIndex(),l=i.getColIds().slice(c,c+t.colspan).reverse(),u=t.formats()[R.tableCellInner],d=u.emptyRow,f=N(u,wi),p=o.indexOf(a);if(p!==-1){var m=o[p],h=t.rowspan;for(t.colspan=1,t.rowspan=1;m&&h>0;){var g=x(l),_;try{for(g.s();!(_=g.n()).done;){var v=_.value;m===a&&v===t.colId||m.insertCell(c+(m===a?1:0),M(M({},f),{},{tableId:s,rowId:m.rowId,colId:v,rowspan:1,colspan:1}))}}catch(e){g.e(e)}finally{g.f()}--h,p+=1,m=o[p]}}}}}}],[{key:`register`,value:function(){var e;Mr.allowedChildren=[Z],Z.allowedChildren=[Or,Tr,Ar,q,kr],Z.requiredContainer=Mr,Tr.requiredContainer=Z,Or.allowedChildren=[Dr],Or.requiredContainer=Z,Ar.allowedChildren=[Y],Ar.requiredContainer=Z,q.allowedChildren=[Y],q.requiredContainer=Z,kr.allowedChildren=[Y],kr.requiredContainer=Z,Y.allowedChildren=[X],X.allowedChildren=[J,Oi],X.requiredContainer=Y,J.requiredContainer=X;var n=new Set([`table`]),r=Object.entries(t.default.imports).filter(function(e){var t=F(e,2),r=t[0],i=t[1],a=r.split(`formats/`)[1];return r.startsWith(`formats/`)&&!n.has(a)&&!be(i,Ti.Attributor)&&(be(i,ki)||be(i,Ai))}),i=r.reduce(function(e,t){var n=F(t,2),r=n[0],i=n[1],a=be(i,Ai)?mr:fr;return e[r]=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,null,[{key:`register`,value:function(){}}])}(ye(i,[a])),e},{});t.default.register(M(M({"blots/scroll":br,"blots/block":fr,"blots/block/embed":mr},i),{},(e={},S(S(S(S(S(S(S(S(S(S(e,`blots/${R.container}`,K),`formats/${R.tableCell}`,X),`formats/${R.tableCellInner}`,J),`formats/${R.tableRow}`,Y),`formats/${R.tableHead}`,Ar),`formats/${R.tableBody}`,q),`formats/${R.tableFoot}`,kr),`formats/${R.tableCol}`,Dr),`formats/${R.tableColgroup}`,Or),`formats/${R.tableCaption}`,Tr),S(S(S(e,`formats/${R.tableMain}`,Z),`formats/${R.tableWrapper}`,Mr),`modules/clipboard`,Wr))),!0)}}])}();S(Fi,`moduleName`,le.moduleName),S(Fi,`toolName`,R.tableWrapper),S(Fi,`keyboradHandler`,{"forbid remove table by backspace":{bindInHead:!0,key:`Backspace`,collapsed:!0,offset:0,handler:function(e,t){var n=this.quill.getLine(e.index),r=n[0];if(r.prev instanceof Mr)return r.prev.remove(),!1;if(t.format[R.tableCellInner]){var i=r.offset(H(r,R.tableCellInner));if(i===0)return!1}return!0}},"forbid remove table by delete":{bindInHead:!0,key:`Delete`,collapsed:!0,handler:function(e,t){var n=this.quill.getLine(e.index),r=n[0],i=n[1];if((r.next instanceof Mr||r.next instanceof Dr)&&i===r.length()-1)return!1;if(t.format[R.tableCellInner]){var a=H(r,R.tableCellInner);if(r===a.children.tail&&i===r.length()-1)return!1}return!0}},"table up":Pi(!0),"table down":Pi(!1),"table caption break":{bindInHead:!0,key:`Enter`,shiftKey:null,format:[R.tableCaption],handler:function(e,t){return!1}}});var Ii=Fi;exports.BlockEmbedOverride=mr,exports.BlockOverride=fr,exports.ContainerFormat=K,exports.ScrollOverride=br,exports.Scrollbar=vi,exports.TableAlign=Fr,exports.TableBodyFormat=q,exports.TableCaptionFormat=Tr,exports.TableCellFormat=X,exports.TableCellInnerFormat=J,exports.TableClipboard=Wr,exports.TableColFormat=Dr,exports.TableColgroupFormat=Or,exports.TableDomSelector=Pr,exports.TableFootFormat=kr,exports.TableHeadFormat=Ar,exports.TableMainFormat=Z,exports.TableMenuCommon=ui,exports.TableMenuContextmenu=di,exports.TableMenuSelect=fi,exports.TableResizeBox=hi,exports.TableResizeCommon=mi,exports.TableResizeLine=gi,exports.TableResizeScale=_i,exports.TableRowFormat=Y,exports.TableSelection=xi,exports.TableUp=Fi,exports.TableVirtualScrollbar=yi,exports.TableWrapperFormat=Mr,exports.blotName=R,exports.createColorPicker=Ie,exports.createSelectBox=He,exports.createTooltip=Vn,exports.default=Ii,exports.defaultCustomSelect=Ni,exports.findParentBlot=H,exports.findParentBlots=he,exports.getTableMainRect=Nr,exports.isTableAlignRight=pi,exports.randomId=G,exports.tableMenuTools=Q,exports.tableUpEvent=B,exports.tableUpInternal=le,exports.tableUpSize=z,exports.updateTableConstants=Mi});
|
|
147
|
+
`,t=document.createElement(`div`);t.className=Wr.className,t.innerHTML=e,t.style.position=`absolute`,t.style.left=`-9999px`,t.style.top=`-9999px`,t.style.visibility=`hidden`,this.quill.root.appendChild(t);var n=window.getComputedStyle(t.querySelector(`td`)),r=Number.parseFloat(n.borderWidth)||0;return this.quill.root.removeChild(t),r}},{key:`fixUnusuaDeletelTable`,value:function(e){var t=e.getColIds();if(t.length===0){e.remove();return}var n=e.getBodys(),r=e.tableId,i=x(n),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.getRows();if(s.length===0){o.remove();continue}var c=Array(s.length).fill(0).map(function(){return Array(t.length).fill(!1)}),l=x(s.entries()),u;try{for(l.s();!(u=l.n()).done;){for(var d=F(u.value,2),f=d[0],p=d[1],m=0,h=0,g=c[f],_=p.descendants(X);h<t.length;){if(g[h]){h+=1;continue}var v=_[m];if(!v||v.colId!==t[h])p.insertBefore(Ui(this.quill.scroll,{tableId:r,colId:t[h],rowId:p.rowId}),v);else{f+v.rowspan-1>=s.length&&(v.getCellInner().rowspan=s.length-f);var y=v.colspan,b=v.rowspan;if(y>1)for(var S=1;S<y;S++)g[h+S]=!0;if(b>1)for(var C=f+1;C<f+b;C++)for(var w=0;w<y;w++)c[C][h+w]=!0;m+=1}h+=1}if(m<_.length)for(var T=m;T<_.length;T++)_[T].remove()}}catch(e){l.e(e)}finally{l.f()}}}catch(e){i.e(e)}finally{i.f()}}},{key:`balanceTables`,value:function(){var e=x(this.quill.scroll.descendants(Z)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.checkEmptyCol(this.options.autoMergeCell),n.checkEmptyRow(this.options.autoMergeCell),this.fixUnusuaDeletelTable(n)}}catch(t){e.e(t)}finally{e.f()}}},{key:`listenBalanceCells`,value:function(){var e=this;this.quill.on(t.default.events.SCROLL_OPTIMIZE,function(n){n.some(function(t){return[`TD`,`TR`,`TBODY`,`TABLE`].includes(t.target.tagName)?(e.fixTableByLisenter(),!0):!1});var r=x(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=a.target;if(o.tagName===`TABLE`){var s=t.default.find(o);if(s){s.sortMergeChildren();break}}}}catch(e){r.e(e)}finally{r.f()}})}},{key:`deleteTable`,value:function(e){if(e.length!==0){var t=H(e[0],R.tableMain);t&&t.remove()}}},{key:`appendRow`,value:function(e,t){if(!(e.length<=0)){var n=e[t?e.length-1:0],r=he(n,[R.tableMain,R.tableRow]),i=F(r,2),a=i[0],o=i[1],s=a.getRows(),c=s.indexOf(o),l=c+(t?n.rowspan:0);a.insertRow(l)}}},{key:`appendCol`,value:function(e,t){if(!(e.length<=0)){var n=e.reduce(function(e,n){var r=n.getColumnIndex();return(!t&&r<=e[1]||t&&r>=e[1])&&(e=[n,r]),e},[e[0],e[0].getColumnIndex()]),r=F(n,1),i=r[0],a=i.getColumnIndex()+(t?i.colspan:0),o=H(i,R.tableMain),s=o.tableId,c=G(),l=o.descendants(Br),u=F(l,1),d=u[0];d&&d.insertColByIndex(a,{tableId:s,colId:c,width:o.full?6:160,full:o.full});for(var f=o.getRows(),p=[],m=0,h=0,g=Object.values(f);h<g.length;h++){var _=g[h],v=p.shift()||0;if(m>0){--m;continue}var y=_.insertCell(a-v,{tableId:s,rowId:_.rowId,colId:c,rowspan:1,colspan:1});y.skipRowNum&&(m+=y.skipRowNum);var b=x(y.entries()),S;try{for(b.s();!(S=b.n()).done;){var C=F(S.value,2),w=C[0],T=C[1];p[w]=(p[w]||0)+T}}catch(e){b.e(e)}finally{b.f()}}}}},{key:`fixTableByRemove`,value:function(e){if(this.options.autoMergeCell){var t=e.getRows(),n=e.getCols(),r=n.reduce(function(e,t){return e[t.colId]=0,e},{}),i=L(t).reverse(),a=[],o=x(i.entries()),s;try{var c=function(){var e=F(s.value,2),n=e[0],i=e[1],o=t.length-n-1;i.children.length<=0?a.push(o):i.foreachCellInner(function(e){var t=a.reduce(function(t,n){return e.rowspan+o>n?t+1:t},0);e.rowspan-=t,r[e.colId]+=1})};for(o.s();!(s=o.n()).done;)c()}catch(e){o.e(e)}finally{o.f()}for(var l=0,u=0,d=Object.values(r);u<d.length;u++){var f=d[u];if(f===0)for(var p=[],m=0,h=0,g=Object.values(t);h<g.length;h++){var _=g[h],v=p.shift()||0,y=[];m>0?(y=_.getCellByColumIndex(l-v)[2],--m):(y=_.removeCell(l-v),y.skipRowNum&&(m+=y.skipRowNum));var b=x(y.entries()),S;try{for(b.s();!(S=b.n()).done;){var C=F(S.value,2),w=C[0],T=C[1];p[w]=(p[w]||0)+T}}catch(e){b.e(e)}finally{b.f()}}else l+=1}var E=x(n),D;try{for(E.s();!(D=E.n()).done;){var O=D.value;r[O.colId]===0&&(O.prev?O.prev.width+=O.width:O.next&&(O.next.width+=O.width),O.remove())}}catch(e){E.e(e)}finally{E.f()}}}},{key:`removeRow`,value:function(e){if(!(e.length<=0)){var t=e[0],n=H(t,R.tableMain),r=n.getRows(),i=r.length,a=-1,o=x(e),s;try{for(o.s();!(s=o.n()).done;){var c=s.value,l=H(c,R.tableRow),u=r.indexOf(l);u<i&&(i=u),u+c.rowspan>a&&(a=u+c.rowspan)}}catch(e){o.e(e)}finally{o.f()}for(var d={},f=function(e){var t=r[e];t.foreachCellInner(function(t){t.rowspan+e>a&&(d[t.colId]={rowspan:t.rowspan+e-a,colspan:t.colspan,colIndex:t.getColumnIndex()}),t.parent.remove()}),t.length()===0&&t.remove()},p=i;p<Math.min(r.length,a);p++)f(p);if(r[a])for(var m=r[a],h=n.tableId,g=0,_=Object.entries(d);g<_.length;g++){var v=F(_[g],2),y=v[0],b=v[1],S=b.colIndex,C=b.colspan,w=b.rowspan;m.insertCell(S,{tableId:h,rowId:m.rowId,colId:y,colspan:C,rowspan:w})}this.fixTableByRemove(n)}}},{key:`removeCol`,value:function(e){if(!(e.length<=0)){var t=e[0],n=H(t,R.tableMain),r={},i=x(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;r[o.rowId]||(r[o.rowId]=0),r[o.rowId]+=o.colspan}}catch(e){i.e(e)}finally{i.f()}for(var s=Math.max.apply(Math,L(Object.values(r))),c=t.getColumnIndex(),l=n.descendants(Y),u=0;u<s;u++)for(var d=[],f=0,p=0,m=Object.values(l);p<m.length;p++){var h=m[p],g=d.shift()||0;if(f>0){--f;continue}var _=h.removeCell(c-g);_.skipRowNum&&(f+=_.skipRowNum);var v=x(_.entries()),y;try{for(v.s();!(y=v.n()).done;){var b=F(y.value,2),S=b[0],C=b[1];d[S]=(d[S]||0)+C}}catch(e){v.e(e)}finally{v.f()}}var w=n.descendants(Br),T=F(w,1),E=T[0];if(E)for(var D=0;D<s;D++)E.removeColByIndex(c);this.fixTableByRemove(n)}}},{key:`mergeCells`,value:function(e){if(!(e.length<=1)){var n=e[0],r=n.getTableBody(),i=n.getTableRow();if(!(!r||!i)){for(var a=1;a<e.length;a++){var o=e[a],s=o.getTableBody();if(s&&s!==r){var c=o.getTableRow();c&&(i.parent.insertBefore(c,i.next),i=c)}}r.convertBody(n.wrapTag);var l=e.reduce(function(e,t,n){var r=t.colId;e[0][r]||(e[0][r]=0),e[0][r]+=t.rowspan;var i=t.rowId;return e[1][i]||(e[1][i]=0),e[1][i]+=t.colspan,n!==0&&(t.moveChildren(e[2]),t.parent.remove()),e},[{},{},n]),u=Math.max.apply(Math,L(Object.values(l[0]))),d=Math.max.apply(Math,L(Object.values(l[1]))),f=l[2];f.colspan=d,f.rowspan=u;var p=this.quill.getIndex(f);this.quill.setSelection({index:p,length:0},t.default.sources.SILENT);var m=H(f,R.tableMain);this.fixTableByRemove(m)}}}},{key:`splitCell`,value:function(e){if(e.length===1){var t=e[0];if(!(t.colspan===1&&t.rowspan===1)){var n=he(t,[R.tableMain,R.tableRow]),r=F(n,2),i=r[0],a=r[1],o=i.getRows(),s=i.tableId,c=t.getColumnIndex(),l=i.getColIds().slice(c,c+t.colspan).reverse(),u=t.formats()[R.tableCellInner];u.emptyRow;var d=N(u,Ii),f=o.indexOf(a);if(f!==-1){var p=o[f],m=t.rowspan;for(t.colspan=1,t.rowspan=1;p&&m>0;){var h=x(l),g;try{for(h.s();!(g=h.n()).done;){var _=g.value;p===a&&_===t.colId||p.insertCell(c+(p===a?1:0),M(M({},d),{},{tableId:s,rowId:p.rowId,colId:_,rowspan:1,colspan:1}))}}catch(e){h.e(e)}finally{h.f()}--m,f+=1,p=o[f]}}}}}}],[{key:`register`,value:function(){var e;Wr.allowedChildren=[Z],Z.allowedChildren=[Br,Lr,Hr,q,Vr],Z.requiredContainer=Wr,Lr.requiredContainer=Z,Br.allowedChildren=[zr],Br.requiredContainer=Z,Hr.allowedChildren=[Y],Hr.requiredContainer=Z,q.allowedChildren=[Y],q.requiredContainer=Z,Vr.allowedChildren=[Y],Vr.requiredContainer=Z,Y.allowedChildren=[X],X.allowedChildren=[J,Bi],X.requiredContainer=Y,J.requiredContainer=X;var n=new Set([`table`]),r=Object.entries(t.default.imports).filter(function(e){var t=F(e,2),r=t[0],i=t[1],a=r.split(`formats/`)[1];return r.startsWith(`formats/`)&&!n.has(a)&&(be(i,Vi)||be(i,Hi))}),i=r.reduce(function(e,t){var n=F(t,2),r=n[0],i=n[1],a=be(i,Hi)?Er:wr;return e[r]=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,null,[{key:`register`,value:function(){}}])}(ye(i,[a])),e},{});t.default.register(M(M({"blots/scroll":Mr,"blots/block":wr,"blots/block/embed":Er},i),{},(e={},S(S(S(S(S(S(S(S(S(S(e,`blots/${R.container}`,K),`formats/${R.tableCell}`,X),`formats/${R.tableCellInner}`,J),`formats/${R.tableRow}`,Y),`formats/${R.tableHead}`,Hr),`formats/${R.tableBody}`,q),`formats/${R.tableFoot}`,Vr),`formats/${R.tableCol}`,zr),`formats/${R.tableColgroup}`,Br),`formats/${R.tableCaption}`,Lr),S(S(S(e,`formats/${R.tableMain}`,Z),`formats/${R.tableWrapper}`,Wr),`modules/clipboard`,ni))),!0)}}])}();S(qi,`moduleName`,le.moduleName),S(qi,`toolName`,R.tableWrapper),S(qi,`keyboradHandler`,{"forbid remove table by backspace":{bindInHead:!0,key:`Backspace`,collapsed:!0,offset:0,handler:function(e,t){var n=this.quill.getLine(e.index),r=n[0];if(r.prev instanceof Wr)return r.prev.remove(),!1;if(t.format[R.tableCellInner]){var i=r.offset(H(r,R.tableCellInner));if(i===0)return!1}return!0}},"forbid remove table by delete":{bindInHead:!0,key:`Delete`,collapsed:!0,handler:function(e,t){var n=this.quill.getLine(e.index),r=n[0],i=n[1];if((r.next instanceof Wr||r.next instanceof zr)&&i===r.length()-1)return!1;if(t.format[R.tableCellInner]){var a=H(r,R.tableCellInner);if(r===a.children.tail&&i===r.length()-1)return!1}return!0}},"table up":Ki(!0),"table down":Ki(!1),"table caption break":{bindInHead:!0,key:`Enter`,shiftKey:null,format:[R.tableCaption],handler:function(e,t){return!1}}});var Ji=qi;exports.BlockEmbedOverride=Er,exports.BlockOverride=wr,exports.ContainerFormat=K,exports.ScrollOverride=Mr,exports.Scrollbar=Ai,exports.TableAlign=qr,exports.TableBodyFormat=q,exports.TableCaptionFormat=Lr,exports.TableCellFormat=X,exports.TableCellInnerFormat=J,exports.TableClipboard=ni,exports.TableColFormat=zr,exports.TableColgroupFormat=Br,exports.TableDomSelector=Kr,exports.TableFootFormat=Vr,exports.TableHeadFormat=Hr,exports.TableMainFormat=Z,exports.TableMenuCommon=Si,exports.TableMenuContextmenu=Ci,exports.TableMenuSelect=wi,exports.TableResizeBox=Di,exports.TableResizeCommon=Ei,exports.TableResizeLine=Oi,exports.TableResizeScale=ki,exports.TableRowFormat=Y,exports.TableSelection=Ni,exports.TableUp=qi,exports.TableVirtualScrollbar=ji,exports.TableWrapperFormat=Wr,exports.blotName=R,exports.createColorPicker=Ie,exports.createSelectBox=He,exports.createTooltip=Qn,exports.default=Ji,exports.defaultCustomSelect=Gi,exports.findParentBlot=H,exports.findParentBlots=he,exports.getTableMainRect=Gr,exports.isTableAlignRight=Ti,exports.randomId=G,exports.tableMenuTools=Q,exports.tableUpEvent=B,exports.tableUpInternal=le,exports.tableUpSize=z,exports.updateTableConstants=Wi});
|
|
148
148
|
//# sourceMappingURL=index.umd.js.map
|